diff options
58 files changed, 4975 insertions, 5561 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index a5d458cf..ec50146e 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -38,14 +38,12 @@ int sortedTeamPlayers[ TEAM_MAXOVERLAY ]; int numSortedTeamPlayers; //TA UI -int CG_Text_Width( const char *text, float scale, int limit ) +float CG_Text_Width( const char *text, float scale, int limit ) { int count,len; float out; glyphInfo_t *glyph; float useScale; -// FIXME: see ui_main.c, same problem -// const unsigned char *s = text; const char *s = text; fontInfo_t *font = &cgDC.Assets.textFont; @@ -84,7 +82,7 @@ int CG_Text_Width( const char *text, float scale, int limit ) return out * useScale; } -int CG_Text_Height( const char *text, float scale, int limit ) +float CG_Text_Height( const char *text, float scale, int limit ) { int len, count; float max; @@ -130,6 +128,68 @@ int CG_Text_Height( const char *text, float scale, int limit ) return max * useScale; } +float CG_Text_EmWidth( float scale ) +{ + return CG_Text_Width( "M", scale, 0 ); +} + +float CG_Text_EmHeight( float scale ) +{ + return CG_Text_Height( "M", scale, 0 ); +} + +static void CG_AlignText( rectDef_t *rect, const char *text, float scale, + float w, float h, + int align, int valign, + float *x, float *y ) +{ + float tx, ty; + + if( scale > 0.0f ) + { + w = CG_Text_Width( text, scale, 0 ); + h = CG_Text_Height( text, scale, 0 ); + } + + switch( align ) + { + default: + case ITEM_ALIGN_LEFT: + tx = 0.0f; + break; + + case ITEM_ALIGN_RIGHT: + tx = rect->w - w; + break; + + case ITEM_ALIGN_CENTER: + tx = ( rect->w - w ) / 2.0f; + break; + } + + switch( valign ) + { + default: + case ITEM_VALIGN_BOTTOM: + ty = rect->h; + break; + + case ITEM_VALIGN_TOP: + ty = h; + break; + + case ITEM_VALIGN_CENTER: + ty = h + ( ( rect->h - h ) / 2.0f ); + break; + } + + if( x ) + *x = rect->x + tx; + + if( y ) + *y = rect->y + ty; +} + void CG_Text_PaintChar( float x, float y, float width, float height, float scale, float s, float t, float s2, float t2, qhandle_t hShader ) { @@ -431,11 +491,12 @@ 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 textStyle, int special, float progress ) + int align, int textalign, int textStyle, + int special, float progress ) { float rimWidth = rect->h / 20.0f; float doneWidth, leftWidth; - float tx, ty, tw, th; + float tx, ty; char textBuffer[ 8 ]; if( rimWidth < 0.6f ) @@ -481,29 +542,7 @@ static void CG_DrawProgressBar( rectDef_t *rect, vec4_t color, float scale, if( scale > 0.0 ) { Com_sprintf( textBuffer, sizeof( textBuffer ), "%d%%", (int)( progress * 100 ) ); - tw = CG_Text_Width( textBuffer, scale, 0 ); - th = scale * 40.0f; - - switch( align ) - { - case ITEM_ALIGN_LEFT: - tx = rect->x + ( rect->w / 10.0f ); - ty = rect->y + ( rect->h / 2.0f ) + ( th / 2.0f ); - break; - - case ITEM_ALIGN_RIGHT: - tx = rect->x + rect->w - ( rect->w / 10.0f ) - tw; - ty = rect->y + ( rect->h / 2.0f ) + ( th / 2.0f ); - break; - - case ITEM_ALIGN_CENTER: - tx = rect->x + ( rect->w / 2.0f ) - ( tw / 2.0f ); - ty = rect->y + ( rect->h / 2.0f ) + ( th / 2.0f ); - break; - - default: - tx = ty = 0.0f; - } + CG_AlignText( rect, textBuffer, scale, 0.0f, 0.0f, textalign, ITEM_VALIGN_CENTER, &tx, &ty ); CG_Text_Paint( tx, ty, scale, color, textBuffer, 0, 0, textStyle ); } @@ -890,16 +929,6 @@ static void CG_DrawPlayerWallclimbing( rectDef_t *rect, vec4_t color, qhandle_t trap_R_SetColor( NULL ); } -static void CG_DrawPlayerStamina( rectDef_t *rect, vec4_t color, float scale, - int align, int textStyle, int special ) -{ - playerState_t *ps = &cg.snap->ps; - int stamina = ps->stats[ STAT_STAMINA ]; - float progress = ( (float)stamina + (float)MAX_STAMINA ) / ( (float)MAX_STAMINA * 2.0f ); - - CG_DrawProgressBar( rect, color, scale, align, textStyle, special, progress ); -} - static void CG_DrawPlayerAmmoValue( rectDef_t *rect, vec4_t color ) { int value; @@ -1112,18 +1141,6 @@ static void CG_DrawPlayerHealthValue( rectDef_t *rect, vec4_t color ) trap_R_SetColor( NULL ); } -static void CG_DrawPlayerHealthBar( rectDef_t *rect, vec4_t color, float scale, - int align, int textStyle, int special ) -{ - playerState_t *ps; - float total; - - ps = &cg.snap->ps; - - total = ( (float)ps->stats[ STAT_HEALTH ] / (float)ps->stats[ STAT_MAX_HEALTH ] ); - CG_DrawProgressBar( rect, color, scale, align, textStyle, special, total ); -} - /* ============== CG_DrawPlayerHealthCross @@ -1146,80 +1163,68 @@ static void CG_DrawPlayerHealthCross( rectDef_t *rect, vec4_t color, qhandle_t s } static void CG_DrawProgressLabel( rectDef_t *rect, float text_x, float text_y, vec4_t color, - float scale, int align, const char *s, float fraction ) + float scale, int textalign, int textvalign, + const char *s, float fraction ) { vec4_t white = { 1.0f, 1.0f, 1.0f, 1.0f }; - float tx, tw = CG_Text_Width( s, scale, 0 ); + float tx, ty; - switch( align ) - { - case ITEM_ALIGN_LEFT: - tx = 0.0f; - break; - - case ITEM_ALIGN_RIGHT: - tx = rect->w - tw; - break; - - case ITEM_ALIGN_CENTER: - tx = ( rect->w / 2.0f ) - ( tw / 2.0f ); - break; - - default: - tx = 0.0f; - } + CG_AlignText( rect, s, scale, 0.0f, 0.0f, textalign, textvalign, &tx, &ty ); if( fraction < 1.0f ) - CG_Text_Paint( rect->x + text_x + tx, rect->y + text_y, scale, white, + CG_Text_Paint( text_x + tx, text_y + ty, scale, white, s, 0, 0, ITEM_TEXTSTYLE_NORMAL ); else - CG_Text_Paint( rect->x + text_x + tx, rect->y + text_y, scale, color, + CG_Text_Paint( text_x + tx, text_y + ty, scale, color, s, 0, 0, ITEM_TEXTSTYLE_NEON ); } static void CG_DrawMediaProgress( rectDef_t *rect, vec4_t color, float scale, - int align, int textStyle, int special ) + int align, int textalign, int textStyle, int special ) { - CG_DrawProgressBar( rect, color, scale, align, textStyle, special, cg.mediaFraction ); + CG_DrawProgressBar( rect, color, scale, align, textalign, textStyle, special, cg.mediaFraction ); } static void CG_DrawMediaProgressLabel( rectDef_t *rect, float text_x, float text_y, - vec4_t color, float scale, int align ) + vec4_t color, float scale, int textalign, int textvalign ) { - CG_DrawProgressLabel( rect, text_x, text_y, color, scale, align, "Map and Textures", cg.mediaFraction ); + CG_DrawProgressLabel( rect, text_x, text_y, color, scale, textalign, textvalign, + "Map and Textures", cg.mediaFraction ); } static void CG_DrawBuildablesProgress( rectDef_t *rect, vec4_t color, float scale, - int align, int textStyle, int special ) + int align, int textalign, int textStyle, int special ) { - CG_DrawProgressBar( rect, color, scale, align, textStyle, special, cg.buildablesFraction ); + CG_DrawProgressBar( rect, color, scale, align, textalign, textStyle, special, cg.buildablesFraction ); } static void CG_DrawBuildablesProgressLabel( rectDef_t *rect, float text_x, float text_y, - vec4_t color, float scale, int align ) + vec4_t color, float scale, int textalign, int textvalign ) { - CG_DrawProgressLabel( rect, text_x, text_y, color, scale, align, "Buildable Models", cg.buildablesFraction ); + CG_DrawProgressLabel( rect, text_x, text_y, color, scale, textalign, textvalign, + "Buildable Models", cg.buildablesFraction ); } static void CG_DrawCharModelProgress( rectDef_t *rect, vec4_t color, float scale, - int align, int textStyle, int special ) + int align, int textalign, int textStyle, int special ) { - CG_DrawProgressBar( rect, color, scale, align, textStyle, special, cg.charModelFraction ); + CG_DrawProgressBar( rect, color, scale, align, textalign, textStyle, special, cg.charModelFraction ); } static void CG_DrawCharModelProgressLabel( rectDef_t *rect, float text_x, float text_y, - vec4_t color, float scale, int align ) + vec4_t color, float scale, int textalign, int textvalign ) { - CG_DrawProgressLabel( rect, text_x, text_y, color, scale, align, "Character Models", cg.charModelFraction ); + CG_DrawProgressLabel( rect, text_x, text_y, color, scale, textalign, textvalign, + "Character Models", cg.charModelFraction ); } static void CG_DrawOverallProgress( rectDef_t *rect, vec4_t color, float scale, - int align, int textStyle, int special ) + int align, int textalign, int textStyle, int special ) { float total; total = ( cg.charModelFraction + cg.buildablesFraction + cg.mediaFraction ) / 3.0f; - CG_DrawProgressBar( rect, color, scale, align, textStyle, special, total ); + CG_DrawProgressBar( rect, color, scale, align, textalign, textStyle, special, total ); } static void CG_DrawLevelShot( rectDef_t *rect ) @@ -1244,87 +1249,31 @@ static void CG_DrawLevelShot( rectDef_t *rect ) CG_DrawPic( rect->x, rect->y, rect->w, rect->h, detail ); } -static void CG_DrawLoadingString( rectDef_t *rect, float text_x, float text_y, vec4_t color, - float scale, int align, int textStyle, const char *s ) -{ - float tw, th, tx; - int pos, i; - char buffer[ 1024 ]; - char *end; - - if( !s[ 0 ] ) - return; - - strcpy( buffer, s ); - tw = CG_Text_Width( s, scale, 0 ); - th = scale * 40.0f; - - pos = i = 0; - - while( pos < strlen( s ) ) - { - strcpy( buffer, &s[ pos ] ); - tw = CG_Text_Width( buffer, scale, 0 ); - - while( tw > rect->w ) - { - end = strrchr( buffer, ' ' ); - - if( end == NULL ) - break; - - *end = '\0'; - tw = CG_Text_Width( buffer, scale, 0 ); - } - - switch( align ) - { - case ITEM_ALIGN_LEFT: - tx = rect->x; - break; - - case ITEM_ALIGN_RIGHT: - tx = rect->x + rect->w - tw; - break; - - case ITEM_ALIGN_CENTER: - tx = rect->x + ( rect->w / 2.0f ) - ( tw / 2.0f ); - break; - - default: - tx = 0.0f; - } - - CG_Text_Paint( tx + text_x, rect->y + text_y + i * ( th + 3 ), scale, color, - buffer, 0, 0, textStyle ); - - pos += strlen( buffer ) + 1; - i++; - } -} - static void CG_DrawLevelName( rectDef_t *rect, float text_x, float text_y, - vec4_t color, float scale, int align, int textStyle ) + vec4_t color, float scale, + int textalign, int textvalign, int textStyle ) { const char *s; s = CG_ConfigString( CS_MESSAGE ); - CG_DrawLoadingString( rect, text_x, text_y, color, scale, align, textStyle, s ); + UI_DrawTextBlock( rect, text_x, text_y, color, scale, textalign, textvalign, textStyle, s ); } static void CG_DrawMOTD( rectDef_t *rect, float text_x, float text_y, - vec4_t color, float scale, int align, int textStyle ) + vec4_t color, float scale, + int textalign, int textvalign, int textStyle ) { const char *s; s = CG_ConfigString( CS_MOTD ); - CG_DrawLoadingString( rect, text_x, text_y, color, scale, align, textStyle, s ); + UI_DrawTextBlock( rect, text_x, text_y, color, scale, textalign, textvalign, textStyle, s ); } static void CG_DrawHostname( rectDef_t *rect, float text_x, float text_y, - vec4_t color, float scale, int align, int textStyle ) + vec4_t color, float scale, + int textalign, int textvalign, int textStyle ) { char buffer[ 1024 ]; const char *info; @@ -1334,7 +1283,7 @@ static void CG_DrawHostname( rectDef_t *rect, float text_x, float text_y, Q_strncpyz( buffer, Info_ValueForKey( info, "sv_hostname" ), 1024 ); Q_CleanStr( buffer ); - CG_DrawLoadingString( rect, text_x, text_y, color, scale, align, textStyle, buffer ); + UI_DrawTextBlock( rect, text_x, text_y, color, scale, textalign, textvalign, textStyle, buffer ); } /* @@ -1519,8 +1468,10 @@ static void CG_Text_Paint_Limit( float *maxX, float x, float y, float scale, } } -static void CG_DrawTeamSpectators( rectDef_t *rect, float scale, vec4_t color, qhandle_t shader ) +static void CG_DrawTeamSpectators( rectDef_t *rect, float scale, int textvalign, vec4_t color, qhandle_t shader ) { + float y; + if( cg.spectatorLen ) { float maxX; @@ -1578,14 +1529,16 @@ static void CG_DrawTeamSpectators( rectDef_t *rect, float scale, vec4_t color, q } maxX = rect->x + rect->w - 2; + CG_AlignText( rect, NULL, 0.0f, 0.0f, CG_Text_EmHeight( scale ), + ITEM_ALIGN_LEFT, textvalign, NULL, &y ); - CG_Text_Paint_Limit( &maxX, cg.spectatorPaintX, rect->y + rect->h - 3, scale, color, + CG_Text_Paint_Limit( &maxX, cg.spectatorPaintX, y, scale, color, &cg.spectatorList[ cg.spectatorOffset ], 0, 0 ); if( cg.spectatorPaintX2 >= 0 ) { float maxX2 = rect->x + rect->w - 2; - CG_Text_Paint_Limit( &maxX2, cg.spectatorPaintX2, rect->y + rect->h - 3, scale, + CG_Text_Paint_Limit( &maxX2, cg.spectatorPaintX2, y, scale, color, cg.spectatorList, 0, cg.spectatorOffset ); } @@ -1602,27 +1555,73 @@ static void CG_DrawTeamSpectators( rectDef_t *rect, float scale, vec4_t color, q /* ================== +CG_DrawTeamLabel +================== +*/ +static void CG_DrawTeamLabel( rectDef_t *rect, pTeam_t team, float text_x, float text_y, + vec4_t color, float scale, int textalign, int textvalign, int textStyle ) +{ + char *t; + char stage[ MAX_TOKEN_CHARS ]; + char *s; + float tx, ty; + + stage[ 0 ] = '\0'; + + switch( team ) + { + case PTE_ALIENS: + t = "Aliens"; + if( cg.intermissionStarted ) + Com_sprintf( stage, MAX_TOKEN_CHARS, "(Stage %d)", cgs.alienStage + 1 ); + break; + + case PTE_HUMANS: + t = "Humans"; + if( cg.intermissionStarted ) + Com_sprintf( stage, MAX_TOKEN_CHARS, "(Stage %d)", cgs.humanStage + 1 ); + break; + + default: + t = ""; + break; + } + + switch( textalign ) + { + default: + case ITEM_ALIGN_LEFT: + s = va( "%s %s", t, stage ); + break; + + case ITEM_ALIGN_RIGHT: + s = va( "%s %s", stage, t ); + break; + } + + CG_AlignText( rect, s, scale, 0.0f, 0.0f, textalign, textvalign, &tx, &ty ); + CG_Text_Paint( text_x + tx, text_y + ty, scale, color, s, 0, 0, textStyle ); +} + +/* +================== CG_DrawStageReport ================== */ static void CG_DrawStageReport( rectDef_t *rect, float text_x, float text_y, - vec4_t color, float scale, int align, int textStyle ) + vec4_t color, float scale, int textalign, int textvalign, int textStyle ) { char s[ MAX_TOKEN_CHARS ]; - int tx, w, kills; + float tx, ty; + int kills; - if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_NONE && !cg.intermissionStarted ) + if( cg.intermissionStarted ) return; - if( cg.intermissionStarted ) - { - Com_sprintf( s, MAX_TOKEN_CHARS, - "Stage %d" //PH34R MY MAD-LEET CODING SKILLZ - " " - "Stage %d", - cgs.alienStage + 1, cgs.humanStage + 1 ); - } - else if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_NONE ) + return; + + if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) { kills = cgs.alienNextStageThreshold - cgs.alienKills; @@ -1649,27 +1648,9 @@ static void CG_DrawStageReport( rectDef_t *rect, float text_x, float text_y, cgs.humanStage + 1, kills ); } - w = CG_Text_Width( s, scale, 0 ); - - switch( align ) - { - case ITEM_ALIGN_LEFT: - tx = rect->x; - break; - - case ITEM_ALIGN_RIGHT: - tx = rect->x + rect->w - w; - break; - - case ITEM_ALIGN_CENTER: - tx = rect->x + ( rect->w / 2.0f ) - ( w / 2.0f ); - break; - - default: - tx = 0.0f; - } + CG_AlignText( rect, s, scale, 0.0f, 0.0f, textalign, textvalign, &tx, &ty ); - CG_Text_Paint( text_x + tx, rect->y + text_y, scale, color, s, 0, 0, textStyle ); + CG_Text_Paint( text_x + tx, text_y + ty, scale, color, s, 0, 0, textStyle ); } /* @@ -1680,11 +1661,14 @@ CG_DrawFPS #define FPS_FRAMES 20 #define FPS_STRING "fps" static void CG_DrawFPS( rectDef_t *rect, float text_x, float text_y, - float scale, vec4_t color, int align, int textStyle, + float scale, vec4_t color, + int textalign, int textvalign, int textStyle, qboolean scalableText ) { char *s; - int tx, w, totalWidth, strLength; + float tx, ty; + float w, h, totalWidth; + int strLength; static int previousTimes[ FPS_FRAMES ]; static int index; int i, total; @@ -1719,26 +1703,11 @@ static void CG_DrawFPS( rectDef_t *rect, float text_x, float text_y, s = va( "%d", fps ); w = CG_Text_Width( "0", scale, 0 ); + h = CG_Text_Height( "0", scale, 0 ); strLength = CG_DrawStrlen( s ); totalWidth = CG_Text_Width( FPS_STRING, scale, 0 ) + w * strLength; - switch( align ) - { - case ITEM_ALIGN_LEFT: - tx = rect->x; - break; - - case ITEM_ALIGN_RIGHT: - tx = rect->x + rect->w - totalWidth; - break; - - case ITEM_ALIGN_CENTER: - tx = rect->x + ( rect->w / 2.0f ) - ( totalWidth / 2.0f ); - break; - - default: - tx = 0.0f; - } + CG_AlignText( rect, s, 0.0f, totalWidth, h, textalign, textvalign, &tx, &ty ); if( scalableText ) { @@ -1749,8 +1718,10 @@ static void CG_DrawFPS( rectDef_t *rect, float text_x, float text_y, c[ 0 ] = s[ i ]; c[ 1 ] = '\0'; - CG_Text_Paint( text_x + tx + i * w, rect->y + text_y, scale, color, c, 0, 0, textStyle ); + CG_Text_Paint( text_x + tx + i * w, text_y + ty, scale, color, c, 0, 0, textStyle ); } + + CG_Text_Paint( text_x + tx + i * w, text_y + ty, scale, color, FPS_STRING, 0, 0, textStyle ); } else { @@ -1758,9 +1729,6 @@ static void CG_DrawFPS( rectDef_t *rect, float text_x, float text_y, CG_DrawField( rect->x, rect->y, 3, rect->w / 3, rect->h, fps ); trap_R_SetColor( NULL ); } - - if( scalableText ) - CG_Text_Paint( text_x + tx + i * w, rect->y + text_y, scale, color, FPS_STRING, 0, 0, textStyle ); } } @@ -1821,10 +1789,13 @@ CG_DrawTimer ================= */ static void CG_DrawTimer( rectDef_t *rect, float text_x, float text_y, - float scale, vec4_t color, int align, int textStyle ) + float scale, vec4_t color, + int textalign, int textvalign, int textStyle ) { char *s; - int i, tx, w, totalWidth, strLength; + float tx, ty; + int i, strLength; + float w, h, totalWidth; int mins, seconds, tens; int msec; @@ -1841,26 +1812,11 @@ static void CG_DrawTimer( rectDef_t *rect, float text_x, float text_y, s = va( "%d:%d%d", mins, tens, seconds ); w = CG_Text_Width( "0", scale, 0 ); + h = CG_Text_Height( "0", scale, 0 ); strLength = CG_DrawStrlen( s ); totalWidth = w * strLength; - switch( align ) - { - case ITEM_ALIGN_LEFT: - tx = rect->x; - break; - - case ITEM_ALIGN_RIGHT: - tx = rect->x + rect->w - totalWidth; - break; - - case ITEM_ALIGN_CENTER: - tx = rect->x + ( rect->w / 2.0f ) - ( totalWidth / 2.0f ); - break; - - default: - tx = 0.0f; - } + CG_AlignText( rect, s, 0.0f, totalWidth, h, textalign, textvalign, &tx, &ty ); for( i = 0; i < strLength; i++ ) { @@ -1869,7 +1825,7 @@ static void CG_DrawTimer( rectDef_t *rect, float text_x, float text_y, c[ 0 ] = s[ i ]; c[ 1 ] = '\0'; - CG_Text_Paint( text_x + tx + i * w, rect->y + text_y, scale, color, c, 0, 0, textStyle ); + CG_Text_Paint( text_x + tx + i * w, text_y + ty, scale, color, c, 0, 0, textStyle ); } } @@ -1879,10 +1835,13 @@ CG_DrawClock ================= */ static void CG_DrawClock( rectDef_t *rect, float text_x, float text_y, - float scale, vec4_t color, int align, int textStyle ) + float scale, vec4_t color, + int textalign, int textvalign, int textStyle ) { char *s; - int i, tx, w, totalWidth, strLength; + float tx, ty; + int i, strLength; + float w, h, totalWidth; qtime_t qt; int t; @@ -1914,26 +1873,11 @@ static void CG_DrawClock( rectDef_t *rect, float text_x, float text_y, s = va( "%d%s%02d%s", h, ( qt.tm_sec % 2 ) ? ":" : " ", qt.tm_min, pm ); } w = CG_Text_Width( "0", scale, 0 ); + h = CG_Text_Height( "0", scale, 0 ); strLength = CG_DrawStrlen( s ); totalWidth = w * strLength; - switch( align ) - { - case ITEM_ALIGN_LEFT: - tx = rect->x; - break; - - case ITEM_ALIGN_RIGHT: - tx = rect->x + rect->w - totalWidth; - break; - - case ITEM_ALIGN_CENTER: - tx = rect->x + ( rect->w / 2.0f ) - ( totalWidth / 2.0f ); - break; - - default: - tx = 0.0f; - } + CG_AlignText( rect, s, 0.0f, totalWidth, h, textalign, textvalign, &tx, &ty ); for( i = 0; i < strLength; i++ ) { @@ -1942,7 +1886,7 @@ static void CG_DrawClock( rectDef_t *rect, float text_x, float text_y, c[ 0 ] = s[ i ]; c[ 1 ] = '\0'; - CG_Text_Paint( text_x + tx + i * w, rect->y + text_y, scale, color, c, 0, 0, textStyle ); + CG_Text_Paint( text_x + tx + i * w, text_y + ty, scale, color, c, 0, 0, textStyle ); } } @@ -1952,37 +1896,21 @@ CG_DrawSnapshot ================== */ static void CG_DrawSnapshot( rectDef_t *rect, float text_x, float text_y, - float scale, vec4_t color, int align, int textStyle ) + float scale, vec4_t color, + int textalign, int textvalign, int textStyle ) { char *s; - int w, tx; + float tx, ty; if( !cg_drawSnapshot.integer ) return; s = va( "time:%d snap:%d cmd:%d", cg.snap->serverTime, cg.latestSnapshotNum, cgs.serverCommandSequence ); - w = CG_Text_Width( s, scale, 0 ); - - switch( align ) - { - case ITEM_ALIGN_LEFT: - tx = rect->x; - break; - - case ITEM_ALIGN_RIGHT: - tx = rect->x + rect->w - w; - break; - case ITEM_ALIGN_CENTER: - tx = rect->x + ( rect->w / 2.0f ) - ( w / 2.0f ); - break; + CG_AlignText( rect, s, scale, 0.0f, 0.0f, textalign, textvalign, &tx, &ty ); - default: - tx = 0.0f; - } - - CG_Text_Paint( text_x + tx, rect->y + text_y, scale, color, s, 0, 0, textStyle ); + CG_Text_Paint( text_x + tx, text_y + ty, scale, color, s, 0, 0, textStyle ); } /* @@ -2265,78 +2193,14 @@ static void CG_DrawLagometer( rectDef_t *rect, float text_x, float text_y, } /* -============== -CG_DrawTextBlock -============== -*/ -static void CG_DrawTextBlock( rectDef_t *rect, float text_x, float text_y, vec4_t color, - float scale, int align, int textStyle, const char *text, - menuDef_t *parent, itemDef_t *textItem ) -{ - float x, y, w, h; - - //offset the text - x = rect->x; - y = rect->y; - w = rect->w - ( 16 + ( 2 * text_x ) ); //16 to ensure text within frame - h = rect->h; - - textItem->text = text; - - textItem->parent = parent; - memcpy( textItem->window.foreColor, color, sizeof( vec4_t ) ); - textItem->window.flags = 0; - - switch( align ) - { - case ITEM_ALIGN_LEFT: - textItem->window.rect.x = x; - break; - - case ITEM_ALIGN_RIGHT: - textItem->window.rect.x = x + w; - break; - - case ITEM_ALIGN_CENTER: - textItem->window.rect.x = x + ( w / 2 ); - break; - - default: - textItem->window.rect.x = x; - break; - } - - textItem->window.rect.y = y; - textItem->window.rect.w = w; - textItem->window.rect.h = h; - textItem->window.borderSize = 0; - textItem->textRect.x = 0; - textItem->textRect.y = 0; - textItem->textRect.w = 0; - textItem->textRect.h = 0; - textItem->textalignment = align; - textItem->textalignx = text_x; - textItem->textaligny = text_y; - textItem->textscale = scale; - textItem->textStyle = textStyle; - - //hack to utilise existing autowrap code - Item_Text_AutoWrapped_Paint( textItem ); -} - -/* =================== CG_DrawConsole =================== */ static void CG_DrawConsole( rectDef_t *rect, float text_x, float text_y, vec4_t color, - float scale, int align, int textStyle ) + float scale, int textalign, int textvalign, int textStyle ) { - static menuDef_t dummyParent; - static itemDef_t textItem; - - CG_DrawTextBlock( rect, text_x, text_y, color, scale, align, textStyle, - cg.consoleText, &dummyParent, &textItem ); + UI_DrawTextBlock( rect, text_x, text_y, color, scale, textalign, textvalign, textStyle, cg.consoleText ); } /* @@ -2345,16 +2209,12 @@ CG_DrawTutorial =================== */ static void CG_DrawTutorial( rectDef_t *rect, float text_x, float text_y, vec4_t color, - float scale, int align, int textStyle ) + float scale, int textalign, int textvalign, int textStyle ) { - static menuDef_t dummyParent; - static itemDef_t textItem; - if( !cg_tutorial.integer ) return; - CG_DrawTextBlock( rect, text_x, text_y, color, scale, align, textStyle, - CG_TutorialText( ), &dummyParent, &textItem ); + UI_DrawTextBlock( rect, text_x, text_y, color, scale, textalign, textvalign, textStyle, CG_TutorialText( ) ); } /* @@ -2553,7 +2413,8 @@ 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, float special, float scale, vec4_t color, + int align, int textalign, int textvalign, float special, + float scale, vec4_t color, qhandle_t shader, int textStyle ) { rectDef_t rect; @@ -2580,9 +2441,6 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, case CG_PLAYER_BANK_VALUE_NOPAD: CG_DrawPlayerBankValue( &rect, color, qfalse ); break; - case CG_PLAYER_STAMINA: - CG_DrawPlayerStamina( &rect, color, scale, align, textStyle, special ); - break; case CG_PLAYER_STAMINA_1: CG_DrawPlayerStamina1( &rect, color, shader ); break; @@ -2610,9 +2468,6 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, case CG_PLAYER_HEALTH: CG_DrawPlayerHealthValue( &rect, color ); break; - case CG_PLAYER_HEALTH_BAR: - CG_DrawPlayerHealthBar( &rect, color, scale, align, textStyle, special ); - break; case CG_PLAYER_HEALTH_CROSS: CG_DrawPlayerHealthCross( &rect, color, shader ); break; @@ -2656,13 +2511,19 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, CG_DrawItemSelectText( &rect, scale, textStyle ); break; case CG_SPECTATORS: - CG_DrawTeamSpectators( &rect, scale, color, shader ); + CG_DrawTeamSpectators( &rect, scale, textvalign, color, shader ); break; case CG_PLAYER_CROSSHAIRNAMES: CG_DrawCrosshairNames( &rect, scale, textStyle ); break; case CG_STAGE_REPORT_TEXT: - CG_DrawStageReport( &rect, text_x, text_y, color, scale, align, textStyle ); + CG_DrawStageReport( &rect, text_x, text_y, color, scale, textalign, textvalign, textStyle ); + break; + case CG_ALIENS_SCORE_LABEL: + CG_DrawTeamLabel( &rect, PTE_ALIENS, text_x, text_y, color, scale, textalign, textvalign, textStyle ); + break; + case CG_HUMANS_SCORE_LABEL: + CG_DrawTeamLabel( &rect, PTE_HUMANS, text_x, text_y, color, scale, textalign, textvalign, textStyle ); break; //loading screen @@ -2670,47 +2531,47 @@ 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, color, scale, align, textStyle, special ); + CG_DrawMediaProgress( &rect, color, scale, align, textalign, textStyle, special ); break; case CG_LOAD_MEDIA_LABEL: - CG_DrawMediaProgressLabel( &rect, text_x, text_y, color, scale, align ); + CG_DrawMediaProgressLabel( &rect, text_x, text_y, color, scale, textalign, textvalign ); break; case CG_LOAD_BUILDABLES: - CG_DrawBuildablesProgress( &rect, color, scale, align, textStyle, special ); + CG_DrawBuildablesProgress( &rect, color, scale, align, textalign, textStyle, special ); break; case CG_LOAD_BUILDABLES_LABEL: - CG_DrawBuildablesProgressLabel( &rect, text_x, text_y, color, scale, align ); + CG_DrawBuildablesProgressLabel( &rect, text_x, text_y, color, scale, textalign, textvalign ); break; case CG_LOAD_CHARMODEL: - CG_DrawCharModelProgress( &rect, color, scale, align, textStyle, special ); + CG_DrawCharModelProgress( &rect, color, scale, align, textalign, textStyle, special ); break; case CG_LOAD_CHARMODEL_LABEL: - CG_DrawCharModelProgressLabel( &rect, text_x, text_y, color, scale, align ); + CG_DrawCharModelProgressLabel( &rect, text_x, text_y, color, scale, textalign, textvalign ); break; case CG_LOAD_OVERALL: - CG_DrawOverallProgress( &rect, color, scale, align, textStyle, special ); + CG_DrawOverallProgress( &rect, color, scale, align, textalign, textStyle, special ); break; case CG_LOAD_LEVELNAME: - CG_DrawLevelName( &rect, text_x, text_y, color, scale, align, textStyle ); + CG_DrawLevelName( &rect, text_x, text_y, color, scale, textalign, textvalign, textStyle ); break; case CG_LOAD_MOTD: - CG_DrawMOTD( &rect, text_x, text_y, color, scale, align, textStyle ); + CG_DrawMOTD( &rect, text_x, text_y, color, scale, textalign, textvalign, textStyle ); break; case CG_LOAD_HOSTNAME: - CG_DrawHostname( &rect, text_x, text_y, color, scale, align, textStyle ); + CG_DrawHostname( &rect, text_x, text_y, color, scale, textalign, textvalign, textStyle ); break; case CG_FPS: - CG_DrawFPS( &rect, text_x, text_y, scale, color, align, textStyle, qtrue ); + CG_DrawFPS( &rect, text_x, text_y, scale, color, textalign, textvalign, textStyle, qtrue ); break; case CG_FPS_FIXED: - CG_DrawFPS( &rect, text_x, text_y, scale, color, align, textStyle, qfalse ); + CG_DrawFPS( &rect, text_x, text_y, scale, color, textalign, textvalign, textStyle, qfalse ); break; case CG_TIMER: - CG_DrawTimer( &rect, text_x, text_y, scale, color, align, textStyle ); + CG_DrawTimer( &rect, text_x, text_y, scale, color, textalign, textvalign, textStyle ); break; case CG_CLOCK: - CG_DrawClock( &rect, text_x, text_y, scale, color, align, textStyle ); + CG_DrawClock( &rect, text_x, text_y, scale, color, textalign, textvalign, textStyle ); break; case CG_TIMER_MINS: CG_DrawTimerMins( &rect, color ); @@ -2719,7 +2580,7 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, CG_DrawTimerSecs( &rect, color ); break; case CG_SNAPSHOT: - CG_DrawSnapshot( &rect, text_x, text_y, scale, color, align, textStyle ); + CG_DrawSnapshot( &rect, text_x, text_y, scale, color, textalign, textvalign, textStyle ); break; case CG_LAGOMETER: CG_DrawLagometer( &rect, text_x, text_y, scale, color ); @@ -2733,11 +2594,11 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, break; case CG_CONSOLE: - CG_DrawConsole( &rect, text_x, text_y, color, scale, align, textStyle ); + CG_DrawConsole( &rect, text_x, text_y, color, scale, textalign, textvalign, textStyle ); break; case CG_TUTORIAL: - CG_DrawTutorial( &rect, text_x, text_y, color, scale, align, textStyle ); + CG_DrawTutorial( &rect, text_x, text_y, color, scale, textalign, textvalign, textStyle ); break; default: diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 2ed268e7..3816218b 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1585,12 +1585,16 @@ void CG_AddLagometerFrameInfo( void ); void CG_AddLagometerSnapshotInfo( snapshot_t *snap ); void CG_CenterPrint( const char *str, int y, int charWidth ); 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, float special, - float scale, vec4_t color, qhandle_t shader, int textStyle); +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 color, + qhandle_t shader, int textStyle ); void CG_Text_Paint( float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style ); -int CG_Text_Width( const char *text, float scale, int limit ); -int CG_Text_Height( const char *text, float scale, int limit ); +float CG_Text_Width( const char *text, float scale, int limit ); +float CG_Text_Height( const char *text, float scale, int limit ); +float CG_Text_EmWidth( float scale ); +float CG_Text_EmHeight( float scale ); float CG_GetValue(int ownerDraw); void CG_RunMenuScript(char **args); void CG_SetPrintString( int type, const char *p ); @@ -2020,6 +2024,8 @@ int trap_Key_GetKey( const char *binding ); void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen ); void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen ); void trap_Key_SetBinding( int keynum, const char *binding ); +void trap_Key_SetOverstrikeMode( qboolean state ); +qboolean trap_Key_GetOverstrikeMode( void ); int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits ); e_status trap_CIN_StopCinematic( int handle ); diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 9bc39014..0d668286 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -427,6 +427,42 @@ static void CG_ForceModelChange( void ) } } +/* +=============== +CG_SetUIVars + +Set some cvars used by the UI +=============== +*/ +static void CG_SetUIVars( void ) +{ + int i; + char carriageCvar[ MAX_TOKEN_CHARS ]; + + if( !cg.snap ) + return; + + *carriageCvar = 0; + + //determine what the player is carrying + for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) + { + if( BG_InventoryContainsWeapon( i, cg.snap->ps.stats ) && + BG_FindPurchasableForWeapon( i ) ) + strcat( carriageCvar, va( "W%d ", i ) ); + } + for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) + { + if( BG_InventoryContainsUpgrade( i, cg.snap->ps.stats ) && + BG_FindPurchasableForUpgrade( i ) ) + strcat( carriageCvar, va( "U%d ", i ) ); + } + strcat( carriageCvar, "$" ); + + trap_Cvar_Set( "ui_carriage", carriageCvar ); + + trap_Cvar_Set( "ui_stages", va( "%d %d", cgs.alienStage, cgs.humanStage ) ); +} /* ================= @@ -449,6 +485,8 @@ void CG_UpdateCvars( void ) forceModelModificationCount = cg_forceModel.modificationCount; CG_ForceModelChange( ); } + + CG_SetUIVars( ); } @@ -1518,7 +1556,7 @@ static const char *CG_FeederItemText( float feederID, int index, int column, qha case 6: if( sp->ping == -1 ) - return "connecting"; + return ""; return va( "%4d", sp->ping ); break; @@ -1622,6 +1660,8 @@ void CG_LoadHudMenu( void ) cgDC.drawText = &CG_Text_Paint; cgDC.textWidth = &CG_Text_Width; cgDC.textHeight = &CG_Text_Height; + cgDC.textEmWidth = &CG_Text_EmWidth; + cgDC.textEmHeight = &CG_Text_EmHeight; cgDC.registerModel = &trap_R_RegisterModel; cgDC.modelBounds = &trap_R_ModelBounds; cgDC.fillRect = &CG_FillRect; @@ -1641,8 +1681,8 @@ void CG_LoadHudMenu( void ) cgDC.getCVarString = trap_Cvar_VariableStringBuffer; cgDC.getCVarValue = CG_Cvar_Get; cgDC.drawTextWithCursor = &CG_Text_PaintWithCursor; - //cgDC.setOverstrikeMode = &trap_Key_SetOverstrikeMode; - //cgDC.getOverstrikeMode = &trap_Key_GetOverstrikeMode; + cgDC.setOverstrikeMode = &trap_Key_SetOverstrikeMode; + cgDC.getOverstrikeMode = &trap_Key_GetOverstrikeMode; cgDC.startLocalSound = &trap_S_StartLocalSound; cgDC.ownerDrawHandleKey = &CG_OwnerDrawHandleKey; cgDC.feederCount = &CG_FeederCount; @@ -1656,6 +1696,7 @@ void CG_LoadHudMenu( void ) cgDC.Error = &Com_Error; cgDC.Print = &Com_Printf; cgDC.ownerDrawWidth = &CG_OwnerDrawWidth; + //cgDC.ownerDrawText = &CG_OwnerDrawText; //cgDC.Pause = &CG_Pause; cgDC.registerSound = &trap_S_RegisterSound; cgDC.startBackgroundTrack = &trap_S_StartBackgroundTrack; diff --git a/src/cgame/cg_public.h b/src/cgame/cg_public.h index 626f3201..4d9e965a 100644 --- a/src/cgame/cg_public.h +++ b/src/cgame/cg_public.h @@ -178,6 +178,9 @@ typedef enum CG_PARSE_READ_TOKEN, CG_PARSE_SOURCE_FILE_AND_LINE, + CG_KEY_SETOVERSTRIKEMODE, + CG_KEY_GETOVERSTRIKEMODE, + CG_MEMSET = 200, CG_MEMCPY, CG_STRNCPY, diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index f9822241..6587c784 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -450,41 +450,6 @@ static void CG_RemoveChatEscapeChar( char *text ) } /* -=============== -CG_SetUIVars - -Set some cvars used by the UI -=============== -*/ -static void CG_SetUIVars( void ) -{ - int i; - char carriageCvar[ MAX_TOKEN_CHARS ]; - - *carriageCvar = 0; - - //determine what the player is carrying - for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) - { - if( BG_InventoryContainsWeapon( i, cg.snap->ps.stats ) && - BG_FindPurchasableForWeapon( i ) ) - strcat( carriageCvar, va( "W%d ", i ) ); - } - for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) - { - if( BG_InventoryContainsUpgrade( i, cg.snap->ps.stats ) && - BG_FindPurchasableForUpgrade( i ) ) - strcat( carriageCvar, va( "U%d ", i ) ); - } - strcat( carriageCvar, "$" ); - - trap_Cvar_Set( "ui_carriage", carriageCvar ); - - trap_Cvar_Set( "ui_stages", va( "%d %d", cgs.alienStage, cgs.humanStage ) ); -} - - -/* ============== CG_Menu ============== @@ -494,10 +459,7 @@ void CG_Menu( int menu ) const char *cmd = NULL; // command to send const char *longMsg = NULL; // command parameter const char *shortMsg = NULL; // non-modal version of message - CG_SetUIVars( ); - // string literals have static storage duration, this is safe, - // cleaner and much more readable. switch( menu ) { case MN_TEAM: diff --git a/src/cgame/cg_syscalls.asm b/src/cgame/cg_syscalls.asm index 0479f1d0..218bd833 100644 --- a/src/cgame/cg_syscalls.asm +++ b/src/cgame/cg_syscalls.asm @@ -101,6 +101,8 @@ equ trap_Parse_LoadSource -97 equ trap_Parse_FreeSource -98 equ trap_Parse_ReadToken -99 equ trap_Parse_SourceFileAndLine -100 +equ trap_Key_SetOverstrikeMode -101 +equ trap_Key_GetOverstrikeMode -102 equ memset -201 equ memcpy -202 diff --git a/src/cgame/cg_syscalls.c b/src/cgame/cg_syscalls.c index 43afc2c4..98ba171e 100644 --- a/src/cgame/cg_syscalls.c +++ b/src/cgame/cg_syscalls.c @@ -568,3 +568,10 @@ void trap_Key_SetBinding( int keynum, const char *binding ) { syscall( CG_KEY_SETBINDING, keynum, binding ); } +void trap_Key_SetOverstrikeMode( qboolean state ) { + syscall( CG_KEY_SETOVERSTRIKEMODE, state ); +} + +qboolean trap_Key_GetOverstrikeMode( void ) { + return syscall( CG_KEY_GETOVERSTRIKEMODE ); +} diff --git a/src/client/cl_cgame.c b/src/client/cl_cgame.c index 84b58d74..a3efd77a 100644 --- a/src/client/cl_cgame.c +++ b/src/client/cl_cgame.c @@ -654,6 +654,12 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) { case CG_PARSE_SOURCE_FILE_AND_LINE: return Parse_SourceFileAndLine( args[1], VMA(2), VMA(3) ); + case CG_KEY_SETOVERSTRIKEMODE: + Key_SetOverstrikeMode( args[1] ); + return 0; + case CG_KEY_GETOVERSTRIKEMODE: + return Key_GetOverstrikeMode( ); + case CG_MEMSET: Com_Memset( VMA(1), args[2], args[3] ); return 0; diff --git a/src/game/g_active.c b/src/game/g_active.c index 14c7ad52..ef6330d4 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -1683,13 +1683,6 @@ void ClientThink_real( gentity_t *ent ) } } - if( level.framenum > client->retriggerArmouryMenu && client->retriggerArmouryMenu ) - { - G_TriggerMenu( client->ps.clientNum, MN_H_ARMOURY ); - - client->retriggerArmouryMenu = 0; - } - // Give clients some credit periodically if( ent->client->lastKillTime + FREEKILL_PERIOD < level.time ) { diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index eb8f6714..66de68f8 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -2141,15 +2141,6 @@ void Cmd_Buy_f( gentity_t *ent ) trap_SendServerCommand( ent-g_entities, va( "print \"Unknown item\n\"" ) ); } - if( trap_Argc( ) >= 2 ) - { - trap_Argv( 2, s, sizeof( s ) ); - - //retrigger the armoury menu - if( !Q_stricmp( s, "retrigger" ) ) - ent->client->retriggerArmouryMenu = level.framenum + RAM_FRAMES; - } - //update ClientInfo ClientUserinfoChanged( ent->client->ps.clientNum ); } @@ -2320,15 +2311,6 @@ void Cmd_Sell_f( gentity_t *ent ) else trap_SendServerCommand( ent-g_entities, va( "print \"Unknown item\n\"" ) ); - if( trap_Argc( ) >= 2 ) - { - trap_Argv( 2, s, sizeof( s ) ); - - //retrigger the armoury menu - if( !Q_stricmp( s, "retrigger" ) ) - ent->client->retriggerArmouryMenu = level.framenum + RAM_FRAMES; - } - //update ClientInfo ClientUserinfoChanged( ent->client->ps.clientNum ); } diff --git a/src/game/g_local.h b/src/game/g_local.h index 54600578..c9538bbd 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -455,9 +455,6 @@ struct gclient_s int lastFlameBall; // s.number of the last flame ball fired -#define RAM_FRAMES 1 // number of frames to wait before retriggering - int retriggerArmouryMenu; // frame number to retrigger the armoury menu - unlagged_t unlaggedHist[ MAX_UNLAGGED_MARKERS ]; unlagged_t unlaggedBackup; unlagged_t unlaggedCalc; diff --git a/src/ui/ui_gameinfo.c b/src/ui/ui_gameinfo.c index 43639e56..ad31218e 100644 --- a/src/ui/ui_gameinfo.c +++ b/src/ui/ui_gameinfo.c @@ -303,7 +303,7 @@ char *UI_GetBotNameByNumber( int num ) { if (info) { return Info_ValueForKey( info, "name" ); } - return "Sarge"; + return ""; } void UI_ServerInfo( void ) diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h index ff8367ba..5f5ea862 100644 --- a/src/ui/ui_local.h +++ b/src/ui/ui_local.h @@ -865,6 +865,9 @@ typedef struct { int humanBuildCount; int humanBuildIndex; + int weapons; + int upgrades; + serverStatus_t serverStatus; // for the showing the status of a server diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index 768008f6..edecd280 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -250,7 +250,7 @@ void _UI_DrawRect( float x, float y, float width, float height, float size, cons -int Text_Width(const char *text, float scale, int limit) { +float Text_Width(const char *text, float scale, int limit) { int count,len; float out; glyphInfo_t *glyph; @@ -265,7 +265,7 @@ int Text_Width(const char *text, float scale, int limit) { useScale = scale * font->glyphScale; out = 0; if (text) { - len = strlen(text); + len = Q_PrintStrlen( text ); if (limit > 0 && len > limit) { len = limit; } @@ -285,7 +285,7 @@ int Text_Width(const char *text, float scale, int limit) { return out * useScale; } -int Text_Height(const char *text, float scale, int limit) { +float Text_Height(const char *text, float scale, int limit) { int len, count; float max; glyphInfo_t *glyph; @@ -322,6 +322,16 @@ int Text_Height(const char *text, float scale, int limit) { return max * useScale; } +float Text_EmWidth( float scale ) +{ + return Text_Width( "M", scale, 0 ); +} + +float Text_EmHeight( float scale ) +{ + return Text_Height( "M", scale, 0 ); +} + void Text_PaintChar(float x, float y, float width, float height, float scale, float s, float t, float s2, float t2, qhandle_t hShader) { float w, h; w = width * scale; @@ -353,8 +363,6 @@ void Text_Paint(float x, float y, float scale, vec4_t color, const char *text, f count = 0; while (s && *s && count < len) { glyph = &font->glyphs[(int)*s]; - //int yadj = Assets.textFont.glyphs[text[i]].bottom + Assets.textFont.glyphs[text[i]].top; - //float yadj = scale * (Assets.textFont.glyphs[text[i]].imageHeight - Assets.textFont.glyphs[text[i]].height); if ( Q_IsColorString( s ) ) { memcpy( newColor, g_color_table[ColorIndex(*(s+1))], sizeof( newColor ) ); newColor[3] = color[3]; @@ -455,6 +463,7 @@ void Text_Paint(float x, float y, float scale, vec4_t color, const char *text, f } } +//FIXME: merge this with Text_Paint, somehow void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const char *text, int cursorPos, char cursor, int limit, int style) { int len, count; vec4_t newColor; @@ -480,88 +489,12 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha glyph2 = &font->glyphs[ (int) cursor]; while (s && *s && count < len) { glyph = &font->glyphs[(int)*s]; - if ( Q_IsColorString( s ) ) { - memcpy( newColor, g_color_table[ColorIndex(*(s+1))], sizeof( newColor ) ); - newColor[3] = color[3]; - trap_R_SetColor( newColor ); - s += 2; - continue; - } else { - yadj = useScale * glyph->top; - if (style == ITEM_TEXTSTYLE_SHADOWED || style == ITEM_TEXTSTYLE_SHADOWEDMORE) { - int ofs = style == ITEM_TEXTSTYLE_SHADOWED ? 1 : 2; - colorBlack[3] = newColor[3]; - trap_R_SetColor( colorBlack ); - Text_PaintChar(x + ofs, y - yadj + ofs, - glyph->imageWidth, - glyph->imageHeight, - useScale, - glyph->s, - glyph->t, - glyph->s2, - glyph->t2, - glyph->glyph); - colorBlack[3] = 1.0; - trap_R_SetColor( newColor ); - } - else if( style == ITEM_TEXTSTYLE_NEON ) - { - vec4_t glow, outer, inner, white; - - glow[ 0 ] = newColor[ 0 ] * 0.5; - glow[ 1 ] = newColor[ 1 ] * 0.5; - glow[ 2 ] = newColor[ 2 ] * 0.5; - glow[ 3 ] = newColor[ 3 ] * 0.2; - - outer[ 0 ] = newColor[ 0 ]; - outer[ 1 ] = newColor[ 1 ]; - outer[ 2 ] = newColor[ 2 ]; - outer[ 3 ] = newColor[ 3 ]; - - inner[ 0 ] = newColor[ 0 ] * 1.5 > 1.0f ? 1.0f : newColor[ 0 ] * 1.5; - inner[ 1 ] = newColor[ 1 ] * 1.5 > 1.0f ? 1.0f : newColor[ 1 ] * 1.5; - inner[ 2 ] = newColor[ 2 ] * 1.5 > 1.0f ? 1.0f : newColor[ 2 ] * 1.5; - inner[ 3 ] = newColor[ 3 ]; - - white[ 0 ] = white[ 1 ] = white[ 2 ] = white[ 3 ] = 1.0f; - - trap_R_SetColor( glow ); - Text_PaintChar( x - 1.5, y - yadj - 1.5, - glyph->imageWidth + 3, - glyph->imageHeight + 3, - useScale, - glyph->s, - glyph->t, - glyph->s2, - glyph->t2, - glyph->glyph ); - - trap_R_SetColor( outer ); - Text_PaintChar( x - 1, y - yadj - 1, - glyph->imageWidth + 2, - glyph->imageHeight + 2, - useScale, - glyph->s, - glyph->t, - glyph->s2, - glyph->t2, - glyph->glyph ); - - trap_R_SetColor( inner ); - Text_PaintChar( x - 0.5, y - yadj - 0.5, - glyph->imageWidth + 1, - glyph->imageHeight + 1, - useScale, - glyph->s, - glyph->t, - glyph->s2, - glyph->t2, - glyph->glyph ); - - trap_R_SetColor( white ); - } - - Text_PaintChar(x, y - yadj, + yadj = useScale * glyph->top; + if (style == ITEM_TEXTSTYLE_SHADOWED || style == ITEM_TEXTSTYLE_SHADOWEDMORE) { + int ofs = style == ITEM_TEXTSTYLE_SHADOWED ? 1 : 2; + colorBlack[3] = newColor[3]; + trap_R_SetColor( colorBlack ); + Text_PaintChar(x + ofs, y - yadj + ofs, glyph->imageWidth, glyph->imageHeight, useScale, @@ -570,25 +503,92 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha glyph->s2, glyph->t2, glyph->glyph); + colorBlack[3] = 1.0; + trap_R_SetColor( newColor ); + } + else if( style == ITEM_TEXTSTYLE_NEON ) + { + vec4_t glow, outer, inner, white; + + glow[ 0 ] = newColor[ 0 ] * 0.5; + glow[ 1 ] = newColor[ 1 ] * 0.5; + glow[ 2 ] = newColor[ 2 ] * 0.5; + glow[ 3 ] = newColor[ 3 ] * 0.2; + + outer[ 0 ] = newColor[ 0 ]; + outer[ 1 ] = newColor[ 1 ]; + outer[ 2 ] = newColor[ 2 ]; + outer[ 3 ] = newColor[ 3 ]; + + inner[ 0 ] = newColor[ 0 ] * 1.5 > 1.0f ? 1.0f : newColor[ 0 ] * 1.5; + inner[ 1 ] = newColor[ 1 ] * 1.5 > 1.0f ? 1.0f : newColor[ 1 ] * 1.5; + inner[ 2 ] = newColor[ 2 ] * 1.5 > 1.0f ? 1.0f : newColor[ 2 ] * 1.5; + inner[ 3 ] = newColor[ 3 ]; + + white[ 0 ] = white[ 1 ] = white[ 2 ] = white[ 3 ] = 1.0f; + + trap_R_SetColor( glow ); + Text_PaintChar( x - 1.5, y - yadj - 1.5, + glyph->imageWidth + 3, + glyph->imageHeight + 3, + useScale, + glyph->s, + glyph->t, + glyph->s2, + glyph->t2, + glyph->glyph ); + + trap_R_SetColor( outer ); + Text_PaintChar( x - 1, y - yadj - 1, + glyph->imageWidth + 2, + glyph->imageHeight + 2, + useScale, + glyph->s, + glyph->t, + glyph->s2, + glyph->t2, + glyph->glyph ); + + trap_R_SetColor( inner ); + Text_PaintChar( x - 0.5, y - yadj - 0.5, + glyph->imageWidth + 1, + glyph->imageHeight + 1, + useScale, + glyph->s, + glyph->t, + glyph->s2, + glyph->t2, + glyph->glyph ); + + trap_R_SetColor( white ); + } - // CG_DrawPic(x, y - yadj, scale * uiDC.Assets.textFont.glyphs[text[i]].imageWidth, scale * uiDC.Assets.textFont.glyphs[text[i]].imageHeight, uiDC.Assets.textFont.glyphs[text[i]].glyph); - yadj = useScale * glyph2->top; - if (count == cursorPos && !((uiInfo.uiDC.realTime/BLINK_DIVISOR) & 1)) { - Text_PaintChar(x, y - yadj, - glyph2->imageWidth, - glyph2->imageHeight, - useScale, - glyph2->s, - glyph2->t, - glyph2->s2, - glyph2->t2, - glyph2->glyph); - } - - x += (glyph->xSkip * useScale); - s++; - count++; + Text_PaintChar(x, y - yadj, + glyph->imageWidth, + glyph->imageHeight, + useScale, + glyph->s, + glyph->t, + glyph->s2, + glyph->t2, + glyph->glyph); + + yadj = useScale * glyph2->top; + if (count == cursorPos && !((uiInfo.uiDC.realTime/BLINK_DIVISOR) & 1)) { + Text_PaintChar(x, y - yadj, + glyph2->imageWidth, + glyph2->imageHeight, + useScale, + glyph2->s, + glyph2->t, + glyph2->s2, + glyph2->t2, + glyph2->glyph); } + + x += (glyph->xSkip * useScale); + s++; + count++; } // need to paint cursor at end of text if (cursorPos == len && !((uiInfo.uiDC.realTime/BLINK_DIVISOR) & 1)) { @@ -611,62 +611,6 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha } -static void Text_Paint_Limit(float *maxX, float x, float y, float scale, vec4_t color, const char* text, float adjust, int limit) { - int len, count; - vec4_t newColor; - glyphInfo_t *glyph; - if (text) { - const char *s = text; - float max = *maxX; - float useScale; - fontInfo_t *font = &uiInfo.uiDC.Assets.textFont; - if (scale <= ui_smallFont.value) { - font = &uiInfo.uiDC.Assets.smallFont; - } else if (scale > ui_bigFont.value) { - font = &uiInfo.uiDC.Assets.bigFont; - } - useScale = scale * font->glyphScale; - trap_R_SetColor( color ); - len = strlen(text); - if (limit > 0 && len > limit) { - len = limit; - } - count = 0; - while (s && *s && count < len) { - glyph = &font->glyphs[(int)*s]; - if ( Q_IsColorString( s ) ) { - memcpy( newColor, g_color_table[ColorIndex(*(s+1))], sizeof( newColor ) ); - newColor[3] = color[3]; - trap_R_SetColor( newColor ); - s += 2; - continue; - } else { - float yadj = useScale * glyph->top; - if (Text_Width(s, useScale, 1) + x > max) { - *maxX = 0; - break; - } - Text_PaintChar(x, y - yadj, - glyph->imageWidth, - glyph->imageHeight, - useScale, - glyph->s, - glyph->t, - glyph->s2, - glyph->t2, - glyph->glyph); - x += (glyph->xSkip * useScale) + adjust; - *maxX = x; - count++; - s++; - } - } - trap_R_SetColor( NULL ); - } - -} - - void UI_ShowPostGame(qboolean newHigh) { trap_Cvar_Set ("cg_cameraOrbit", "0"); trap_Cvar_Set("cg_thirdPerson", "0"); @@ -1079,6 +1023,8 @@ void UI_Load( void ) { String_Init(); UI_LoadMenus("ui/menus.txt", qtrue); + UI_LoadMenus("ui/ingame.txt", qfalse); + UI_LoadMenus("ui/tremulous.txt", qfalse); Menus_CloseAll(); Menus_ActivateByName(lastName); @@ -1214,44 +1160,34 @@ UI_DrawInfoPane =============== */ static void UI_DrawInfoPane( menuItem_t *item, rectDef_t *rect, float text_x, float text_y, - float scale, vec4_t color, int textStyle ) + float scale, int textalign, int textvalign, vec4_t color, int textStyle ) { - float maxLeft = 0, maxTop = 0; - float maxRight = 0, maxBottom = 0; - float x = rect->x - text_x, y = rect->y - text_y, w, h; - menuDef_t dummyParent; - itemDef_t textItem; - int value = 0; - char *string = ""; - int class, credits; - char ui_currentClass[ MAX_STRING_CHARS ]; + int value = 0; + const char *s = ""; + char *string = ""; + int class, credits; + char ui_currentClass[ MAX_STRING_CHARS ]; trap_Cvar_VariableStringBuffer( "ui_currentClass", ui_currentClass, MAX_STRING_CHARS ); sscanf( ui_currentClass, "%d %d", &class, &credits ); - //offset the text - x = rect->x + maxLeft; - y = rect->y + maxTop; - w = rect->w - ( maxLeft + maxRight + 16 + ( 2 * text_x ) ); //16 to ensure text within frame - h = rect->h - ( maxTop + maxBottom ); - switch( item->type ) { case INFOTYPE_TEXT: - textItem.text = item->v.text; + s = item->v.text; break; case INFOTYPE_CLASS: value = BG_ClassCanEvolveFromTo( class, item->v.pclass, credits, 0 ); if( value < 1 ) { - textItem.text = va( "%s\n\n%s", + s = va( "%s\n\n%s", BG_FindHumanNameForClassNum( item->v.pclass ), BG_FindInfoForClassNum( item->v.pclass ) ); } else { - textItem.text = va( "%s\n\n%s\n\nKills: %d", + s = va( "%s\n\n%s\n\nKills: %d", BG_FindHumanNameForClassNum( item->v.pclass ), BG_FindInfoForClassNum( item->v.pclass ), value ); @@ -1262,13 +1198,13 @@ static void UI_DrawInfoPane( menuItem_t *item, rectDef_t *rect, float text_x, fl value = BG_FindPriceForWeapon( item->v.weapon ); if( value == 0 ) { - textItem.text = va( "%s\n\n%s\n\nCredits: Free", + s = va( "%s\n\n%s\n\nCredits: Free", BG_FindHumanNameForWeapon( item->v.weapon ), BG_FindInfoForWeapon( item->v.weapon ) ); } else { - textItem.text = va( "%s\n\n%s\n\nCredits: %d", + s = va( "%s\n\n%s\n\nCredits: %d", BG_FindHumanNameForWeapon( item->v.weapon ), BG_FindInfoForWeapon( item->v.weapon ), value ); @@ -1279,13 +1215,13 @@ static void UI_DrawInfoPane( menuItem_t *item, rectDef_t *rect, float text_x, fl value = BG_FindPriceForUpgrade( item->v.upgrade ); if( value == 0 ) { - textItem.text = va( "%s\n\n%s\n\nCredits: Free", + s = va( "%s\n\n%s\n\nCredits: Free", BG_FindHumanNameForUpgrade( item->v.upgrade ), BG_FindInfoForUpgrade( item->v.upgrade ) ); } else { - textItem.text = va( "%s\n\n%s\n\nCredits: %d", + s = va( "%s\n\n%s\n\nCredits: %d", BG_FindHumanNameForUpgrade( item->v.upgrade ), BG_FindInfoForUpgrade( item->v.upgrade ), value ); @@ -1303,13 +1239,13 @@ static void UI_DrawInfoPane( menuItem_t *item, rectDef_t *rect, float text_x, fl if( value == 0 ) { - textItem.text = va( "%s\n\n%s", + s = va( "%s\n\n%s", BG_FindHumanNameForBuildable( item->v.buildable ), BG_FindInfoForBuildable( item->v.buildable ) ); } else { - textItem.text = va( "%s\n\n%s\n\n%s: %d", + s = va( "%s\n\n%s\n\n%s: %d", BG_FindHumanNameForBuildable( item->v.buildable ), BG_FindInfoForBuildable( item->v.buildable ), string, value ); @@ -1317,30 +1253,8 @@ static void UI_DrawInfoPane( menuItem_t *item, rectDef_t *rect, float text_x, fl break; } - textItem.parent = &dummyParent; - memcpy( textItem.window.foreColor, color, sizeof( vec4_t ) ); - textItem.window.flags = 0; - - textItem.window.rect.x = x; - textItem.window.rect.y = y; - textItem.window.rect.w = w; - textItem.window.rect.h = h; - textItem.window.borderSize = 0; - textItem.textRect.x = 0; - textItem.textRect.y = 0; - textItem.textRect.w = 0; - textItem.textRect.h = 0; - textItem.textalignment = ITEM_ALIGN_LEFT; - textItem.textalignx = text_x; - textItem.textaligny = text_y; - textItem.textscale = scale; - textItem.textStyle = textStyle; - - textItem.enableCvar = NULL; - textItem.cvarTest = NULL; - - //hack to utilise existing autowrap code - Item_Text_AutoWrapped_Paint( &textItem ); + UI_DrawTextBlock( rect, text_x, text_y, color, scale, + textalign, textvalign, textStyle, s ); } @@ -1502,13 +1416,6 @@ static void UI_DrawPlayerModel(rectDef_t *rect) { } -static void UI_DrawNetSource(rectDef_t *rect, float scale, vec4_t color, int textStyle) { - if (ui_netSource.integer < 0 || ui_netSource.integer > numNetSources) { - ui_netSource.integer = 0; - } - Text_Paint(rect->x, rect->y, scale, color, va("Source: %s", netSources[ui_netSource.integer]), 0, 0, textStyle); -} - static void UI_DrawNetMapPreview(rectDef_t *rect, float scale, vec4_t color) { if (uiInfo.serverStatus.currentServerPreview > 0) { @@ -1535,14 +1442,6 @@ static void UI_DrawNetMapCinematic(rectDef_t *rect, float scale, vec4_t color) { -static void UI_DrawNetFilter(rectDef_t *rect, float scale, vec4_t color, int textStyle) { - if (ui_serverFilterType.integer < 0 || ui_serverFilterType.integer > numServerFilters) { - ui_serverFilterType.integer = 0; - } - Text_Paint(rect->x, rect->y, scale, color, va("Filter: %s", serverFilters[ui_serverFilterType.integer].description), 0, 0, textStyle); -} - - static void UI_DrawTier(rectDef_t *rect, float scale, vec4_t color, int textStyle) { int i; i = trap_Cvar_VariableValue( "ui_currentTier" ); @@ -1789,6 +1688,63 @@ static void UI_DrawOpponentName(rectDef_t *rect, float scale, vec4_t color, int Text_Paint(rect->x, rect->y, scale, color, UI_Cvar_VariableString("ui_opponentName"), 0, 0, textStyle); } +static const char *UI_OwnerDrawText(int ownerDraw) { + const char *s = NULL; + + switch( ownerDraw ) + { + case UI_NETSOURCE: + if (ui_netSource.integer < 0 || ui_netSource.integer >= numNetSources) { + ui_netSource.integer = 0; + } + s = netSources[ui_netSource.integer]; + break; + + case UI_NETFILTER: + if (ui_serverFilterType.integer < 0 || ui_serverFilterType.integer > numServerFilters) { + ui_serverFilterType.integer = 0; + } + s = serverFilters[ui_serverFilterType.integer].description; + break; + + case UI_KEYBINDSTATUS: + if (Display_KeyBindPending()) { + s = "Waiting for new key... Press ESCAPE to cancel"; + } else { + s = "Press ENTER or CLICK to change, Press BACKSPACE to clear"; + } + break; + + case UI_SERVERREFRESHDATE: + if (uiInfo.serverStatus.refreshActive) { +#define MAX_DOTS 5 + int numServers = trap_LAN_GetServerCount( ui_netSource.integer ); + int numDots = ( uiInfo.uiDC.realTime / 500 ) % ( MAX_DOTS + 1 ); + char dots[ MAX_DOTS + 1 ]; + int i; + + for( i = 0; i < numDots; i++ ) + dots[ i ] = '.'; + + dots[ i ] = '\0'; + + s = numServers < 0 ? va( "Waiting for response%s", dots ) : + va("Getting info for %d servers (ESC to cancel)%s", numServers, dots ); + } else { + s = va("Refresh Time: %s", UI_Cvar_VariableString(va("ui_lastServerRefresh_%i", ui_netSource.integer))); + } + break; + + case UI_SERVERMOTD: + s = uiInfo.serverStatus.motd; + break; + + default: + break; + } + + return s; +} static int UI_OwnerDrawWidth(int ownerDraw, float scale) { int i, h, value; @@ -1866,16 +1822,11 @@ static int UI_OwnerDrawWidth(int ownerDraw, float scale) { s = va("%i. %s", ownerDraw-UI_REDTEAM1 + 1, text); break; case UI_NETSOURCE: - if (ui_netSource.integer < 0 || ui_netSource.integer > uiInfo.numJoinGameTypes) { - ui_netSource.integer = 0; - } - s = va("Source: %s", netSources[ui_netSource.integer]); - break; case UI_NETFILTER: - if (ui_serverFilterType.integer < 0 || ui_serverFilterType.integer > numServerFilters) { - ui_serverFilterType.integer = 0; - } - s = va("Filter: %s", serverFilters[ui_serverFilterType.integer].description ); + case UI_KEYBINDSTATUS: + case UI_SERVERREFRESHDATE: + case UI_SERVERMOTD: + s = UI_OwnerDrawText( ownerDraw ); break; case UI_TIER: break; @@ -1891,16 +1842,6 @@ static int UI_OwnerDrawWidth(int ownerDraw, float scale) { break; case UI_OPPONENT_NAME: break; - case UI_KEYBINDSTATUS: - if (Display_KeyBindPending()) { - s = "Waiting for new key... Press ESCAPE to cancel"; - } else { - s = "Press ENTER or CLICK to change, Press BACKSPACE to clear"; - } - break; - case UI_SERVERREFRESHDATE: - s = UI_Cvar_VariableString(va("ui_lastServerRefresh_%i", ui_netSource.integer)); - break; default: break; } @@ -2015,193 +1956,75 @@ static void UI_DrawSelectedPlayer(rectDef_t *rect, float scale, vec4_t color, in Text_Paint(rect->x, rect->y, scale, color, name, 0, 0, textStyle); } -static void UI_DrawServerRefreshDate(rectDef_t *rect, float scale, vec4_t color, int textStyle) { - if (uiInfo.serverStatus.refreshActive) { - vec4_t lowLight, newColor; - int numServers = trap_LAN_GetServerCount( ui_netSource.integer ); - - lowLight[0] = 0.8 * color[0]; - lowLight[1] = 0.8 * color[1]; - lowLight[2] = 0.8 * color[2]; - lowLight[3] = 0.8 * color[3]; - LerpColor(color,lowLight,newColor,0.5+0.5*sin(uiInfo.uiDC.realTime / PULSE_DIVISOR)); - Text_Paint(rect->x, rect->y, scale, newColor, - numServers < 0 ? "Waiting for response..." : - va("Getting info for %d servers (ESC to cancel)", numServers), 0, 0, textStyle); - } else { - char buff[64]; - Q_strncpyz(buff, UI_Cvar_VariableString(va("ui_lastServerRefresh_%i", ui_netSource.integer)), 64); - Text_Paint(rect->x, rect->y, scale, color, va("Refresh Time: %s", buff), 0, 0, textStyle); - } -} - -static void UI_DrawServerMOTD(rectDef_t *rect, float scale, vec4_t color) { - if (uiInfo.serverStatus.motdLen) { - float maxX; - - if (uiInfo.serverStatus.motdWidth == -1) { - uiInfo.serverStatus.motdWidth = 0; - uiInfo.serverStatus.motdPaintX = rect->x + 1; - uiInfo.serverStatus.motdPaintX2 = -1; - } - - if (uiInfo.serverStatus.motdOffset > uiInfo.serverStatus.motdLen) { - uiInfo.serverStatus.motdOffset = 0; - uiInfo.serverStatus.motdPaintX = rect->x + 1; - uiInfo.serverStatus.motdPaintX2 = -1; - } - - if (uiInfo.uiDC.realTime > uiInfo.serverStatus.motdTime) { - uiInfo.serverStatus.motdTime = uiInfo.uiDC.realTime + 10; - if (uiInfo.serverStatus.motdPaintX <= rect->x + 2) { - if (uiInfo.serverStatus.motdOffset < uiInfo.serverStatus.motdLen) { - uiInfo.serverStatus.motdPaintX += Text_Width(&uiInfo.serverStatus.motd[uiInfo.serverStatus.motdOffset], scale, 1) - 1; - uiInfo.serverStatus.motdOffset++; - } else { - uiInfo.serverStatus.motdOffset = 0; - if (uiInfo.serverStatus.motdPaintX2 >= 0) { - uiInfo.serverStatus.motdPaintX = uiInfo.serverStatus.motdPaintX2; - } else { - uiInfo.serverStatus.motdPaintX = rect->x + rect->w - 2; - } - uiInfo.serverStatus.motdPaintX2 = -1; - } - } else { - //serverStatus.motdPaintX--; - uiInfo.serverStatus.motdPaintX -= 2; - if (uiInfo.serverStatus.motdPaintX2 >= 0) { - //serverStatus.motdPaintX2--; - uiInfo.serverStatus.motdPaintX2 -= 2; - } - } - } - - maxX = rect->x + rect->w - 2; - Text_Paint_Limit(&maxX, uiInfo.serverStatus.motdPaintX, rect->y + rect->h - 3, scale, color, &uiInfo.serverStatus.motd[uiInfo.serverStatus.motdOffset], 0, 0); - if (uiInfo.serverStatus.motdPaintX2 >= 0) { - float maxX2 = rect->x + rect->w - 2; - Text_Paint_Limit(&maxX2, uiInfo.serverStatus.motdPaintX2, rect->y + rect->h - 3, scale, color, uiInfo.serverStatus.motd, 0, uiInfo.serverStatus.motdOffset); - } - if (uiInfo.serverStatus.motdOffset && maxX > 0) { - // if we have an offset ( we are skipping the first part of the string ) and we fit the string - if (uiInfo.serverStatus.motdPaintX2 == -1) { - uiInfo.serverStatus.motdPaintX2 = rect->x + rect->w - 2; - } - } else { - uiInfo.serverStatus.motdPaintX2 = -1; - } - - } -} - -static void UI_DrawKeyBindStatus(rectDef_t *rect, float scale, vec4_t color, int textStyle) { - if (Display_KeyBindPending()) { - Text_Paint(rect->x, rect->y, scale, color, "Waiting for new key... Press ESCAPE to cancel", 0, 0, textStyle); - } else { - Text_Paint(rect->x, rect->y, scale, color, "Press ENTER or CLICK to change, Press BACKSPACE to clear", 0, 0, textStyle); - } -} - -static void UI_DrawGLInfo(rectDef_t *rect, float scale, vec4_t color, int textStyle) { - char * eptr; - char buff[1024]; - const char *lines[64]; - int y, numLines, i; - - Text_Paint(rect->x + 2, rect->y, scale, color, va("VENDOR: %s", uiInfo.uiDC.glconfig.vendor_string), 0, 30, textStyle); - Text_Paint(rect->x + 2, rect->y + 15, scale, color, va("VERSION: %s: %s", uiInfo.uiDC.glconfig.version_string,uiInfo.uiDC.glconfig.renderer_string), 0, 30, textStyle); - Text_Paint(rect->x + 2, rect->y + 30, scale, color, va ("PIXELFORMAT: color(%d-bits) Z(%d-bits) stencil(%d-bits)", uiInfo.uiDC.glconfig.colorBits, uiInfo.uiDC.glconfig.depthBits, uiInfo.uiDC.glconfig.stencilBits), 0, 30, textStyle); - - // build null terminated extension strings - // in TA this was not directly crashing, but displaying a nasty broken shader right in the middle - // brought down the string size to 1024, there's not much that can be shown on the screen anyway - Q_strncpyz(buff, uiInfo.uiDC.glconfig.extensions_string, 1024); - eptr = buff; - y = rect->y + 45; - numLines = 0; - while ( y < rect->y + rect->h && *eptr ) - { - while ( *eptr && *eptr == ' ' ) - *eptr++ = '\0'; - - // track start of valid string - if (*eptr && *eptr != ' ') { - lines[numLines++] = eptr; - } - - while ( *eptr && *eptr != ' ' ) - eptr++; - } - - i = 0; - while (i < numLines) { - Text_Paint(rect->x + 2, y, scale, color, lines[i++], 0, 20, textStyle); - if (i < numLines) { - Text_Paint(rect->x + rect->w / 2, y, scale, color, lines[i++], 0, 20, textStyle); - } - y += 10; - if (y > rect->y + rect->h - 11) { - break; - } - } +static void UI_DrawGLInfo( rectDef_t *rect, float scale, int textalign, int textvalign, + vec4_t color, int textStyle, float text_x, float text_y) { + char buffer[ 4096 ]; + Com_sprintf( buffer, sizeof( buffer ), "VENDOR: %s\nVERSION: %s\n" + "PIXELFORMAT: color(%d-bits) Z(%d-bits) stencil(%d-bits)\n%s", + uiInfo.uiDC.glconfig.vendor_string, uiInfo.uiDC.glconfig.renderer_string, + uiInfo.uiDC.glconfig.colorBits, uiInfo.uiDC.glconfig.depthBits, + uiInfo.uiDC.glconfig.stencilBits, uiInfo.uiDC.glconfig.extensions_string ); + UI_DrawTextBlock( rect, text_x, text_y, color, scale, + textalign, textvalign, textStyle, buffer ); } // FIXME: table drive // static void UI_OwnerDraw( float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, - int ownerDrawFlags, int align, float special, + int ownerDrawFlags, int align, + int textalign, int textvalign, float special, float scale, vec4_t color, qhandle_t shader, int textStyle ) { rectDef_t rect; - rect.x = x + text_x; - rect.y = y + text_y; + rect.x = x; + rect.y = y; rect.w = w; rect.h = h; switch( ownerDraw ) { case UI_TEAMINFOPANE: - UI_DrawInfoPane( &uiInfo.tremTeamList[ uiInfo.tremTeamIndex ], - &rect, text_x, text_y, scale, color, textStyle ); + UI_DrawInfoPane( &uiInfo.tremTeamList[ uiInfo.tremTeamIndex ], + &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); break; case UI_ACLASSINFOPANE: - UI_DrawInfoPane( &uiInfo.alienClassList[ uiInfo.alienClassIndex ], - &rect, text_x, text_y, scale, color, textStyle ); + UI_DrawInfoPane( &uiInfo.alienClassList[ uiInfo.alienClassIndex ], + &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); break; case UI_AUPGRADEINFOPANE: - UI_DrawInfoPane( &uiInfo.alienUpgradeList[ uiInfo.alienUpgradeIndex ], - &rect, text_x, text_y, scale, color, textStyle ); + UI_DrawInfoPane( &uiInfo.alienUpgradeList[ uiInfo.alienUpgradeIndex ], + &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); break; case UI_HITEMINFOPANE: - UI_DrawInfoPane( &uiInfo.humanItemList[ uiInfo.humanItemIndex ], - &rect, text_x, text_y, scale, color, textStyle ); + UI_DrawInfoPane( &uiInfo.humanItemList[ uiInfo.humanItemIndex ], + &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); break; case UI_HBUYINFOPANE: - UI_DrawInfoPane( &uiInfo.humanArmouryBuyList[ uiInfo.humanArmouryBuyIndex ], - &rect, text_x, text_y, scale, color, textStyle ); + UI_DrawInfoPane( &uiInfo.humanArmouryBuyList[ uiInfo.humanArmouryBuyIndex ], + &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); break; case UI_HSELLINFOPANE: - UI_DrawInfoPane( &uiInfo.humanArmourySellList[ uiInfo.humanArmourySellIndex ], - &rect, text_x, text_y, scale, color, textStyle ); + UI_DrawInfoPane( &uiInfo.humanArmourySellList[ uiInfo.humanArmourySellIndex ], + &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); break; case UI_ABUILDINFOPANE: - UI_DrawInfoPane( &uiInfo.alienBuildList[ uiInfo.alienBuildIndex ], - &rect, text_x, text_y, scale, color, textStyle ); + UI_DrawInfoPane( &uiInfo.alienBuildList[ uiInfo.alienBuildIndex ], + &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); break; case UI_HBUILDINFOPANE: - UI_DrawInfoPane( &uiInfo.humanBuildList[ uiInfo.humanBuildIndex ], - &rect, text_x, text_y, scale, color, textStyle ); + UI_DrawInfoPane( &uiInfo.humanBuildList[ uiInfo.humanBuildIndex ], + &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); break; case UI_HANDICAP: @@ -2229,7 +2052,7 @@ static void UI_OwnerDraw( float x, float y, float w, float h, UI_DrawNetGameType(&rect, scale, color, textStyle); break; case UI_JOINGAMETYPE: - UI_DrawJoinGameType(&rect, scale, color, textStyle); + UI_DrawJoinGameType(&rect, scale, color, textStyle); break; case UI_MAPPREVIEW: UI_DrawMapPreview(&rect, scale, color, qtrue); @@ -2266,18 +2089,12 @@ static void UI_OwnerDraw( float x, float y, float w, float h, case UI_REDTEAM5: UI_DrawTeamMember(&rect, scale, color, qfalse, ownerDraw - UI_REDTEAM1 + 1, textStyle); break; - case UI_NETSOURCE: - UI_DrawNetSource(&rect, scale, color, textStyle); - break; case UI_NETMAPPREVIEW: UI_DrawNetMapPreview(&rect, scale, color); break; case UI_NETMAPCINEMATIC: UI_DrawNetMapCinematic(&rect, scale, color); break; - case UI_NETFILTER: - UI_DrawNetFilter(&rect, scale, color, textStyle); - break; case UI_TIER: UI_DrawTier(&rect, scale, color, textStyle); break; @@ -2344,17 +2161,8 @@ static void UI_OwnerDraw( float x, float y, float w, float h, case UI_SELECTEDPLAYER: UI_DrawSelectedPlayer(&rect, scale, color, textStyle); break; - case UI_SERVERREFRESHDATE: - UI_DrawServerRefreshDate(&rect, scale, color, textStyle); - break; - case UI_SERVERMOTD: - UI_DrawServerMOTD(&rect, scale, color); - break; case UI_GLINFO: - UI_DrawGLInfo(&rect,scale, color, textStyle); - break; - case UI_KEYBINDSTATUS: - UI_DrawKeyBindStatus(&rect,scale, color, textStyle); + UI_DrawGLInfo(&rect, scale, textalign, textvalign, color, textStyle, text_x, text_y); break; default: break; @@ -3096,7 +2904,7 @@ static void UI_LoadHumanItems( void ) UI_ParseCarriageList =============== */ -static void UI_ParseCarriageList( int *weapons, int *upgrades ) +static void UI_ParseCarriageList( void ) { int i; char carriageCvar[ MAX_TOKEN_CHARS ]; @@ -3107,11 +2915,8 @@ static void UI_ParseCarriageList( int *weapons, int *upgrades ) trap_Cvar_VariableStringBuffer( "ui_carriage", carriageCvar, sizeof( carriageCvar ) ); iterator = carriageCvar; - if( weapons ) - *weapons = 0; - - if( upgrades ) - *upgrades = 0; + uiInfo.weapons = 0; + uiInfo.upgrades = 0; //simple parser to give rise to weapon/upgrade list while( iterator && iterator[ 0 ] != '$' ) @@ -3129,8 +2934,7 @@ static void UI_ParseCarriageList( int *weapons, int *upgrades ) i = atoi( buffer ); - if( weapons ) - *weapons |= ( 1 << i ); + uiInfo.weapons |= ( 1 << i ); } else if( iterator[ 0 ] == 'U' ) { @@ -3143,8 +2947,7 @@ static void UI_ParseCarriageList( int *weapons, int *upgrades ) i = atoi( buffer ); - if( upgrades ) - *upgrades |= ( 1 << i ); + uiInfo.upgrades |= ( 1 << i ); } iterator++; @@ -3160,20 +2963,19 @@ static void UI_LoadHumanArmouryBuys( void ) { int i, j = 0; stage_t stage = UI_GetCurrentHumanStage( ); - int weapons, upgrades; int slots = 0; - UI_ParseCarriageList( &weapons, &upgrades ); + UI_ParseCarriageList( ); for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) { - if( weapons & ( 1 << i ) ) + if( uiInfo.weapons & ( 1 << i ) ) slots |= BG_FindSlotsForWeapon( i ); } for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) { - if( upgrades & ( 1 << i ) ) + if( uiInfo.upgrades & ( 1 << i ) ) slots |= BG_FindSlotsForUpgrade( i ); } @@ -3186,12 +2988,12 @@ static void UI_LoadHumanArmouryBuys( void ) BG_FindStagesForWeapon( i, stage ) && BG_WeaponIsAllowed( i ) && !( BG_FindSlotsForWeapon( i ) & slots ) && - !( weapons & ( 1 << i ) ) ) + !( uiInfo.weapons & ( 1 << i ) ) ) { uiInfo.humanArmouryBuyList[ j ].text = String_Alloc( BG_FindHumanNameForWeapon( i ) ); uiInfo.humanArmouryBuyList[ j ].cmd = - String_Alloc( va( "cmd buy %s retrigger\n", BG_FindNameForWeapon( i ) ) ); + String_Alloc( va( "cmd buy %s\n", BG_FindNameForWeapon( i ) ) ); uiInfo.humanArmouryBuyList[ j ].type = INFOTYPE_WEAPON; uiInfo.humanArmouryBuyList[ j ].v.weapon = i; @@ -3208,12 +3010,12 @@ static void UI_LoadHumanArmouryBuys( void ) BG_FindStagesForUpgrade( i, stage ) && BG_UpgradeIsAllowed( i ) && !( BG_FindSlotsForUpgrade( i ) & slots ) && - !( upgrades & ( 1 << i ) ) ) + !( uiInfo.upgrades & ( 1 << i ) ) ) { uiInfo.humanArmouryBuyList[ j ].text = String_Alloc( BG_FindHumanNameForUpgrade( i ) ); uiInfo.humanArmouryBuyList[ j ].cmd = - String_Alloc( va( "cmd buy %s retrigger\n", BG_FindNameForUpgrade( i ) ) ); + String_Alloc( va( "cmd buy %s\n", BG_FindNameForUpgrade( i ) ) ); uiInfo.humanArmouryBuyList[ j ].type = INFOTYPE_UPGRADE; uiInfo.humanArmouryBuyList[ j ].v.upgrade = i; @@ -3231,19 +3033,18 @@ UI_LoadHumanArmourySells */ static void UI_LoadHumanArmourySells( void ) { - int weapons, upgrades; int i, j = 0; uiInfo.humanArmourySellCount = 0; - UI_ParseCarriageList( &weapons, &upgrades ); + UI_ParseCarriageList( ); for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) { - if( weapons & ( 1 << i ) ) + if( uiInfo.weapons & ( 1 << i ) ) { uiInfo.humanArmourySellList[ j ].text = String_Alloc( BG_FindHumanNameForWeapon( i ) ); uiInfo.humanArmourySellList[ j ].cmd = - String_Alloc( va( "cmd sell %s retrigger\n", BG_FindNameForWeapon( i ) ) ); + String_Alloc( va( "cmd sell %s\n", BG_FindNameForWeapon( i ) ) ); uiInfo.humanArmourySellList[ j ].type = INFOTYPE_WEAPON; uiInfo.humanArmourySellList[ j ].v.weapon = i; @@ -3255,11 +3056,11 @@ static void UI_LoadHumanArmourySells( void ) for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) { - if( upgrades & ( 1 << i ) ) + if( uiInfo.upgrades & ( 1 << i ) ) { uiInfo.humanArmourySellList[ j ].text = String_Alloc( BG_FindHumanNameForUpgrade( i ) ); uiInfo.humanArmourySellList[ j ].cmd = - String_Alloc( va( "cmd sell %s retrigger\n", BG_FindNameForUpgrade( i ) ) ); + String_Alloc( va( "cmd sell %s\n", BG_FindNameForUpgrade( i ) ) ); uiInfo.humanArmourySellList[ j ].type = INFOTYPE_UPGRADE; uiInfo.humanArmourySellList[ j ].v.upgrade = i; @@ -3272,6 +3073,26 @@ static void UI_LoadHumanArmourySells( void ) /* =============== +UI_ArmouryRefreshCb +=============== +*/ +static void UI_ArmouryRefreshCb( void *data ) +{ + int oldWeapons = uiInfo.weapons; + int oldUpgrades = uiInfo.upgrades; + + UI_ParseCarriageList( ); + + if( uiInfo.weapons != oldWeapons || uiInfo.upgrades != oldUpgrades ) + { + UI_LoadHumanArmouryBuys( ); + UI_LoadHumanArmourySells( ); + UI_RemoveCaptureFunc( ); + } +} + +/* +=============== UI_LoadAlienUpgrades =============== */ @@ -3313,19 +3134,18 @@ UI_LoadAlienBuilds */ static void UI_LoadAlienBuilds( void ) { - int weapons; int i, j = 0; stage_t stage; - UI_ParseCarriageList( &weapons, NULL ); + UI_ParseCarriageList( ); stage = UI_GetCurrentAlienStage( ); uiInfo.alienBuildCount = 0; - for( i = BA_NONE +1; i < BA_NUM_BUILDABLES; i++ ) + for( i = BA_NONE + 1; i < BA_NUM_BUILDABLES; i++ ) { if( BG_FindTeamForBuildable( i ) == BIT_ALIENS && - BG_FindBuildWeaponForBuildable( i ) & weapons && + BG_FindBuildWeaponForBuildable( i ) & uiInfo.weapons && BG_FindStagesForBuildable( i, stage ) && BG_BuildableIsAllowed( i ) ) { @@ -3350,19 +3170,18 @@ UI_LoadHumanBuilds */ static void UI_LoadHumanBuilds( void ) { - int weapons; int i, j = 0; stage_t stage; - UI_ParseCarriageList( &weapons, NULL ); + UI_ParseCarriageList( ); stage = UI_GetCurrentHumanStage( ); uiInfo.humanBuildCount = 0; - for( i = BA_NONE +1; i < BA_NUM_BUILDABLES; i++ ) + for( i = BA_NONE + 1; i < BA_NUM_BUILDABLES; i++ ) { if( BG_FindTeamForBuildable( i ) == BIT_HUMANS && - BG_FindBuildWeaponForBuildable( i ) & weapons && + BG_FindBuildWeaponForBuildable( i ) & uiInfo.weapons && BG_FindStagesForBuildable( i, stage ) && BG_BuildableIsAllowed( i ) ) { @@ -3848,6 +3667,8 @@ static void UI_RunMenuScript(char **args) { { if( ( cmd = uiInfo.humanArmouryBuyList[ uiInfo.humanArmouryBuyIndex ].cmd ) ) trap_Cmd_ExecuteText( EXEC_APPEND, cmd ); + + UI_InstallCaptureFunc( UI_ArmouryRefreshCb, NULL, 1000 ); } else if( Q_stricmp( name, "LoadHumanArmourySells" ) == 0 ) UI_LoadHumanArmourySells( ); @@ -3855,6 +3676,8 @@ static void UI_RunMenuScript(char **args) { { if( ( cmd = uiInfo.humanArmourySellList[ uiInfo.humanArmourySellIndex ].cmd ) ) trap_Cmd_ExecuteText( EXEC_APPEND, cmd ); + + UI_InstallCaptureFunc( UI_ArmouryRefreshCb, NULL, 1000 ); } else if( Q_stricmp( name, "LoadAlienUpgrades" ) == 0 ) { @@ -5366,6 +5189,8 @@ void _UI_Init( qboolean inGameLoad ) { uiInfo.uiDC.drawText = &Text_Paint; uiInfo.uiDC.textWidth = &Text_Width; uiInfo.uiDC.textHeight = &Text_Height; + uiInfo.uiDC.textEmWidth = &Text_EmWidth; + uiInfo.uiDC.textEmHeight = &Text_EmHeight; uiInfo.uiDC.registerModel = &trap_R_RegisterModel; uiInfo.uiDC.modelBounds = &trap_R_ModelBounds; uiInfo.uiDC.fillRect = &UI_FillRect; @@ -5402,6 +5227,7 @@ void _UI_Init( qboolean inGameLoad ) { uiInfo.uiDC.Print = &Com_Printf; uiInfo.uiDC.Pause = &UI_Pause; uiInfo.uiDC.ownerDrawWidth = &UI_OwnerDrawWidth; + uiInfo.uiDC.ownerDrawText = &UI_OwnerDrawText; uiInfo.uiDC.registerSound = &trap_S_RegisterSound; uiInfo.uiDC.startBackgroundTrack = &trap_S_StartBackgroundTrack; uiInfo.uiDC.stopBackgroundTrack = &trap_S_StopBackgroundTrack; @@ -5974,6 +5800,7 @@ vmCvar_t ui_recordSPDemo; vmCvar_t ui_realCaptureLimit; vmCvar_t ui_realWarmUp; vmCvar_t ui_serverStatusTimeOut; +vmCvar_t ui_textWrapCache; vmCvar_t ui_winner; @@ -6100,6 +5927,7 @@ static cvarTable_t cvarTable[] = { { &ui_realWarmUp, "g_warmup", "20", CVAR_ARCHIVE}, { &ui_realCaptureLimit, "capturelimit", "8", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART}, { &ui_serverStatusTimeOut, "ui_serverStatusTimeOut", "7000", CVAR_ARCHIVE}, + { &ui_textWrapCache, "ui_textWrapCache", "1", CVAR_ARCHIVE }, }; static int cvarTableSize = sizeof(cvarTable) / sizeof(cvarTable[0]); diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index 0a8a3c25..3224b697 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -45,7 +45,8 @@ static scrollInfo_t scrollInfo; void voidFunction( void *var ) { return; } qboolean voidFunction2( itemDef_t *var1, int var2 ) { return qfalse; } -static void (*captureFunc) (void *p) = voidFunction; +static CaptureFunc *captureFunc = voidFunction; +static int captureFuncExpiry = 0; static void *captureData = NULL; static itemDef_t *itemCapture = NULL; // item that has the mouse captured ( if any ) @@ -77,6 +78,34 @@ itemDef_t *Menu_SetPrevCursorItem(menuDef_t *menu); itemDef_t *Menu_SetNextCursorItem(menuDef_t *menu); static qboolean Menu_OverActiveItem(menuDef_t *menu, float x, float y); +/* +=============== +UI_InstallCaptureFunc +=============== +*/ +void UI_InstallCaptureFunc( CaptureFunc *f, void *data, int timeout ) +{ + captureFunc = f; + captureData = data; + + if( timeout > 0 ) + captureFuncExpiry = DC->realTime + timeout; + else + captureFuncExpiry = 0; +} + +/* +=============== +UI_RemoveCaptureFunc +=============== +*/ +void UI_RemoveCaptureFunc( void ) +{ + captureFunc = voidFunction; + captureData = NULL; + captureFuncExpiry = 0; +} + #ifdef CGAME #define MEM_POOL_SIZE 128 * 1024 #else @@ -333,6 +362,238 @@ qboolean Float_Parse(char **p, float *f) { } } +#define MAX_EXPR_ELEMENTS 32 + +typedef enum +{ + EXPR_OPERATOR, + EXPR_VALUE +} exprType_t; + +typedef struct exprToken_s +{ + exprType_t type; + union + { + char op; + float val; + } u; +} exprToken_t; + +typedef struct exprList_s +{ + exprToken_t l[ MAX_EXPR_ELEMENTS ]; + int f, b; +} exprList_t; + +/* +================= +OpPrec + +Return a value reflecting operator precedence +================= +*/ +static ID_INLINE int OpPrec( char op ) +{ + switch( op ) + { + case '*': return 4; + case '/': return 3; + case '+': return 2; + case '-': return 1; + case '(': return 0; + default: return -1; + } +} + +/* +================= +PC_Expression_Parse +================= +*/ +static qboolean PC_Expression_Parse( int handle, float *f ) +{ + pc_token_t token; + int unmatchedParentheses = 0; + exprList_t stack, fifo; + exprToken_t value; + qboolean expectingNumber = qtrue; + +#define FULL( a ) ( a.b >= ( MAX_EXPR_ELEMENTS - 1 ) ) +#define EMPTY( a ) ( a.f > a.b ) + +#define PUSH_VAL( a, v ) \ + { \ + if( FULL( a ) ) \ + return qfalse; \ + a.b++; \ + a.l[ a.b ].type = EXPR_VALUE; \ + a.l[ a.b ].u.val = v; \ + } + +#define PUSH_OP( a, o ) \ + { \ + if( FULL( a ) ) \ + return qfalse; \ + a.b++; \ + a.l[ a.b ].type = EXPR_OPERATOR; \ + a.l[ a.b ].u.op = o; \ + } + +#define POP_STACK( a ) \ + { \ + if( EMPTY( a ) ) \ + return qfalse; \ + value = a.l[ a.b ]; \ + a.b--; \ + } + +#define PEEK_STACK_OP( a ) ( a.l[ a.b ].u.op ) +#define PEEK_STACK_VAL( a ) ( a.l[ a.b ].u.val ) + +#define POP_FIFO( a ) \ + { \ + if( EMPTY( a ) ) \ + return qfalse; \ + value = a.l[ a.f ]; \ + a.f++; \ + } + + stack.f = fifo.f = 0; + stack.b = fifo.b = -1; + + while( trap_Parse_ReadToken( handle, &token ) ) + { + if( !unmatchedParentheses && token.string[ 0 ] == ')' ) + break; + + // Special case to catch negative numbers + if( expectingNumber && token.string[ 0 ] == '-' ) + { + if( !trap_Parse_ReadToken( handle, &token ) ) + return qfalse; + + token.floatvalue = -token.floatvalue; + } + + if( token.type == TT_NUMBER ) + { + if( !expectingNumber ) + return qfalse; + expectingNumber = !expectingNumber; + + PUSH_VAL( fifo, token.floatvalue ); + } + else + { + switch( token.string[ 0 ] ) + { + case '(': + unmatchedParentheses++; + PUSH_OP( stack, '(' ); + break; + + case ')': + unmatchedParentheses--; + if( unmatchedParentheses < 0 ) + return qfalse; + + while( !EMPTY( stack ) && PEEK_STACK_OP( stack ) != '(' ) + { + POP_STACK( stack ); + PUSH_OP( fifo, value.u.op ); + } + + // Pop the '(' + POP_STACK( stack ); + break; + + case '*': + case '/': + case '+': + case '-': + if( expectingNumber ) + return qfalse; + expectingNumber = !expectingNumber; + + if( EMPTY( stack ) ) + { + PUSH_OP( stack, token.string[ 0 ] ); + } + else + { + while( !EMPTY( stack ) && OpPrec( token.string[ 0 ] ) < OpPrec( PEEK_STACK_OP( stack ) ) ) + { + POP_STACK( stack ); + PUSH_OP( fifo, value.u.op ); + } + + PUSH_OP( stack, token.string[ 0 ] ); + } + break; + + default: + // Unknown token + return qfalse; + } + } + } + + while( !EMPTY( stack ) ) + { + POP_STACK( stack ); + PUSH_OP( fifo, value.u.op ); + } + + while( !EMPTY( fifo ) ) + { + POP_FIFO( fifo ); + + if( value.type == EXPR_VALUE ) + { + PUSH_VAL( stack, value.u.val ); + } + else if( value.type == EXPR_OPERATOR ) + { + char op = value.u.op; + float operand1, operand2, result; + + POP_STACK( stack ); + operand2 = value.u.val; + POP_STACK( stack ); + operand1 = value.u.val; + + switch( op ) + { + case '*': result = operand1 * operand2; break; + case '/': result = operand1 / operand2; break; + case '+': result = operand1 + operand2; break; + case '-': result = operand1 - operand2; break; + default: + Com_Error( ERR_FATAL, "Unknown operator '%c' in postfix string", op ); + return qfalse; + } + + PUSH_VAL( stack, result ); + } + } + + POP_STACK( stack ); + + *f = value.u.val; + + return qtrue; + +#undef FULL +#undef EMPTY +#undef PUSH_VAL +#undef PUSH_OP +#undef POP_STACK +#undef PEEK_STACK_OP +#undef PEEK_STACK_VAL +#undef POP_FIFO +} + /* ================= PC_Float_Parse @@ -344,6 +605,10 @@ qboolean PC_Float_Parse(int handle, float *f) { if (!trap_Parse_ReadToken(handle, &token)) return qfalse; + + if( token.string[ 0 ] == '(' ) + return PC_Expression_Parse( handle, f ); + if (token.string[0] == '-') { if (!trap_Parse_ReadToken(handle, &token)) return qfalse; @@ -424,6 +689,20 @@ qboolean PC_Int_Parse(int handle, int *i) { if (!trap_Parse_ReadToken(handle, &token)) return qfalse; + + if( token.string[ 0 ] == '(' ) + { + float f; + + if( PC_Expression_Parse( handle, &f ) ) + { + *i = (int)f; + return qtrue; + } + else + return qfalse; + } + if (token.string[0] == '-') { if (!trap_Parse_ReadToken(handle, &token)) return qfalse; @@ -611,8 +890,7 @@ void Fade(int *flags, float *f, float clamp, int *nextTime, int offsetTime, qboo -void Window_Paint(Window *w, float fadeAmount, float fadeClamp, float fadeCycle) { - //float bordersize = 0; +static void Window_Paint(Window *w, float fadeAmount, float fadeClamp, float fadeCycle) { vec4_t color; rectDef_t fillRect = w->rect; @@ -669,6 +947,14 @@ void Window_Paint(Window *w, float fadeAmount, float fadeClamp, float fadeCycle) DC->drawCinematic(w->cinematic, fillRect.x, fillRect.y, fillRect.w, fillRect.h); } } +} + +static void Border_Paint(Window *w) { + vec4_t color; + + if (w == NULL || (w->style == 0 && w->border == 0)) { + return; + } if (w->border == WINDOW_BORDER_FULL) { // full @@ -706,7 +992,6 @@ void Window_Paint(Window *w, float fadeAmount, float fadeClamp, float fadeCycle) r.y = w->rect.y + w->rect.h - 1; GradientBar_Paint(&r, w->borderColor); } - } @@ -1490,7 +1775,7 @@ float Item_Slider_ThumbPosition(itemDef_t *item) { editFieldDef_t *editDef = item->typeData; if (item->text) { - x = item->textRect.x + item->textRect.w + 8; + x = item->textRect.x + item->textRect.w + ITEM_VALUE_OFFSET; } else { x = item->window.rect.x; } @@ -1510,21 +1795,29 @@ float Item_Slider_ThumbPosition(itemDef_t *item) { range = editDef->maxVal - editDef->minVal; value -= editDef->minVal; value /= range; - //value /= (editDef->maxVal - editDef->minVal); value *= SLIDER_WIDTH; x += value; - // vm fuckage - //x = x + (((float)value / editDef->maxVal) * SLIDER_WIDTH); + return x; } +static float Item_Slider_VScale( itemDef_t *item ) +{ + if( SLIDER_THUMB_HEIGHT > item->window.rect.h ) + return item->window.rect.h / SLIDER_THUMB_HEIGHT; + else + return 1.0f; +} + int Item_Slider_OverSlider(itemDef_t *item, float x, float y) { rectDef_t r; + float vScale = Item_Slider_VScale( item ); r.x = Item_Slider_ThumbPosition(item) - (SLIDER_THUMB_WIDTH / 2); - r.y = item->window.rect.y - 2; + r.y = item->textRect.y - item->textRect.h + + ( ( item->textRect.h - ( SLIDER_THUMB_HEIGHT * vScale ) ) / 2.0f ); r.w = SLIDER_THUMB_WIDTH; - r.h = SLIDER_THUMB_HEIGHT; + r.h = SLIDER_THUMB_HEIGHT * vScale; if (Rect_ContainsPoint(&r, x, y)) { return WINDOW_LB_THUMB; @@ -2058,148 +2351,182 @@ qboolean Item_Multi_HandleKey(itemDef_t *item, int key) { return qfalse; } -qboolean Item_TextField_HandleKey(itemDef_t *item, int key) { +#define MIN_FIELD_WIDTH 10 +#define EDIT_CURSOR_WIDTH 10 + +static void Item_TextField_CalcPaintOffset( itemDef_t *item, char *buff ) +{ + editFieldDef_t *editPtr = (editFieldDef_t*)item->typeData; + + if( item->cursorPos < editPtr->paintOffset ) + { + editPtr->paintOffset = item->cursorPos; + } + else + { + // If there is a maximum field width + if( editPtr->maxFieldWidth > 0 ) + { + // If the cursor is at the end of the string, maximise the amount of the + // string that's visible + if( buff[ item->cursorPos + 1 ] == '\0' ) + { + while( DC->textWidth( &buff[ editPtr->paintOffset ], item->textscale, 0 ) <= + ( editPtr->maxFieldWidth - EDIT_CURSOR_WIDTH ) && editPtr->paintOffset > 0 ) + editPtr->paintOffset--; + } + + buff[ item->cursorPos + 1 ] = '\0'; + + // Shift paintOffset so that the cursor is visible + while( DC->textWidth( &buff[ editPtr->paintOffset ], item->textscale, 0 ) > + ( editPtr->maxFieldWidth - EDIT_CURSOR_WIDTH ) ) + editPtr->paintOffset++; + } + } +} + +qboolean Item_TextField_HandleKey(itemDef_t *item, int key) +{ char buff[1024]; int len; itemDef_t *newItem = NULL; editFieldDef_t *editPtr = (editFieldDef_t*)item->typeData; + qboolean releaseFocus = qtrue; - if (item->cvar) { + if( item->cvar ) + { + Com_Memset( buff, 0, sizeof( buff ) ); + DC->getCVarString( item->cvar, buff, sizeof( buff ) ); + len = strlen( buff ); - memset(buff, 0, sizeof(buff)); - DC->getCVarString(item->cvar, buff, sizeof(buff)); - len = strlen(buff); - if (editPtr->maxChars && len > editPtr->maxChars) { + if( editPtr->maxChars && len > editPtr->maxChars ) len = editPtr->maxChars; - } - if ( key & K_CHAR_FLAG ) { - key &= ~K_CHAR_FLAG; + if( key & K_CHAR_FLAG ) + { + key &= ~K_CHAR_FLAG; - if (key == 'h' - 'a' + 1 ) { // ctrl-h is backspace - if ( item->cursorPos > 0 ) { + if( key == 'h' - 'a' + 1 ) + { + // ctrl-h is backspace + if ( item->cursorPos > 0 ) + { memmove( &buff[item->cursorPos - 1], &buff[item->cursorPos], len + 1 - item->cursorPos); item->cursorPos--; - if (item->cursorPos < editPtr->paintOffset) { - editPtr->paintOffset--; - } } + DC->setCVar(item->cvar, buff); - return qtrue; } - - - // - // ignore any non printable chars - // - if ( key < 32 || !item->cvar) { - return qtrue; - } - - if (item->type == ITEM_TYPE_NUMERICFIELD) { - if (key < '0' || key > '9') { - return qfalse; - } + else if( key < 32 || !item->cvar ) + { + // Ignore any non printable chars + releaseFocus = qfalse; + goto exit; + } + else if( item->type == ITEM_TYPE_NUMERICFIELD && ( key < '0' || key > '9' ) ) + { + // Ignore non-numeric characters + releaseFocus = qfalse; + goto exit; } + else + { + if (!DC->getOverstrikeMode()) + { + if (( len == MAX_EDITFIELD - 1 ) || (editPtr->maxChars && len >= editPtr->maxChars)) + { + // Reached maximum field length + releaseFocus = qfalse; + goto exit; + } - if (!DC->getOverstrikeMode()) { - if (( len == MAX_EDITFIELD - 1 ) || (editPtr->maxChars && len >= editPtr->maxChars)) { - return qtrue; + memmove( &buff[item->cursorPos + 1], &buff[item->cursorPos], len + 1 - item->cursorPos ); } - memmove( &buff[item->cursorPos + 1], &buff[item->cursorPos], len + 1 - item->cursorPos ); - } else { - if (editPtr->maxChars && item->cursorPos >= editPtr->maxChars) { - return qtrue; + else + { + // Reached maximum field length + if (editPtr->maxChars && item->cursorPos >= editPtr->maxChars) + releaseFocus = qfalse; + goto exit; } - } - buff[item->cursorPos] = key; + buff[ item->cursorPos ] = key; - DC->setCVar(item->cvar, buff); + DC->setCVar( item->cvar, buff ); - if (item->cursorPos < len + 1) { - item->cursorPos++; - if (editPtr->maxPaintChars && item->cursorPos > editPtr->maxPaintChars) { - editPtr->paintOffset++; - } + if( item->cursorPos < len + 1 ) + item->cursorPos++; } + } + else + { + switch( key ) + { + case K_DEL: + case K_KP_DEL: + if( item->cursorPos < len ) + { + memmove( buff + item->cursorPos, buff + item->cursorPos + 1, len - item->cursorPos); + DC->setCVar(item->cvar, buff); + } + break; - } else { - - if ( key == K_DEL || key == K_KP_DEL ) { - if ( item->cursorPos < len ) { - memmove( buff + item->cursorPos, buff + item->cursorPos + 1, len - item->cursorPos); - DC->setCVar(item->cvar, buff); - } - return qtrue; - } + case K_RIGHTARROW: + case K_KP_RIGHTARROW: + if( item->cursorPos < len ) + item->cursorPos++; + break; - if ( key == K_RIGHTARROW || key == K_KP_RIGHTARROW ) - { - if (editPtr->maxPaintChars && item->cursorPos >= editPtr->maxPaintChars && item->cursorPos < len) { - item->cursorPos++; - editPtr->paintOffset++; - return qtrue; - } - if (item->cursorPos < len) { - item->cursorPos++; - } - return qtrue; - } + case K_LEFTARROW: + case K_KP_LEFTARROW: + if( item->cursorPos > 0 ) + item->cursorPos--; + break; - if ( key == K_LEFTARROW || key == K_KP_LEFTARROW ) - { - if ( item->cursorPos > 0 ) { - item->cursorPos--; - } - if (item->cursorPos < editPtr->paintOffset) { - editPtr->paintOffset--; - } - return qtrue; - } + case K_HOME: + case K_KP_HOME: + item->cursorPos = 0; + break; - if ( key == K_HOME || key == K_KP_HOME) {// || ( tolower(key) == 'a' && trap_Key_IsDown( K_CTRL ) ) ) { - item->cursorPos = 0; - editPtr->paintOffset = 0; - return qtrue; - } + case K_END: + case K_KP_END: + item->cursorPos = len; + break; - if ( key == K_END || key == K_KP_END) {// ( tolower(key) == 'e' && trap_Key_IsDown( K_CTRL ) ) ) { - item->cursorPos = len; - if(item->cursorPos > editPtr->maxPaintChars) { - editPtr->paintOffset = len - editPtr->maxPaintChars; - } - return qtrue; - } + case K_INS: + case K_KP_INS: + DC->setOverstrikeMode(!DC->getOverstrikeMode()); + break; - if ( key == K_INS || key == K_KP_INS ) { - DC->setOverstrikeMode(!DC->getOverstrikeMode()); - return qtrue; - } - } + case K_TAB: + case K_DOWNARROW: + case K_KP_DOWNARROW: + case K_UPARROW: + case K_KP_UPARROW: + newItem = Menu_SetNextCursorItem(item->parent); + if( newItem && ( newItem->type == ITEM_TYPE_EDITFIELD || newItem->type == ITEM_TYPE_NUMERICFIELD ) ) + g_editItem = newItem; + break; - if (key == K_TAB || key == K_DOWNARROW || key == K_KP_DOWNARROW) { - newItem = Menu_SetNextCursorItem(item->parent); - if (newItem && (newItem->type == ITEM_TYPE_EDITFIELD || newItem->type == ITEM_TYPE_NUMERICFIELD)) { - g_editItem = newItem; - } - } + case K_ENTER: + case K_KP_ENTER: + case K_ESCAPE: + releaseFocus = qtrue; + goto exit; - if (key == K_UPARROW || key == K_KP_UPARROW) { - newItem = Menu_SetPrevCursorItem(item->parent); - if (newItem && (newItem->type == ITEM_TYPE_EDITFIELD || newItem->type == ITEM_TYPE_NUMERICFIELD)) { - g_editItem = newItem; + default: + break; } } - if ( key == K_ENTER || key == K_KP_ENTER || key == K_ESCAPE) { - return qfalse; - } - - return qtrue; + releaseFocus = qfalse; } - return qfalse; +exit: + Item_TextField_CalcPaintOffset( item, buff ); + + return !releaseFocus; } static void Scroll_ListBox_AutoFunc(void *p) { @@ -2287,7 +2614,7 @@ static void Scroll_Slider_ThumbFunc(void *p) { editFieldDef_t *editDef = si->item->typeData; if (si->item->text) { - x = si->item->textRect.x + si->item->textRect.w + 8; + x = si->item->textRect.x + si->item->textRect.w + ITEM_VALUE_OFFSET; } else { x = si->item->window.rect.x; } @@ -2308,6 +2635,11 @@ static void Scroll_Slider_ThumbFunc(void *p) { void Item_StartCapture(itemDef_t *item, int key) { int flags; + + // Don't allow captureFunc to be overridden + if( captureFunc != voidFunction ) + return; + switch (item->type) { case ITEM_TYPE_EDITFIELD: case ITEM_TYPE_NUMERICFIELD: @@ -2322,16 +2654,14 @@ void Item_StartCapture(itemDef_t *item, int key) { scrollInfo.scrollKey = key; scrollInfo.scrollDir = (flags & WINDOW_LB_LEFTARROW) ? qtrue : qfalse; scrollInfo.item = item; - captureData = &scrollInfo; - captureFunc = &Scroll_ListBox_AutoFunc; + UI_InstallCaptureFunc( Scroll_ListBox_AutoFunc, &scrollInfo, 0 ); itemCapture = item; } else if (flags & WINDOW_LB_THUMB) { scrollInfo.scrollKey = key; scrollInfo.item = item; scrollInfo.xStart = DC->cursorx; scrollInfo.yStart = DC->cursory; - captureData = &scrollInfo; - captureFunc = &Scroll_ListBox_ThumbFunc; + UI_InstallCaptureFunc( Scroll_ListBox_ThumbFunc, &scrollInfo, 0 ); itemCapture = item; } break; @@ -2344,8 +2674,7 @@ void Item_StartCapture(itemDef_t *item, int key) { scrollInfo.item = item; scrollInfo.xStart = DC->cursorx; scrollInfo.yStart = DC->cursory; - captureData = &scrollInfo; - captureFunc = &Scroll_Slider_ThumbFunc; + UI_InstallCaptureFunc( Scroll_Slider_ThumbFunc, &scrollInfo, 0 ); itemCapture = item; } break; @@ -2367,7 +2696,7 @@ qboolean Item_Slider_HandleKey(itemDef_t *item, int key, qboolean down) { rectDef_t testRect; width = SLIDER_WIDTH; if (item->text) { - x = item->textRect.x + item->textRect.w + 8; + x = item->textRect.x + item->textRect.w + ITEM_VALUE_OFFSET; } else { x = item->window.rect.x; } @@ -2399,8 +2728,7 @@ qboolean Item_HandleKey(itemDef_t *item, int key, qboolean down) { if (itemCapture) { Item_StopCapture(itemCapture); itemCapture = NULL; - captureFunc = voidFunction; - captureData = NULL; + UI_RemoveCaptureFunc( ); } else { if ( down && ( key == K_MOUSE1 || key == K_MOUSE2 || key == K_MOUSE3 ) ) { Item_StartCapture(item, key); @@ -2750,10 +3078,15 @@ void Menu_HandleKey(menuDef_t *menu, int key, qboolean down) { } } else if (item->type == ITEM_TYPE_EDITFIELD || item->type == ITEM_TYPE_NUMERICFIELD) { if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory)) { - item->cursorPos = 0; + char buffer[ MAX_STRING_CHARS ] = { 0 }; + + if( item->cvar ) + DC->getCVarString( item->cvar, buffer, sizeof( buffer ) ); + + item->cursorPos = strlen( buffer ); + Item_TextField_CalcPaintOffset( item, buffer ); g_editingField = qtrue; g_editItem = item; - DC->setOverstrikeMode(qtrue); } } else { if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory)) { @@ -2788,10 +3121,15 @@ void Menu_HandleKey(menuDef_t *menu, int key, qboolean down) { case K_ENTER: if (item) { if (item->type == ITEM_TYPE_EDITFIELD || item->type == ITEM_TYPE_NUMERICFIELD) { - item->cursorPos = 0; + char buffer[ MAX_STRING_CHARS ] = { 0 }; + + if( item->cvar ) + DC->getCVarString( item->cvar, buffer, sizeof( buffer ) ); + + item->cursorPos = strlen( buffer ); + Item_TextField_CalcPaintOffset( item, buffer ); g_editingField = qtrue; g_editItem = item; - DC->setOverstrikeMode(qtrue); } else { Item_Action(item); } @@ -2826,26 +3164,37 @@ void Item_SetTextExtents(itemDef_t *item, int *width, int *height, const char *t // keeps us from computing the widths and heights more than once if (*width == 0 || (item->type == ITEM_TYPE_OWNERDRAW && item->textalignment == ITEM_ALIGN_CENTER)) { - int originalWidth = DC->textWidth(item->text, item->textscale, 0); + int originalWidth; - if (item->type == ITEM_TYPE_OWNERDRAW && (item->textalignment == ITEM_ALIGN_CENTER || item->textalignment == ITEM_ALIGN_RIGHT)) { - originalWidth += DC->ownerDrawWidth(item->window.ownerDraw, item->textscale); - } else if (item->type == ITEM_TYPE_EDITFIELD && item->textalignment == ITEM_ALIGN_CENTER && item->cvar) { + if (item->type == ITEM_TYPE_EDITFIELD && item->textalignment == ITEM_ALIGN_CENTER && item->cvar) { + //FIXME: this will only be called once? char buff[256]; DC->getCVarString(item->cvar, buff, 256); - originalWidth += DC->textWidth(buff, item->textscale, 0); + originalWidth = DC->textWidth(item->text, item->textscale, 0) + + DC->textWidth(buff, item->textscale, 0); + } else { + originalWidth = DC->textWidth(item->text, item->textscale, 0); } *width = DC->textWidth(textPtr, item->textscale, 0); *height = DC->textHeight(textPtr, item->textscale, 0); item->textRect.w = *width; item->textRect.h = *height; - item->textRect.x = item->textalignx; - item->textRect.y = item->textaligny; - if (item->textalignment == ITEM_ALIGN_RIGHT) { - item->textRect.x = item->textalignx - originalWidth; + + if (item->textvalignment == ITEM_VALIGN_BOTTOM) { + item->textRect.y = item->textaligny + item->window.rect.h; + } else if (item->textvalignment == ITEM_VALIGN_CENTER) { + item->textRect.y = item->textaligny + ( ( *height + item->window.rect.h ) / 2.0f ); + } else if (item->textvalignment == ITEM_VALIGN_TOP) { + item->textRect.y = item->textaligny + *height; + } + + if (item->textalignment == ITEM_ALIGN_LEFT) { + item->textRect.x = item->textalignx; } else if (item->textalignment == ITEM_ALIGN_CENTER) { - item->textRect.x = item->textalignx - originalWidth / 2; + item->textRect.x = item->textalignx + ( ( item->window.rect.w - originalWidth ) / 2.0f ); + } else if (item->textalignment == ITEM_ALIGN_RIGHT) { + item->textRect.x = item->textalignx + item->window.rect.w - originalWidth; } ToWindowCoords(&item->textRect.x, &item->textRect.y, &item->window); @@ -2878,140 +3227,215 @@ void Item_TextColor(itemDef_t *item, vec4_t *newColor) { } } -int Item_Text_AutoWrapped_Lines( itemDef_t *item ) +static const char *Item_Text_Wrap( const char *text, float scale, float width ) { - char text[ 1024 ]; - const char *p, *textPtr, *newLinePtr; - char buff[ 1024 ]; - int len, textWidth, newLine; - int lines = 0; + static char out[ 8192 ]; + char *paint = out; + char c[ 3 ]; + const char *p = text; + const char *eol; + const char *q = NULL, *qMinus1 = NULL; + unsigned int testLength; + unsigned int i; - textWidth = 0; - newLinePtr = NULL; + if( strlen( text ) >= sizeof( out ) ) + return NULL; - if( item->text == NULL ) + *paint = '\0'; + + while( *p ) { - if( item->cvar == NULL ) - return 0; - else + Com_Memset( c, 0, sizeof( c ) ); + + // Skip leading whitespace + while( *p ) { - DC->getCVarString( item->cvar, text, sizeof( text ) ); - textPtr = text; + if( Q_IsColorString( p ) ) + { + c[ 0 ] = p[ 0 ]; + c[ 1 ] = p[ 1 ]; + p += 2; + } + else if( *p != '\n' && isspace( *p ) ) + p++; + else + break; } - } - else - textPtr = item->text; - if( *textPtr == '\0' ) - return 0; - - len = 0; - buff[ 0 ] = '\0'; - newLine = 0; - p = textPtr; + if( !*p ) + break; - while( p ) - { - textWidth = DC->textWidth( buff, item->textscale, 0 ); + testLength = 1; + eol = p; - if( *p == ' ' || *p == '\t' || *p == '\n' || *p == '\0' ) + while( DC->textWidth( p, scale, testLength ) < width ) { - newLine = len; - newLinePtr = p + 1; - } + if( testLength >= strlen( p ) ) + { + eol = p + strlen( p ); + break; + } - // forceably split lines that are too long (where normal splitage has failed) - if( textWidth > item->window.rect.w && newLine == 0 && *p != '\n' ) - { - newLine = len; - newLinePtr = p; - } + // Point q at the end of the current testLength + q = p; + for( i = 0; i < testLength; ) + { + // Skip color escapes + while( Q_IsColorString( q ) ) + { + q += 2; + continue; + } - if( ( newLine && textWidth > item->window.rect.w ) || *p == '\n' || *p == '\0' ) - { - if( len ) - buff[ newLine ] = '\0'; + qMinus1 = q; + q++; + i++; + } - if( !( *p == '\n' && !*( p + 1 ) ) ) - lines++; + // Some color escapes might still be present + while( Q_IsColorString( q ) ) + q += 2; - if( *p == '\0' ) + // Manual line break + if( *q == '\n' ) + { + eol = q + 1; break; + } - // - p = newLinePtr; - len = 0; - newLine = 0; + if( !isspace( *qMinus1 ) && isspace( *q ) ) + eol = q; - continue; + testLength++; } - buff[ len++ ] = *p++; - buff[ len ] = '\0'; + // No split has taken place, so just split mid-word + if( eol == p ) + eol = q; + + // Add colour code (might be empty) + Q_strcat( out, sizeof( out ), c ); + paint = out + strlen( out ); + + // Copy text + strncpy( paint, p, eol - p ); + paint[ eol - p ] = '\0'; + + // Add a \n if it's not there already + if( out[ strlen( out ) - 1 ] != '\n' ) + Q_strcat( out, sizeof( out ), "\n" ); + + paint = out + strlen( out ); + p = eol; } - return lines; + return out; } -#define MAX_AUTOWRAP_CACHE 16 -#define MAX_AUTOWRAP_LINES 32 -#define MAX_AUTOWRAP_TEXT 512 +#define MAX_WRAP_CACHE 16 +#define MAX_WRAP_LINES 32 +#define MAX_WRAP_TEXT 512 typedef struct { - //this is used purely for checking for cache hits - char text[ MAX_AUTOWRAP_TEXT * MAX_AUTOWRAP_LINES ]; + char text[ MAX_WRAP_TEXT * MAX_WRAP_LINES ]; //FIXME: augment with hash? rectDef_t rect; - int textWidth, textHeight; - char lines[ MAX_AUTOWRAP_LINES ][ MAX_AUTOWRAP_TEXT ]; - int lineOffsets[ MAX_AUTOWRAP_LINES ][ 2 ]; + float scale; + char lines[ MAX_WRAP_LINES ][ MAX_WRAP_TEXT ]; + float lineCoords[ MAX_WRAP_LINES ][ 2 ]; int numLines; -} autoWrapCache_t; +} wrapCache_t; -static int cacheIndex = 0; -static autoWrapCache_t awc[ MAX_AUTOWRAP_CACHE ]; +static wrapCache_t wrapCache[ MAX_WRAP_CACHE ]; +static int cacheWriteIndex = 0; +static int cacheReadIndex = 0; +static int cacheReadLineNum = 0; -static int checkCache( const char *text, rectDef_t *rect, int width, int height ) +static void UI_CreateCacheEntry( const char *text, rectDef_t *rect, float scale ) +{ + wrapCache_t *cacheEntry = &wrapCache[ cacheWriteIndex ]; + + Q_strncpyz( cacheEntry->text, text, sizeof( cacheEntry->text ) ); + cacheEntry->rect.x = rect->x; + cacheEntry->rect.y = rect->y; + cacheEntry->rect.w = rect->w; + cacheEntry->rect.h = rect->h; + cacheEntry->scale = scale; + cacheEntry->numLines = 0; +} + +static void UI_AddCacheEntryLine( const char *text, float x, float y ) +{ + wrapCache_t *cacheEntry = &wrapCache[ cacheWriteIndex ]; + + if( cacheEntry->numLines >= MAX_WRAP_LINES ) + return; + + Q_strncpyz( cacheEntry->lines[ cacheEntry->numLines ], text, + sizeof( cacheEntry->lines[ 0 ] ) ); + cacheEntry->lineCoords[ cacheEntry->numLines ][ 0 ] = x; + cacheEntry->lineCoords[ cacheEntry->numLines ][ 1 ] = y; + + cacheEntry->numLines++; +} + +static void UI_FinishCacheEntry( void ) +{ + cacheWriteIndex = ( cacheWriteIndex + 1 ) % MAX_WRAP_CACHE; +} + +static qboolean UI_CheckWrapCache( const char *text, rectDef_t *rect, float scale ) { int i; - for( i = 0; i < MAX_AUTOWRAP_CACHE; i++ ) + for( i = 0; i < MAX_WRAP_CACHE; i++ ) { - if( Q_stricmp( text, awc[ i ].text ) ) + wrapCache_t *cacheEntry = &wrapCache[ i ]; + + if( Q_stricmp( text, cacheEntry->text ) ) continue; - if( rect->x != awc[ i ].rect.x || - rect->y != awc[ i ].rect.y || - rect->w != awc[ i ].rect.w || - rect->h != awc[ i ].rect.h ) + if( rect->x != cacheEntry->rect.x || + rect->y != cacheEntry->rect.y || + rect->w != cacheEntry->rect.w || + rect->h != cacheEntry->rect.h ) continue; - if( awc[ i ].textWidth != width || awc[ i ].textHeight != height ) + if( cacheEntry->scale != scale ) continue; - //this is a match - return i; + // This is a match + cacheReadIndex = i; + cacheReadLineNum = 0; + return qtrue; } - //no match - autowrap isn't cached - return -1; + // No match - wrap isn't cached + return qfalse; } -void Item_Text_AutoWrapped_Paint( itemDef_t *item ) +static qboolean UI_NextWrapLine( const char **text, float *x, float *y ) +{ + wrapCache_t *cacheEntry = &wrapCache[ cacheReadIndex ]; + + if( cacheReadLineNum >= cacheEntry->numLines ) + return qfalse; + + *text = cacheEntry->lines[ cacheReadLineNum ]; + *x = cacheEntry->lineCoords[ cacheReadLineNum ][ 0 ]; + *y = cacheEntry->lineCoords[ cacheReadLineNum ][ 1 ]; + + cacheReadLineNum++; + + return qtrue; +} + +void Item_Text_Wrapped_Paint( itemDef_t *item ) { char text[ 1024 ]; - const char *p, *textPtr, *newLinePtr; - char buff[ 1024 ]; - char lastCMod[ 2 ] = { 0, 0 }; - qboolean forwardColor = qfalse; - int width, height, len, textWidth, newLine, newLineWidth; - int skipLines, totalLines, lineNum = 0; - float y, totalY, diffY; + const char *p, *textPtr; + float x, y, w, h; vec4_t color; - int cache, i; - - textWidth = 0; - newLinePtr = NULL; if( item->text == NULL ) { @@ -3030,192 +3454,164 @@ void Item_Text_AutoWrapped_Paint( itemDef_t *item ) return; Item_TextColor( item, &color ); - Item_SetTextExtents( item, &width, &height, textPtr ); - //check if this block is cached - cache = checkCache( textPtr, &item->window.rect, width, height ); - if( cache >= 0 ) + // Check if this block is cached + if( (qboolean)DC->getCVarValue( "ui_textWrapCache" ) && + UI_CheckWrapCache( textPtr, &item->window.rect, item->textscale ) ) { - lineNum = awc[ cache ].numLines; - - for( i = 0; i < lineNum; i++ ) + while( UI_NextWrapLine( &p, &x, &y ) ) { - item->textRect.x = awc[ cache ].lineOffsets[ i ][ 0 ]; - item->textRect.y = awc[ cache ].lineOffsets[ i ][ 1 ]; - - DC->drawText( item->textRect.x, item->textRect.y, item->textscale, color, - awc[ cache ].lines[ i ], 0, 0, item->textStyle ); + DC->drawText( x, y, item->textscale, color, + p, 0, 0, item->textStyle ); } } else { - y = item->textaligny; - len = 0; - buff[ 0 ] = '\0'; - newLine = 0; - newLineWidth = 0; - p = textPtr; + char buff[ 1024 ]; + float fontHeight = DC->textEmHeight( item->textscale ); + const float lineSpacing = fontHeight * 0.4f; + float lineHeight = fontHeight + lineSpacing; + float textHeight; + int textLength; + int paintLines, totalLines, lineNum = 0; + float paintY; + int i; + + UI_CreateCacheEntry( textPtr, &item->window.rect, item->textscale ); + + x = item->window.rect.x + item->textalignx; + y = item->window.rect.y + item->textaligny; + w = item->window.rect.w - ( 2.0f * item->textalignx ); + h = item->window.rect.h - ( 2.0f * item->textaligny ); + + textPtr = Item_Text_Wrap( textPtr, item->textscale, w ); + textLength = strlen( textPtr ); + + // Count lines + totalLines = 0; + for( i = 0; i < textLength; i++ ) + { + if( textPtr[ i ] == '\n' ) + totalLines++; + } - totalLines = Item_Text_AutoWrapped_Lines( item ); + paintLines = (int)floor( ( h + lineSpacing ) / lineHeight ); + if( paintLines > totalLines ) + paintLines = totalLines; - totalY = totalLines * ( height + 5 ); - diffY = totalY - item->window.rect.h; + textHeight = ( paintLines * lineHeight ) - lineSpacing; - if( diffY > 0.0f ) - skipLines = (int)( diffY / ( (float)height + 5.0f ) ); - else - skipLines = 0; - - //set up a cache entry - strcpy( awc[ cacheIndex ].text, textPtr ); - awc[ cacheIndex ].rect.x = item->window.rect.x; - awc[ cacheIndex ].rect.y = item->window.rect.y; - awc[ cacheIndex ].rect.w = item->window.rect.w; - awc[ cacheIndex ].rect.h = item->window.rect.h; - awc[ cacheIndex ].textWidth = width; - awc[ cacheIndex ].textHeight = height; - - while( p ) + switch( item->textvalignment ) { - textWidth = DC->textWidth( buff, item->textscale, 0 ); - - if( *p == '^' ) - { - lastCMod[ 0 ] = p[ 0 ]; - lastCMod[ 1 ] = p[ 1 ]; - } + default: + case ITEM_VALIGN_BOTTOM: + paintY = y + ( h - textHeight ); + break; - if( *p == ' ' || *p == '\t' || *p == '\n' || *p == '\0' ) - { - newLine = len; - newLinePtr = p+1; - newLineWidth = textWidth; + case ITEM_VALIGN_CENTER: + paintY = y + ( ( h - textHeight ) / 2.0f ); + break; - if( *p == '\n' ) //don't forward colours past deilberate \n's - lastCMod[ 0 ] = lastCMod[ 1 ] = 0; - else - forwardColor = qtrue; - } + case ITEM_VALIGN_TOP: + paintY = y; + break; + } - // forceably split lines that are too long (where normal splitage has failed) - if( textWidth > item->window.rect.w && newLine == 0 && *p != '\n' ) - { - newLine = len; - newLinePtr = p; - newLineWidth = textWidth; + p = textPtr; + for( i = 0, lineNum = 0; i < textLength && lineNum < paintLines; i++ ) + { + int lineLength = &textPtr[ i ] - p; - forwardColor = qtrue; - } + if( lineLength >= sizeof( buff ) - 1 ) + break; - if( ( newLine && textWidth > item->window.rect.w ) || *p == '\n' || *p == '\0' ) + if( textPtr[ i ] == '\n' || textPtr[ i ] == '\0' ) { - if( len ) + itemDef_t lineItem; + int width, height; + + strncpy( buff, p, lineLength ); + buff[ lineLength ] = '\0'; + p = &textPtr[ i + 1 ]; + + lineItem.type = ITEM_TYPE_TEXT; + lineItem.textscale = item->textscale; + lineItem.textStyle = item->textStyle; + lineItem.text = buff; + lineItem.textalignment = item->textalignment; + lineItem.textvalignment = ITEM_VALIGN_TOP; + lineItem.textalignx = 0.0f; + lineItem.textaligny = 0.0f; + + lineItem.textRect.w = 0.0f; + lineItem.textRect.h = 0.0f; + lineItem.window.rect.x = x; + lineItem.window.rect.y = paintY + ( lineNum * lineHeight ); + lineItem.window.rect.w = w; + lineItem.window.rect.h = lineHeight; + lineItem.window.border = item->window.border; + lineItem.window.borderSize = item->window.borderSize; + + if( debugMode ) { - if( item->textalignment == ITEM_ALIGN_LEFT ) - item->textRect.x = item->textalignx; - else if( item->textalignment == ITEM_ALIGN_RIGHT ) - item->textRect.x = item->textalignx - newLineWidth; - else if( item->textalignment == ITEM_ALIGN_CENTER ) - item->textRect.x = item->textalignx - newLineWidth / 2; - - item->textRect.y = y; - ToWindowCoords( &item->textRect.x, &item->textRect.y, &item->window ); - // - buff[ newLine ] = '\0'; - - if( !skipLines ) - { - DC->drawText( item->textRect.x, item->textRect.y, item->textscale, color, buff, 0, 0, item->textStyle ); - - strcpy( awc[ cacheIndex ].lines[ lineNum ], buff ); - awc[ cacheIndex ].lineOffsets[ lineNum ][ 0 ] = item->textRect.x; - awc[ cacheIndex ].lineOffsets[ lineNum ][ 1 ] = item->textRect.y; - - lineNum++; - } + vec4_t color; + color[ 0 ] = color[ 2 ] = color[ 3 ] = 1.0f; + color[ 1 ] = 0.0f; + DC->drawRect( lineItem.window.rect.x, lineItem.window.rect.y, + lineItem.window.rect.w, lineItem.window.rect.h, 1, color ); } - if( *p == '\0' ) - break; - // - if( !skipLines ) - y += height + 5; - - if( skipLines ) - skipLines--; - - p = newLinePtr; - len = 0; - newLine = 0; - newLineWidth = 0; - - if( forwardColor && lastCMod[ 0 ] != 0 ) - { - buff[ len++ ] = lastCMod[ 0 ]; - buff[ len++ ] = lastCMod[ 1 ]; - buff[ len ] = '\0'; + Item_SetTextExtents( &lineItem, &width, &height, buff ); + DC->drawText( lineItem.textRect.x, lineItem.textRect.y, + lineItem.textscale, color, buff, 0, 0, + lineItem.textStyle ); + UI_AddCacheEntryLine( buff, lineItem.textRect.x, lineItem.textRect.y ); - forwardColor = qfalse; - } - - continue; + lineNum++; } - - buff[ len++ ] = *p++; - buff[ len ] = '\0'; } - //mark the end of the lines list - awc[ cacheIndex ].numLines = lineNum; - - //increment cacheIndex - cacheIndex = ( cacheIndex + 1 ) % MAX_AUTOWRAP_CACHE; + UI_FinishCacheEntry( ); } } -void Item_Text_Wrapped_Paint(itemDef_t *item) { - char text[1024]; - const char *p, *start, *textPtr; - char buff[1024]; - int width, height; - float x, y; - vec4_t color; - - // now paint the text and/or any optional images - // default to left - - if (item->text == NULL) { - if (item->cvar == NULL) { - return; - } - else { - DC->getCVarString(item->cvar, text, sizeof(text)); - textPtr = text; - } - } - else { - textPtr = item->text; - } - if (*textPtr == '\0') { - return; - } - - Item_TextColor(item, &color); - Item_SetTextExtents(item, &width, &height, textPtr); - - x = item->textRect.x; - y = item->textRect.y; - start = textPtr; - p = strchr(textPtr, '\r'); - while (p && *p) { - strncpy(buff, start, p-start+1); - buff[p-start] = '\0'; - DC->drawText(x, y, item->textscale, color, buff, 0, 0, item->textStyle); - y += height + 5; - start += p - start + 1; - p = strchr(p+1, '\r'); - } - DC->drawText(x, y, item->textscale, color, start, 0, 0, item->textStyle); +/* +============== +UI_DrawTextBlock +============== +*/ +void UI_DrawTextBlock( rectDef_t *rect, float text_x, float text_y, vec4_t color, + float scale, int textalign, int textvalign, + int textStyle, const char *text ) +{ + static menuDef_t dummyParent; + static itemDef_t textItem; + + textItem.text = text; + + textItem.parent = &dummyParent; + memcpy( textItem.window.foreColor, color, sizeof( vec4_t ) ); + textItem.window.flags = 0; + + textItem.window.rect.x = rect->x; + textItem.window.rect.y = rect->y; + textItem.window.rect.w = rect->w; + textItem.window.rect.h = rect->h; + textItem.window.border = 0; + textItem.window.borderSize = 0.0f; + textItem.textRect.x = 0.0f; + textItem.textRect.y = 0.0f; + textItem.textRect.w = 0.0f; + textItem.textRect.h = 0.0f; + textItem.textalignment = textalign; + textItem.textvalignment = textvalign; + textItem.textalignx = text_x; + textItem.textaligny = text_y; + textItem.textscale = scale; + textItem.textStyle = textStyle; + + // Utilise existing wrap code + Item_Text_Wrapped_Paint( &textItem ); } void Item_Text_Paint(itemDef_t *item) { @@ -3228,10 +3624,6 @@ void Item_Text_Paint(itemDef_t *item) { Item_Text_Wrapped_Paint(item); return; } - if (item->window.flags & WINDOW_AUTOWRAPPED) { - Item_Text_AutoWrapped_Paint(item); - return; - } if (item->text == NULL) { if (item->cvar == NULL) { @@ -3290,38 +3682,64 @@ void Item_Text_Paint(itemDef_t *item) { -//float trap_Cvar_VariableValue( const char *var_name ); -//void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize ); - -void Item_TextField_Paint(itemDef_t *item) { - char buff[1024]; - vec4_t newColor; - int offset; - menuDef_t *parent = (menuDef_t*)item->parent; - editFieldDef_t *editPtr = (editFieldDef_t*)item->typeData; - +void Item_TextField_Paint(itemDef_t *item) +{ + char buff[1024]; + vec4_t newColor; + int offset = (item->text && *item->text) ? ITEM_VALUE_OFFSET : 0; + menuDef_t *parent = (menuDef_t*)item->parent; + editFieldDef_t *editPtr = (editFieldDef_t*)item->typeData; + char cursor = DC->getOverstrikeMode() ? '|' : '_'; + qboolean editing = ( item->window.flags & WINDOW_HASFOCUS && g_editingField ); + const int cursorWidth = editing ? EDIT_CURSOR_WIDTH : 0; + + //FIXME: causes duplicate printing if item->text is not set (NULL) Item_Text_Paint(item); buff[0] = '\0'; - if (item->cvar) { + if (item->cvar) DC->getCVarString(item->cvar, buff, sizeof(buff)); + + // maxFieldWidth hasn't been set, so use the item's rect + if( editPtr->maxFieldWidth == 0 ) + { + editPtr->maxFieldWidth = item->window.rect.w - + ( item->textRect.w + offset + ( item->textRect.x - item->window.rect.x ) ); + + if( editPtr->maxFieldWidth < MIN_FIELD_WIDTH ) + editPtr->maxFieldWidth = MIN_FIELD_WIDTH; } + if( !editing ) + editPtr->paintOffset = 0; + + // Shorten string to max viewable + while( DC->textWidth( buff + editPtr->paintOffset, item->textscale, 0 ) > + ( editPtr->maxFieldWidth - cursorWidth ) && strlen( buff ) > 0 ) + buff[ strlen( buff ) - 1 ] = '\0'; + parent = (menuDef_t*)item->parent; - if (item->window.flags & WINDOW_HASFOCUS) { + if (item->window.flags & WINDOW_HASFOCUS) memcpy(newColor, &parent->focusColor, sizeof(vec4_t)); - } else { + else memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t)); - } - offset = (item->text && *item->text) ? 8 : 0; - if (item->window.flags & WINDOW_HASFOCUS && g_editingField) { - char cursor = DC->getOverstrikeMode() ? '_' : '|'; - DC->drawTextWithCursor(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale, newColor, buff + editPtr->paintOffset, item->cursorPos - editPtr->paintOffset , cursor, editPtr->maxPaintChars, item->textStyle); - } else { - DC->drawText(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale, newColor, buff + editPtr->paintOffset, 0, editPtr->maxPaintChars, item->textStyle); + if( editing ) + { + DC->drawTextWithCursor( item->textRect.x + item->textRect.w + offset, + item->textRect.y, item->textscale, newColor, + buff + editPtr->paintOffset, + item->cursorPos - editPtr->paintOffset, + cursor, editPtr->maxPaintChars, item->textStyle ); + } + else + { + DC->drawText( item->textRect.x + item->textRect.w + offset, + item->textRect.y, item->textscale, newColor, + buff + editPtr->paintOffset, 0, + editPtr->maxPaintChars, item->textStyle ); } } @@ -3329,6 +3747,7 @@ void Item_TextField_Paint(itemDef_t *item) { void Item_YesNo_Paint(itemDef_t *item) { vec4_t newColor; float value; + int offset; menuDef_t *parent = (menuDef_t*)item->parent; value = (item->cvar) ? DC->getCVarValue(item->cvar) : 0; @@ -3339,9 +3758,10 @@ void Item_YesNo_Paint(itemDef_t *item) { memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t)); } + offset = (item->text && *item->text) ? ITEM_VALUE_OFFSET : 0; if (item->text) { Item_Text_Paint(item); - DC->drawText(item->textRect.x + item->textRect.w + 8, item->textRect.y, item->textscale, newColor, (value != 0) ? "Yes" : "No", 0, 0, item->textStyle); + DC->drawText(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale, newColor, (value != 0) ? "Yes" : "No", 0, 0, item->textStyle); } else { DC->drawText(item->textRect.x, item->textRect.y, item->textscale, newColor, (value != 0) ? "Yes" : "No", 0, 0, item->textStyle); } @@ -3362,7 +3782,7 @@ void Item_Multi_Paint(itemDef_t *item) { if (item->text) { Item_Text_Paint(item); - DC->drawText(item->textRect.x + item->textRect.w + 8, item->textRect.y, item->textscale, newColor, text, 0, 0, item->textStyle); + DC->drawText(item->textRect.x + item->textRect.w + ITEM_VALUE_OFFSET, item->textRect.y, item->textscale, newColor, text, 0, 0, item->textStyle); } else { DC->drawText(item->textRect.x, item->textRect.y, item->textscale, newColor, text, 0, 0, item->textStyle); } @@ -3614,6 +4034,7 @@ void Item_Slider_Paint(itemDef_t *item) { vec4_t newColor; float x, y, value; menuDef_t *parent = (menuDef_t*)item->parent; + float vScale = Item_Slider_VScale( item ); value = (item->cvar) ? DC->getCVarValue(item->cvar) : 0; @@ -3623,18 +4044,25 @@ void Item_Slider_Paint(itemDef_t *item) { memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t)); } - y = item->window.rect.y; if (item->text) { Item_Text_Paint(item); - x = item->textRect.x + item->textRect.w + 8; + x = item->textRect.x + item->textRect.w + ITEM_VALUE_OFFSET; + y = item->textRect.y - item->textRect.h + + ( ( item->textRect.h - ( SLIDER_HEIGHT * vScale ) ) / 2.0f ); } else { x = item->window.rect.x; + y = item->window.rect.y; } + DC->setColor(newColor); - DC->drawHandlePic( x, y, SLIDER_WIDTH, SLIDER_HEIGHT, DC->Assets.sliderBar ); + DC->drawHandlePic( x, y, SLIDER_WIDTH, SLIDER_HEIGHT * vScale, DC->Assets.sliderBar ); + + y = item->textRect.y - item->textRect.h + + ( ( item->textRect.h - ( SLIDER_THUMB_HEIGHT * vScale ) ) / 2.0f ); x = Item_Slider_ThumbPosition(item); - DC->drawHandlePic( x - (SLIDER_THUMB_WIDTH / 2), y - 2, SLIDER_THUMB_WIDTH, SLIDER_THUMB_HEIGHT, DC->Assets.sliderThumb ); + DC->drawHandlePic( x - (SLIDER_THUMB_WIDTH / 2), y, + SLIDER_THUMB_WIDTH, SLIDER_THUMB_HEIGHT * vScale, DC->Assets.sliderThumb ); } @@ -3671,7 +4099,7 @@ void Item_Bind_Paint(itemDef_t *item) { if (item->text) { Item_Text_Paint(item); BindingFromName(item->cvar); - DC->drawText(item->textRect.x + item->textRect.w + 8, item->textRect.y, item->textscale, newColor, g_nameBind1, 0, maxChars, item->textStyle); + DC->drawText(item->textRect.x + item->textRect.w + ITEM_VALUE_OFFSET, item->textRect.y, item->textscale, newColor, g_nameBind1, 0, maxChars, item->textStyle); } else { DC->drawText(item->textRect.x, item->textRect.y, item->textscale, newColor, (value != 0) ? "FIXME" : "FIXME", 0, maxChars, item->textStyle); } @@ -3891,24 +4319,28 @@ void Item_ListBox_Paint(itemDef_t *item) { count = DC->feederCount(item->special); // default is vertical if horizontal flag is not here if (item->window.flags & WINDOW_HORIZONTAL) { - // draw scrollbar in bottom of the window - // bar - x = item->window.rect.x + 1; - y = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE - 1; - DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowLeft); - x += SCROLLBAR_SIZE - 1; - size = item->window.rect.w - (SCROLLBAR_SIZE * 2); - DC->drawHandlePic(x, y, size+1, SCROLLBAR_SIZE, DC->Assets.scrollBar); - x += size - 1; - DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowRight); - // thumb - thumb = Item_ListBox_ThumbDrawPosition(item);//Item_ListBox_ThumbPosition(item); - if (thumb > x - SCROLLBAR_SIZE - 1) { - thumb = x - SCROLLBAR_SIZE - 1; - } - DC->drawHandlePic(thumb, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarThumb); - // - listPtr->endPos = listPtr->startPos; + if( !listPtr->notselectable ) + { + // draw scrollbar in bottom of the window + // bar + x = item->window.rect.x + 1; + y = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE - 1; + DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowLeft); + x += SCROLLBAR_SIZE - 1; + size = item->window.rect.w - (SCROLLBAR_SIZE * 2); + DC->drawHandlePic(x, y, size+1, SCROLLBAR_SIZE, DC->Assets.scrollBar); + x += size - 1; + DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowRight); + // thumb + thumb = Item_ListBox_ThumbDrawPosition(item);//Item_ListBox_ThumbPosition(item); + if (thumb > x - SCROLLBAR_SIZE - 1) { + thumb = x - SCROLLBAR_SIZE - 1; + } + DC->drawHandlePic(thumb, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarThumb); + // + listPtr->endPos = listPtr->startPos; + } + size = item->window.rect.w - 2; // items // size contains max available space @@ -3941,23 +4373,26 @@ void Item_ListBox_Paint(itemDef_t *item) { // } } else { - // draw scrollbar to right side of the window - x = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE - 1; - y = item->window.rect.y + 1; - DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowUp); - y += SCROLLBAR_SIZE - 1; - - listPtr->endPos = listPtr->startPos; - size = item->window.rect.h - (SCROLLBAR_SIZE * 2); - DC->drawHandlePic(x, y, SCROLLBAR_SIZE, size+1, DC->Assets.scrollBar); - y += size - 1; - DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowDown); - // thumb - thumb = Item_ListBox_ThumbDrawPosition(item);//Item_ListBox_ThumbPosition(item); - if (thumb > y - SCROLLBAR_SIZE - 1) { - thumb = y - SCROLLBAR_SIZE - 1; - } - DC->drawHandlePic(x, thumb, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarThumb); + if( !listPtr->notselectable ) + { + // draw scrollbar to right side of the window + x = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE - 1; + y = item->window.rect.y + 1; + DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowUp); + y += SCROLLBAR_SIZE - 1; + + listPtr->endPos = listPtr->startPos; + size = item->window.rect.h - (SCROLLBAR_SIZE * 2); + DC->drawHandlePic(x, y, SCROLLBAR_SIZE, size+1, DC->Assets.scrollBar); + y += size - 1; + DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowDown); + // thumb + thumb = Item_ListBox_ThumbDrawPosition(item);//Item_ListBox_ThumbPosition(item); + if (thumb > y - SCROLLBAR_SIZE - 1) { + thumb = y - SCROLLBAR_SIZE - 1; + } + DC->drawHandlePic(x, thumb, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarThumb); + } // adjust size for item painting size = item->window.rect.h - 2; @@ -3987,6 +4422,7 @@ void Item_ListBox_Paint(itemDef_t *item) { // fit++; } } else { + float m = DC->textEmHeight( item->textscale ); x = item->window.rect.x + 1; y = item->window.rect.y + 1; for (i = listPtr->startPos; i < count; i++) { @@ -3999,14 +4435,16 @@ void Item_ListBox_Paint(itemDef_t *item) { for (j = 0; j < listPtr->numColumns; j++) { Q_strncpyz( text, DC->feederItemText(item->special, i, j, &optionalImage), sizeof( text ) ); if (optionalImage >= 0) { - DC->drawHandlePic(x + 4 + listPtr->columnInfo[j].pos, y - 1 + listPtr->elementHeight / 2, listPtr->columnInfo[j].width, listPtr->columnInfo[j].width, optionalImage); + DC->drawHandlePic(x + 4 + listPtr->columnInfo[j].pos, + y + ( ( listPtr->elementHeight - listPtr->columnInfo[ j ].width ) / 2.0f ), + listPtr->columnInfo[j].width, listPtr->columnInfo[j].width, optionalImage); } else if (text) { int alignOffset = 0.0f, tw; tw = DC->textWidth( text, item->textscale, 0 ); // Shorten the string if it's too long - while( tw > listPtr->columnInfo[ j ].width ) + while( tw > listPtr->columnInfo[ j ].width && strlen( text ) > 0 ) { text[ strlen( text ) - 1 ] = '\0'; tw = DC->textWidth( text, item->textscale, 0 ); @@ -4030,7 +4468,8 @@ void Item_ListBox_Paint(itemDef_t *item) { alignOffset = 0.0f; } - DC->drawText( x + 4 + listPtr->columnInfo[j].pos + alignOffset, y + listPtr->elementHeight, + DC->drawText( x + 4 + listPtr->columnInfo[j].pos + alignOffset, + y + m + ( ( listPtr->elementHeight - m ) / 2.0f ), item->textscale, item->window.foreColor, text, 0, 0, item->textStyle ); } @@ -4038,14 +4477,17 @@ void Item_ListBox_Paint(itemDef_t *item) { } else { Q_strncpyz( text, DC->feederItemText(item->special, i, 0, &optionalImage), sizeof( text ) ); if (optionalImage >= 0) { - //DC->drawHandlePic(x + 4 + listPtr->elementHeight, y, listPtr->columnInfo[j].width, listPtr->columnInfo[j].width, optionalImage); + DC->drawHandlePic(x + 4, y, listPtr->elementHeight, listPtr->elementHeight, optionalImage); } else if (text) { - DC->drawText(x + 4, y + listPtr->elementHeight, item->textscale, item->window.foreColor, text, 0, 0, item->textStyle); + DC->drawText( x + 4, y + m + ( ( listPtr->elementHeight - m ) / 2.0f ), + item->textscale, item->window.foreColor, text, 0, + 0, item->textStyle ); } } if (i == item->cursorPos) { - DC->fillRect(x + 2, y + 2, item->window.rect.w - SCROLLBAR_SIZE - 4, listPtr->elementHeight, item->window.outlineColor); + DC->fillRect( x, y, item->window.rect.w - SCROLLBAR_SIZE - ( 2 * item->window.borderSize ), + listPtr->elementHeight, item->window.outlineColor); } listPtr->endPos++; @@ -4067,6 +4509,7 @@ void Item_ListBox_Paint(itemDef_t *item) { void Item_OwnerDraw_Paint(itemDef_t *item) { menuDef_t *parent; + const char *text; if (item == NULL) { return; @@ -4104,16 +4547,26 @@ void Item_OwnerDraw_Paint(itemDef_t *item) { Com_Memcpy(color, parent->disableColor, sizeof(vec4_t)); } - if (item->text) { - Item_Text_Paint(item); - if (item->text[0]) { - // +8 is an offset kludge to properly align owner draw items that have text combined with them - DC->ownerDrawItem(item->textRect.x + item->textRect.w + 8, item->window.rect.y, item->window.rect.w, item->window.rect.h, 0, item->textaligny, item->window.ownerDraw, item->window.ownerDrawFlags, item->alignment, item->special, item->textscale, color, item->window.background, item->textStyle ); - } else { - DC->ownerDrawItem(item->textRect.x + item->textRect.w, item->window.rect.y, item->window.rect.w, item->window.rect.h, 0, item->textaligny, item->window.ownerDraw, item->window.ownerDrawFlags, item->alignment, item->special, item->textscale, color, item->window.background, item->textStyle ); - } + if( DC->ownerDrawText && ( text = DC->ownerDrawText( item->window.ownerDraw ) ) ) { + if (item->text && *item->text) { + Item_Text_Paint(item); + + DC->drawText(item->textRect.x + item->textRect.w + ITEM_VALUE_OFFSET, + item->textRect.y, item->textscale, + color, text, 0, 0, item->textStyle); } else { - DC->ownerDrawItem(item->window.rect.x, item->window.rect.y, item->window.rect.w, item->window.rect.h, item->textalignx, item->textaligny, item->window.ownerDraw, item->window.ownerDrawFlags, item->alignment, item->special, item->textscale, color, item->window.background, item->textStyle ); + item->text = text; + Item_Text_Paint(item); + item->text = NULL; + } + } else { + DC->ownerDrawItem(item->window.rect.x, item->window.rect.y, + item->window.rect.w, item->window.rect.h, + item->textalignx, item->textaligny, + item->window.ownerDraw, item->window.ownerDrawFlags, + item->alignment, item->textalignment, item->textvalignment, + item->special, item->textscale, color, + item->window.background, item->textStyle ); } } } @@ -4255,7 +4708,6 @@ void Item_Paint(itemDef_t *item) { return; } - // paint the rect first.. Window_Paint(&item->window, parent->fadeAmount , parent->fadeClamp, parent->fadeCycle); if (debugMode) { @@ -4266,8 +4718,6 @@ void Item_Paint(itemDef_t *item) { DC->drawRect(r->x, r->y, r->w, r->h, 1, color); } - //DC->drawRect(item->window.rect.x, item->window.rect.y, item->window.rect.w, item->window.rect.h, 1, red); - switch (item->type) { case ITEM_TYPE_OWNERDRAW: Item_OwnerDraw_Paint(item); @@ -4311,6 +4761,7 @@ void Item_Paint(itemDef_t *item) { break; } + Border_Paint(&item->window); } void Menu_Init(menuDef_t *menu) { @@ -4521,13 +4972,11 @@ void Menu_Paint(menuDef_t *menu, qboolean forcePaint) { // implies a background shader // FIXME: make sure we have a default shader if fullscreen is set with no background DC->drawHandlePic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, menu->window.background ); - } else if (menu->window.background) { - // this allows a background shader without being full screen - //UI_DrawHandlePic(menu->window.rect.x, menu->window.rect.y, menu->window.rect.w, menu->window.rect.h, menu->backgroundShader); } // paint the background and or border Window_Paint(&menu->window, menu->fadeAmount, menu->fadeClamp, menu->fadeCycle ); + Border_Paint(&menu->window); for (i = 0; i < menu->itemCount; i++) { Item_Paint(menu->items[i]); @@ -4788,18 +5237,12 @@ qboolean ItemParse_notselectable( itemDef_t *item, int handle ) { return qtrue; } -// manually wrapped +// auto wrapped qboolean ItemParse_wrapped( itemDef_t *item, int handle ) { item->window.flags |= WINDOW_WRAPPED; return qtrue; } -// auto wrapped -qboolean ItemParse_autowrapped( itemDef_t *item, int handle ) { - item->window.flags |= WINDOW_AUTOWRAPPED; - return qtrue; -} - // horizontalscroll qboolean ItemParse_horizontalscroll( itemDef_t *item, int handle ) { @@ -4947,6 +5390,13 @@ qboolean ItemParse_textalign( itemDef_t *item, int handle ) { return qtrue; } +qboolean ItemParse_textvalign( itemDef_t *item, int handle ) { + if (!PC_Int_Parse(handle, &item->textvalignment)) { + return qfalse; + } + return qtrue; +} + qboolean ItemParse_textalignx( itemDef_t *item, int handle ) { if (!PC_Float_Parse(handle, &item->textalignx)) { return qfalse; @@ -5166,6 +5616,27 @@ qboolean ItemParse_maxPaintChars( itemDef_t *item, int handle ) { return qtrue; } +qboolean ItemParse_maxFieldWidth( itemDef_t *item, int handle ) { + editFieldDef_t *editPtr; + int maxFieldWidth; + + Item_ValidateTypeData(item); + if (!item->typeData) + return qfalse; + + if (!PC_Int_Parse(handle, &maxFieldWidth)) { + return qfalse; + } + editPtr = (editFieldDef_t*)item->typeData; + + if( maxFieldWidth < MIN_FIELD_WIDTH ) + editPtr->maxFieldWidth = MIN_FIELD_WIDTH; + else + editPtr->maxFieldWidth = maxFieldWidth; + + return qtrue; +} + qboolean ItemParse_cvarFloat( itemDef_t *item, int handle ) { @@ -5353,7 +5824,6 @@ keywordHash_t itemParseKeywords[] = { {"decoration", ItemParse_decoration, NULL}, {"notselectable", ItemParse_notselectable, NULL}, {"wrapped", ItemParse_wrapped, NULL}, - {"autowrapped", ItemParse_autowrapped, NULL}, {"horizontalscroll", ItemParse_horizontalscroll, NULL}, {"type", ItemParse_type, NULL}, {"elementwidth", ItemParse_elementwidth, NULL}, @@ -5367,6 +5837,7 @@ keywordHash_t itemParseKeywords[] = { {"ownerdraw", ItemParse_ownerdraw, NULL}, {"align", ItemParse_align, NULL}, {"textalign", ItemParse_textalign, NULL}, + {"textvalign", ItemParse_textvalign, NULL}, {"textalignx", ItemParse_textalignx, NULL}, {"textaligny", ItemParse_textaligny, NULL}, {"textscale", ItemParse_textscale, NULL}, @@ -5387,6 +5858,7 @@ keywordHash_t itemParseKeywords[] = { {"cvar", ItemParse_cvar, NULL}, {"maxChars", ItemParse_maxChars, NULL}, {"maxPaintChars", ItemParse_maxPaintChars, NULL}, + {"maxFieldWidth", ItemParse_maxFieldWidth, NULL}, {"focusSound", ItemParse_focusSound, NULL}, {"cvarFloat", ItemParse_cvarFloat, NULL}, {"cvarStrList", ItemParse_cvarStrList, NULL}, @@ -5885,8 +6357,12 @@ int Menu_Count( void ) { void Menu_PaintAll( void ) { int i; - if (captureFunc) { - captureFunc(captureData); + if ( captureFunc != voidFunction ) { + if( captureFuncExpiry > 0 && DC->realTime > captureFuncExpiry ) { + UI_RemoveCaptureFunc( ); + } else { + captureFunc(captureData); + } } for (i = 0; i < Menu_Count(); i++) { diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h index 2fd396d0..28b24482 100644 --- a/src/ui/ui_shared.h +++ b/src/ui/ui_shared.h @@ -59,8 +59,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define WINDOW_LB_PGDN 0x00008000 // mouse is over page down #define WINDOW_ORBITING 0x00010000 // item is in orbit #define WINDOW_OOB_CLICK 0x00020000 // close on out of bounds click -#define WINDOW_WRAPPED 0x00040000 // manually wrap text -#define WINDOW_AUTOWRAPPED 0x00080000 // auto wrap text +#define WINDOW_WRAPPED 0x00080000 // wrap text #define WINDOW_FORCED 0x00100000 // forced open #define WINDOW_POPUP 0x00200000 // popup #define WINDOW_BACKCOLORSET 0x00400000 // backcolor was explicitly set @@ -81,6 +80,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define MAX_SCRIPT_ARGS 12 #define MAX_EDITFIELD 256 +#define ITEM_VALUE_OFFSET 8 #define ART_FX_BASE "menu/art/fx_base" #define ART_FX_BLUE "menu/art/fx_blue" @@ -105,7 +105,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define SLIDER_HEIGHT 16.0 #define SLIDER_THUMB_WIDTH 12.0 #define SLIDER_THUMB_HEIGHT 20.0 -#define NUM_CROSSHAIRS 10 +#define NUM_CROSSHAIRS 10 typedef struct { const char *command; @@ -194,6 +194,7 @@ typedef struct editFieldDef_s { float range; // int maxChars; // for edit fields int maxPaintChars; // for edit fields + int maxFieldWidth; // for edit fields int paintOffset; // } editFieldDef_t; @@ -226,6 +227,7 @@ typedef struct itemDef_s { int type; // text, button, radiobutton, checkbox, textfield, listbox, combo int alignment; // left center right int textalignment; // ( optional ) alignment for text within rect based on text width + int textvalignment; // ( optional ) alignment for text within rect based on text width float textalignx; // ( optional ) text alignment x coord float textaligny; // ( optional ) text alignment x coord float textscale; // scale percentage from 72pts @@ -318,8 +320,10 @@ typedef struct { void (*drawHandlePic) (float x, float y, float w, float h, qhandle_t asset); void (*drawStretchPic) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ); void (*drawText) (float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style ); - int (*textWidth) (const char *text, float scale, int limit); - int (*textHeight) (const char *text, float scale, int limit); + float (*textWidth) (const char *text, float scale, int limit); + float (*textHeight) (const char *text, float scale, int limit); + float (*textEmWidth) (float scale); + float (*textEmHeight) (float scale); qhandle_t (*registerModel) (const char *p); void (*modelBounds) (qhandle_t model, vec3_t min, vec3_t max); void (*fillRect) ( float x, float y, float w, float h, const vec4_t color); @@ -330,7 +334,7 @@ typedef struct { void (*addRefEntityToScene) (const refEntity_t *re ); void (*renderScene) ( const refdef_t *fd ); void (*registerFont) (const char *pFontname, int pointSize, fontInfo_t *font); - void (*ownerDrawItem) (float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, int align, float special, float scale, vec4_t color, qhandle_t shader, int textStyle); + 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 color, qhandle_t shader, int textStyle); float (*getValue) (int ownerDraw); qboolean (*ownerDrawVisible) (int flags); void (*runScript)(char **p); @@ -355,6 +359,7 @@ typedef struct { void (*Print)(const char *msg, ...); void (*Pause)(qboolean b); int (*ownerDrawWidth)(int ownerDraw, float scale); + const char *(*ownerDrawText)(int ownerDraw); sfxHandle_t (*registerSound)(const char *name, qboolean compressed); void (*startBackgroundTrack)( const char *intro, const char *loop); void (*stopBackgroundTrack)( void ); @@ -428,6 +433,11 @@ void Menu_Paint(menuDef_t *menu, qboolean forcePaint); void Menu_SetFeederSelection(menuDef_t *menu, int feeder, int index, const char *name); void Display_CacheAll( void ); +typedef void (CaptureFunc) (void *p); + +void UI_InstallCaptureFunc( CaptureFunc *f, void *data, int timeout ); +void UI_RemoveCaptureFunc( void ); + void *UI_Alloc( int size ); void UI_InitMemory( void ); qboolean UI_OutOfMemory( void ); @@ -437,7 +447,10 @@ void Controls_SetConfig(qboolean restart); void Controls_SetDefaults( void ); //for cg_draw.c -void Item_Text_AutoWrapped_Paint( itemDef_t *item ); +void Item_Text_Wrapped_Paint( itemDef_t *item ); +void UI_DrawTextBlock( rectDef_t *rect, float text_x, float text_y, vec4_t color, + float scale, int textalign, int textvalign, + int textStyle, const char *text ); int trap_Parse_AddGlobalDefine( char *define ); int trap_Parse_LoadSource( const char *filename ); diff --git a/ui/assets/alien/buildstat.cfg b/ui/assets/alien/buildstat.cfg index 11143022..318d401d 100644 --- a/ui/assets/alien/buildstat.cfg +++ b/ui/assets/alien/buildstat.cfg @@ -8,7 +8,7 @@ frameShader "ui/assets/alien/buildstat/frame" frameWidth 150 frameHeight 30 -healthPadding 2 +healthPadding 2 healthSevereColor 0.24 0.02 0.02 1 healthHighColor 0.32 0.04 0.04 1 healthElevatedColor 0.40 0.06 0.06 1 @@ -20,12 +20,12 @@ overlayShader "ui/assets/alien/buildstat/overlay" overlayWidth 156 overlayHeight 36 -// PERCENT of frameHeight to use for top/bottom margin of icons/text +// PERCENT of frameHeight to use for top/bottom margin of icons/text // value is for total of top and bottom margins // valid values between 0.0 and 1.0 verticalMargin 0.5 -// number of CHARS worth of space that should be used for left/right margins +// number of CHARS worth of space that should be used for left/right margins // value is for one side only // char width is determined by frameHeight and verticalMargin horizontalMargin 1.0 diff --git a/ui/assets/human/buildstat.cfg b/ui/assets/human/buildstat.cfg index 9c192de9..c66b618d 100644 --- a/ui/assets/human/buildstat.cfg +++ b/ui/assets/human/buildstat.cfg @@ -8,7 +8,7 @@ frameShader "ui/assets/human/buildstat/frame" frameWidth 150 frameHeight 30 -healthPadding 2 +healthPadding 2 // Homeworld Security Advisory System healthSevereColor 0.83 0.03 0.02 1 @@ -22,12 +22,12 @@ overlayShader "" overlayWidth 160 overlayHeight 40 -// PERCENT of frameHeight to use for top/bottom margin of icons/text +// PERCENT of frameHeight to use for top/bottom margin of icons/text // value is for total of top and bottom margins // valid values between 0.0 and 1.0 verticalMargin 0.5 -// number of CHARS worth of space that should be used for left/right margins +// number of CHARS worth of space that should be used for left/right margins // value is for one side only // char width is determined by frameHeight and verticalMargin horizontalMargin 1.0 diff --git a/ui/createfavorite.menu b/ui/createfavorite.menu index 2457ec77..cc3c2c8f 100644 --- a/ui/createfavorite.menu +++ b/ui/createfavorite.menu @@ -1,31 +1,37 @@ #include "ui/menudef.h" { -\\ CREATE FAVORITE POPUP MENU \\ + \\ CREATE FAVORITE POPUP MENU \\ + +#define BUTT_W 45 +#define BUTT_H 35 +#define BORDER 10 +#define INPUT_H 20 +#define W 250 +#define H ((3*BORDER)+(2*INPUT_H)+BUTT_H) menuDef { name "createfavorite_popmenu" - visible 0 - fullscreen 0 - rect 204 122 235 235 + visible MENU_FALSE + fullscreen MENU_FALSE + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 - border 1 + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_FULL popup onESC { - close createfavorite_popmenu; - open joinserver + close createfavorite_popmenu } itemDef { name window - rect 47 47 144 144 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL @@ -33,96 +39,76 @@ borderColor 0.5 0.5 0.5 1 } - // ENTER NAME AND ADDRESS // - - itemDef - { - name name - text "Name" - style 0 - decoration - textscale .3 - rect 0 61 110 20 - textalign 1 - textalignx 117 - textaligny 16 - forecolor 1 1 1 1 - visible 1 - } - + // ENTER NAME AND ADDRESS // + itemDef { name nameEntry - style 1 - maxchars 15 - text "" - textscale .25 - TYPE 4 + style WINDOW_STYLE_EMPTY + maxchars 40 + text "Name:" + textscale .4 + type ITEM_TYPE_EDITFIELD cvar "ui_favoriteName" - rect 60 81 120 20 - textalign 0 - textalignx 10 - textaligny 16 + rect BORDER BORDER (W-(2*BORDER)) INPUT_H + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - backcolor .2 .2 .2 .5 - visible 1 + visible MENU_TRUE } itemDef { - name address - text "IP Address" - style 0 - decoration - textscale .3 - rect 0 111 110 20 - textalign 1 - textalignx 117 - textaligny 16 + name addressEntry + style WINDOW_STYLE_EMPTY + maxchars 40 + text "Address:" + textscale .4 + type ITEM_TYPE_EDITFIELD + cvar "ui_favoriteAddress" + rect BORDER ((2*BORDER)+INPUT_H) (W-(2*BORDER)) INPUT_H + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } - + itemDef { - name addressEntry - style 1 - maxchars 20 - maxPaintChars 12 - text "" + name yes + text "OK" + type ITEM_TYPE_BUTTON textscale .25 - TYPE 4 - maxchars 21 - cvar "ui_favoriteAddress" - rect 60 131 120 20 - textalign 0 - textalignx 10 - textaligny 16 + style WINDOW_STYLE_EMPTY + rect (W-(2*BUTT_W)) (H-BUTT_H) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - backcolor .2 .2 .2 .5 - visible 1 + visible MENU_TRUE + action + { + play "sound/misc/menu1.wav"; + uiScript CreateFavorite; + close createfavorite_popmenu + } } itemDef { name yes - text "Ok" - type 1 + text "Cancel" + type ITEM_TYPE_BUTTON textscale .25 style WINDOW_STYLE_EMPTY - rect 103 158 30 26 - textalign 1 - textalignx 15 - textaligny 20 + rect (W-BUTT_W) (H-BUTT_H) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - backcolor .37 .1 .1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; - uiScript CreateFavorite; - close createfavorite_popmenu; - open joinserver + close createfavorite_popmenu } } } diff --git a/ui/createserver.menu b/ui/createserver.menu index f13bafc0..4c13f13e 100644 --- a/ui/createserver.menu +++ b/ui/createserver.menu @@ -3,16 +3,45 @@ { \\ Server Creation \\ +#define W 640 +#define H 480 +#define BORDER 10 + +#define PREVIEW_W 300 +#define PREVIEW_H 225 +#define PREVIEW_X BORDER +#define PREVIEW_Y BORDER + +#define BC_W (W-(2*BORDER)) +#define BC_H 50 +#define BC_X BORDER +#define BC_Y (H-(BC_H+BORDER)) +#define ARROW_W 50 +#define ARROW_H BC_H + +#define MAPS_W PREVIEW_W +#define MAPS_H (H-((4*BORDER)+PREVIEW_H+BC_H)) +#define MAPS_X BORDER +#define MAPS_Y ((2*BORDER)+PREVIEW_H) + +#define OPTIONS_W (W-((3*BORDER)+PREVIEW_W)) +#define OPTIONS_H (H-((3*BORDER)+BC_H)) +#define OPTIONS_X ((2*BORDER)+PREVIEW_W) +#define OPTIONS_Y BORDER +#define ELEM_OFF_Y 20 +#define ELEM_OFF_X -135 +#define ELEM_H 21 + menuDef { name "createserver" - visible 0 - fullscreen 1 - rect 0 0 640 480 + visible MENU_FALSE + fullscreen MENU_TRUE + rect 0 0 W H focusColor 1 .75 0 1 - outOfBoundsClick - style 0 - + outOfBoundsClick + style WINDOW_STYLE_EMPTY + onOpen { uiScript loadArenas; @@ -21,45 +50,19 @@ hide back_alt; show back } - + onEsc { close createserver } - + itemDef { name background - rect 0 0 640 480 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 - decoration - } - - itemDef - { - name window - rect 2 2 330 418 - style WINDOW_STYLE_FILLED - border 1 - bordercolor 1 1 1 .25 - forecolor 1 1 1 1 - backcolor 0 0 0 .25 - visible 1 - decoration - } - - itemDef - { - name window - rect 334 2 302 418 - style WINDOW_STYLE_FILLED - border 1 - bordercolor 1 1 1 .25 - forecolor 1 1 1 1 - backcolor 0 0 0 .25 - visible 1 + visible MENU_TRUE decoration } @@ -68,28 +71,18 @@ itemDef { name mappreview - style 0 + style WINDOW_STYLE_EMPTY ownerdraw UI_STARTMAPCINEMATIC - rect 7 7 320 240 - border 1 - bordercolor .5 .5 .5 .5 - visible 1 - } - - itemDef - { - name mappreview - style WINDOW_STYLE_FILLED - rect 6 6 322 242 - border 1 - bordercolor .5 .5 .5 .5 - visible 1 + rect PREVIEW_X PREVIEW_Y PREVIEW_W PREVIEW_H + border WINDOW_BORDER_FULL + bordercolor .5 .5 .5 1 + visible MENU_TRUE } itemDef { name maplist - rect 6 252 322 164 + rect MAPS_X MAPS_Y MAPS_W MAPS_H type ITEM_TYPE_LISTBOX style WINDOW_STYLE_EMPTY elementwidth 120 @@ -97,14 +90,12 @@ textscale .33 elementtype LISTBOX_TEXT feeder FEEDER_ALLMAPS - textalign 3 - textaligny 14 - border 1 + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 1 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE columns 1 2 190 ITEM_ALIGN_LEFT } @@ -112,74 +103,81 @@ // SETTINGS // - // NORMAL // + itemDef + { + name window + rect OPTIONS_X OPTIONS_Y OPTIONS_W OPTIONS_H + style WINDOW_STYLE_FILLED + backcolor 0 0 0 1 + visible MENU_TRUE + decoration + + border WINDOW_BORDER_FULL + borderSize 1.0 + borderColor 0.5 0.5 0.5 1 + } itemDef { name expert - group grpsettings type ITEM_TYPE_EDITFIELD text "Host Name:" cvar "sv_hostname" - maxChars 32 - maxPaintChars 20 - rect 420 30 128 20 + maxChars 40 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(0*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 65 - textaligny 12 - textscale .36 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } - + itemDef { name normal - group grpsettings type ITEM_TYPE_NUMERICFIELD text "Time Limit:" cvar "timelimit" - rect 420 50 128 20 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(1*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 65 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X maxchars 4 - textaligny 12 - textscale .36 + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } itemDef { name expert - group grpsettings type ITEM_TYPE_NUMERICFIELD text "Maximum Players:" cvar "sv_maxclients" - rect 420 70 128 20 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(2*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 65 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X maxchars 4 - textaligny 12 - textscale .36 + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } itemDef { name expert - group grpsettings type ITEM_TYPE_YESNO text "Require Password:" cvar "g_needpassword" - rect 420 90 128 20 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(3*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 65 - textaligny 12 - textscale .36 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav" @@ -189,19 +187,17 @@ itemDef { name expert - group grpsettings - type 4 + type ITEM_TYPE_EDITFIELD text "Password:" cvar "g_password" - rect 420 110 128 20 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(4*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H maxchars 10 - maxPaintChars 10 textalign ITEM_ALIGN_RIGHT - textalignx 65 - textaligny 12 - textscale .36 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } @@ -209,17 +205,16 @@ itemDef { name normal - group grpsettings type ITEM_TYPE_YESNO text "Pure Server:" cvar "sv_pure" - rect 420 160 128 20 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(6*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 65 - textaligny 12 - textscale .36 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav" @@ -229,20 +224,19 @@ itemDef { name normal - group grpsettings type ITEM_TYPE_MULTI text "Dedicated:" // dedicated is a special cvar in that as soon as it is set, // the game goes to console only so the ui catches this one specifically cvar "ui_dedicated" cvarFloatList { "No" 0 "LAN" 1 "Internet" 2 } - rect 420 180 128 20 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(7*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 65 - textaligny 12 - textscale .36 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav" @@ -252,17 +246,16 @@ itemDef { name expert - group grpsettings type ITEM_TYPE_YESNO text "Auto Download:" cvar "sv_allowdownload" - rect 420 200 128 20 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(8*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 65 - textaligny 12 - textscale .36 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav" @@ -272,17 +265,16 @@ itemDef { name expert - group grpsettings type ITEM_TYPE_YESNO text "Enable Voting:" cvar "g_allowvote" - rect 420 220 128 20 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(9*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 65 - textaligny 12 - textscale .36 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav" @@ -294,51 +286,48 @@ itemDef { name expert - group grpsettings type ITEM_TYPE_NUMERICFIELD text "Minimum Ping:" cvar "sv_minping" - rect 420 270 128 20 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(11*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 65 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X maxchars 4 - textaligny 12 - textscale .36 + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } itemDef { name expert - group grpsettings type ITEM_TYPE_NUMERICFIELD text "Maximum Ping:" cvar "sv_maxping" - rect 420 290 128 20 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(12*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 65 - textaligny 12 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X maxchars 4 - textscale .36 + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } itemDef { name expert - group grpsettings type ITEM_TYPE_YESNO text "Synchronous Client:" cvar "g_synchronousclients" - rect 420 310 128 20 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(13*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 65 - textaligny 12 - textscale .36 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav" @@ -348,56 +337,50 @@ itemDef { name expert - group grpsettings type ITEM_TYPE_NUMERICFIELD text "Max Rate:" cvar "sv_maxrate" - rect 420 330 128 20 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(14*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 65 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X maxchars 4 - textaligny 12 - textscale .36 + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } itemDef { name expert - group grpsettings type ITEM_TYPE_NUMERICFIELD text "Zombie Time:" cvar "sv_zombietime" - rect 420 350 128 20 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(15*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H maxchars 4 textalign ITEM_ALIGN_RIGHT - textalignx 65 - textaligny 12 - textscale .36 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } itemDef { name expert - group grpsettings type ITEM_TYPE_NUMERICFIELD text "Reconnect Limit:" cvar "sv_reconnectlimit" maxchars 4 - rect 420 370 128 20 + rect (OPTIONS_X+BORDER) (OPTIONS_Y+ELEM_OFF_Y+(16*ELEM_H)) (OPTIONS_W-(2*BORDER)) ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 65 - textaligny 12 - textscale .36 + textvalign ITEM_VALIGN_CENTER + textalignx ELEM_OFF_X + textscale .36 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } - - - @@ -406,16 +389,16 @@ itemDef { name back - style 3 + style WINDOW_STYLE_SHADER background "ui/assets/backarrow.tga" - rect 16 424 50 50 - visible 1 + rect BC_X BC_Y ARROW_H ARROW_W + visible MENU_TRUE action { - play "sound/misc/menu4.wav"; + play "sound/misc/menu4.wav"; close createserver } - + mouseEnter { hide back; @@ -428,29 +411,29 @@ name back_alt style WINDOW_STYLE_SHADER background "ui/assets/backarrow_alt.tga" - rect 16 424 50 50 + rect BC_X BC_Y ARROW_H ARROW_W backcolor 0 0 0 0 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE type ITEM_TYPE_BUTTON - + text "Back" textalign ITEM_ALIGN_LEFT - textaligny 36 - textalignx 60 + textvalign ITEM_VALIGN_CENTER + textalignx ARROW_W textscale .6 - + mouseExit { hide back_alt; show back } - + action { - play "sound/misc/menu4.wav"; + play "sound/misc/menu4.wav"; close createserver - } + } } @@ -459,22 +442,21 @@ itemDef { name accept - style 3 - rect 574 424 50 50 + style WINDOW_STYLE_SHADER + rect ((BC_X+BC_W)-ARROW_W) BC_Y ARROW_H ARROW_W background "ui/assets/forwardarrow.tga" backcolor 0 0 0 0 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE mouseEnter { hide accept; show accept_alt } - + action { - play "sound/misc/menu1.wav"; - close fight; //TA: no i don't know + play "sound/misc/menu1.wav"; uiScript StartServer } } @@ -483,30 +465,29 @@ { name accept_alt style WINDOW_STYLE_SHADER - rect 574 424 50 50 + rect ((BC_X+BC_W)-ARROW_W) BC_Y ARROW_H ARROW_W background "ui/assets/forwardarrow_alt.tga" backcolor 0 0 0 0 type ITEM_TYPE_BUTTON forecolor 1 1 1 1 - visible 0 - type ITEM_TYPE_BUTTON - + visible MENU_FALSE + type ITEM_TYPE_BUTTON + text "Create" - textalign ITEM_ALIGN_LEFT - textaligny 36 - textalignx -70 + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textalignx -ARROW_W textscale .6 - + mouseExit { hide accept_alt; show accept } - + action { - play "sound/misc/menu1.wav"; - close fight; //TA: no i don't know + play "sound/misc/menu1.wav"; uiScript StartServer } } diff --git a/ui/drop.menu b/ui/drop.menu index 0db22649..2f0077f4 100644 --- a/ui/drop.menu +++ b/ui/drop.menu @@ -1,23 +1,33 @@ #include "ui/menudef.h" { - \\ ERROR \\ + +#define W 320 +#define H 320 +#define BORDER 10 + +#define BUTT_H 25 +#define BUTT_W 65 + +#define INFO_W (W-(2*BORDER)) +#define INFO_H (H-((4*BORDER)+(2*BUTT_H))) +#define INFO_X BORDER +#define INFO_Y ((2*BORDER)+BUTT_H) menuDef { name "drop_popmenu" - visible 0 - fullscreen 0 - rect 158 80 320 320 + visible MENU_FALSE + fullscreen MENU_FALSE + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 - border 1 + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_FULL popup onClose { uiScript clearError } - onOpen { } onESC { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; close drop_popmenu; open main } @@ -26,10 +36,10 @@ itemDef { name window - rect 10 15 300 320 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL @@ -40,61 +50,49 @@ itemDef { name dropinfo - rect 0 50 320 20 - text "Disconnected:" - textalign 1 - textstyle 6 - textscale .333 - textalignx 160 - textaligny 23 + rect BORDER BORDER INFO_W BUTT_H + text "Disconnected" + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER + textscale .4 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE decoration } - + itemDef { name dropinfo - rect 60 80 200 270 + rect INFO_X INFO_Y INFO_W INFO_H type ITEM_TYPE_TEXT - style 1 - textstyle 3 - autowrapped + style WINDOW_STYLE_FILLED + wrapped cvar "com_errorMessage" textalign ITEM_ALIGN_CENTER - textalignx 100 - textaligny 23 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textscale .33 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE decoration } - - - // BUTTON // - itemDef { name exit text "OK" - type 1 - textscale .25 - group grpControlbutton type ITEM_TYPE_BUTTON + textscale .4 style WINDOW_STYLE_EMPTY - rect 120 295 35 26 - textalign 1 - textalignx 22 - textaligny 20 + rect (W-((2*BORDER)+(2*BUTT_W))) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 backcolor .37 .1 .1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; - close drop_popmenu; - open main + play "sound/misc/menu1.wav"; + close drop_popmenu } } @@ -102,22 +100,19 @@ { name reconnect text "Reconnect" - type 1 - textscale .25 - group grpControlbutton type ITEM_TYPE_BUTTON + textscale .4 style WINDOW_STYLE_EMPTY - rect 165 295 55 26 - textalign 1 - textalignx 22 - textaligny 20 + rect (W-(BORDER+BUTT_W)) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 backcolor .37 .1 .1 1 - visible 1 + visible MENU_TRUE action { close drop_popmenu; - exec "reconnect"; + exec "reconnect"; } } } diff --git a/ui/error.menu b/ui/error.menu index ac57084b..14e9d058 100644 --- a/ui/error.menu +++ b/ui/error.menu @@ -1,23 +1,33 @@ #include "ui/menudef.h" { - \\ ERROR \\ + +#define W 320 +#define H 320 +#define BORDER 10 + +#define BUTT_H 25 +#define BUTT_W 65 + +#define INFO_W (W-(2*BORDER)) +#define INFO_H (H-((4*BORDER)+(2*BUTT_H))) +#define INFO_X BORDER +#define INFO_Y ((2*BORDER)+BUTT_H) menuDef { name "error_popmenu" - visible 0 - fullscreen 0 - rect 158 80 320 320 + visible MENU_FALSE + fullscreen MENU_FALSE + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 - border 1 + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_FULL popup onClose { uiScript clearError } - onOpen { } onESC { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; close error_popmenu; open main } @@ -26,10 +36,10 @@ itemDef { name window - rect 10 15 300 320 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL @@ -39,62 +49,50 @@ itemDef { - name errorinfo - rect 0 50 320 20 - text "Error:" - textalign 1 - textstyle 6 - textscale .333 - textalignx 160 - textaligny 23 + name dropinfo + rect BORDER BORDER INFO_W BUTT_H + text "Error" + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER + textscale .4 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE decoration } - + itemDef { - name errorinfo - rect 60 80 200 270 + name dropinfo + rect INFO_X INFO_Y INFO_W INFO_H type ITEM_TYPE_TEXT - style 1 - textstyle 3 - autowrapped + style WINDOW_STYLE_FILLED + wrapped cvar "com_errorMessage" textalign ITEM_ALIGN_CENTER - textalignx 100 - textaligny 23 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textscale .33 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE decoration } - - - // BUTTON // - itemDef { name exit - text "Exit" - type 1 - textscale .25 - group grpControlbutton + text "OK" type ITEM_TYPE_BUTTON + textscale .4 style WINDOW_STYLE_EMPTY - rect 138 295 45 26 - textalign 1 - textalignx 22 - textaligny 20 + rect (W-(BORDER+BUTT_W)) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 backcolor .37 .1 .1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; - close error_popmenu; - open main + play "sound/misc/menu1.wav"; + close error_popmenu } } } diff --git a/ui/findplayer.menu b/ui/findplayer.menu index f19428f7..d78dede2 100644 --- a/ui/findplayer.menu +++ b/ui/findplayer.menu @@ -3,15 +3,27 @@ { \\ FIND PLAYER POPUP MENU \\ +#define W 400 +#define H 400 +#define BUTT_W 45 +#define BUTT_H 35 +#define BORDER 10 +#define LIST_W (W-(2*BORDER)) +#define LIST_DW (LIST_W-40) +#define LEFT_C 0.13 +#define RIGHT_C 0.61 +#define SEARCH_H 30 +#define SERVERS_H 105 + menuDef { name "findplayer_popmenu" - visible 0 - fullscreen 0 - rect 158 80 320 340 + visible MENU_FALSE + fullscreen MENU_FALSE + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 - border 1 + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_FULL popup onClose { } onOpen @@ -19,226 +31,143 @@ uiScript FindPlayer; setfocus namefield } - + onESC { - close findplayer_popmenu; - open joinserver - } - - itemDef - { - name window - rect 10 15 320 340 - style 1 - backcolor 0 0 0 .25 - forecolor 0 0 0 1 - visible 1 - decoration + close findplayer_popmenu } itemDef { name window - rect 10 15 300 320 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL borderSize 1.0 borderColor 0.5 0.5 0.5 1 } - - itemDef - { - name findplayer - rect 0 20 320 20 - text "Find a Friend" - textalign 1 - textstyle 3 - textscale .333 - textalignx 155 - textaligny 23 - forecolor 1 1 1 1 - visible 1 - decoration - } - - itemDef - { - name window - rect 55 53 245 20 - style WINDOW_STYLE_FILLED - backcolor .2 .2 .2 .5 - visible 1 - decoration - } itemDef { name namefield - group "playersettinggroup" type ITEM_TYPE_EDITFIELD - style 0 + style WINDOW_STYLE_EMPTY text "Name:" cvar "ui_findplayer" maxChars 20 - rect 20 48 215 32 - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 21 - textscale .3 + rect BORDER BORDER (W-((2*BORDER)+BUTT_W)) SEARCH_H + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER + textscale .3 outlinecolor .2 .2 .2 .5 backcolor 0 0 0 0 forecolor 1 1 1 1 - border 0 + border WINDOW_BORDER_NONE bordercolor 0 0 0 0 action { ui_script FindPlayer } - visible 1 + visible MENU_TRUE + } + + itemDef + { + name search + text "Search" + textscale .25 + type ITEM_TYPE_BUTTON + style WINDOW_STYLE_EMPTY + rect (W-(BORDER+BUTT_W)) BORDER BUTT_W SEARCH_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER + forecolor 1 1 1 1 + visible MENU_TRUE + action + { + play "sound/misc/menu1.wav"; + ui_script FindPlayer + } } itemDef { - name serverNameList //LIST OF SERVER NAMES// - rect 20 75 280 80 + name serverNameList + rect BORDER ((2*BORDER)+SEARCH_H) LIST_W SERVERS_H type ITEM_TYPE_LISTBOX - style WINDOW_STYLE_FILLED + style WINDOW_STYLE_EMPTY elementwidth 120 elementheight 16 - textscale .225 - backcolor 0 0 0 1 + textscale .25 outlinecolor .2 .2 .2 .5 - border 1 + border WINDOW_BORDER_FULL bordersize 1 bordercolor .5 .5 .5 1 elementtype LISTBOX_TEXT feeder FEEDER_FINDPLAYER - visible 1 - } - - itemDef - { - name serverNamewindow - rect 20 75 264 80 - style 1 - backcolor 0 0 0 0 - forecolor 0 0 0 0 - border 1 - bordersize 1 - bordercolor .5 .5 .5 1 - visible 1 - decoration + visible MENU_TRUE } itemDef { - name serverInfoList //LIST OF SERVER STATUS INFORMATION// - rect 20 175 280 110 + name serverInfoList + rect BORDER ((3*BORDER)+SEARCH_H+SERVERS_H) LIST_W (H-(SEARCH_H+SERVERS_H+BUTT_H+(3*BORDER))) type ITEM_TYPE_LISTBOX - style WINDOW_STYLE_FILLED + style WINDOW_STYLE_EMPTY elementwidth 120 elementheight 16 - textscale .225 - backcolor 0 0 0 1 - border 1 + textscale .25 + border WINDOW_BORDER_FULL bordersize 1 bordercolor .5 .5 .5 1 elementtype LISTBOX_TEXT feeder FEEDER_SERVERSTATUS notselectable - visible 1 + visible MENU_TRUE columns 4 - 2 90 ITEM_ALIGN_LEFT - 34 40 ITEM_ALIGN_LEFT - 66 40 ITEM_ALIGN_LEFT - 100 150 ITEM_ALIGN_LEFT - } - - itemDef - { - name serverInfowindow - rect 20 175 264 110 - style 1 - backcolor 0 0 0 0 - forecolor 0 0 0 0 - border 1 - bordersize 1 - bordercolor .5 .5 .5 1 - visible 1 - decoration + 0 ((2*LEFT_C)*LIST_DW) ITEM_ALIGN_LEFT + (LEFT_C*LIST_DW) (LEFT_C*LIST_DW) ITEM_ALIGN_LEFT + ((2*LEFT_C)*LIST_DW) (LEFT_C*LIST_DW) ITEM_ALIGN_LEFT + ((1-RIGHT_C)*LIST_DW) (RIGHT_C*LIST_DW) ITEM_ALIGN_LEFT } - - // BUTTON // + // BUTTON // itemDef { - name exit - text "Exit" - type 1 + name join + text "Join" textscale .25 - group grpControlbutton type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 38 295 45 26 - textalign 1 - textalignx 22 - textaligny 20 + rect (W-(2*BUTT_W)) (H-BUTT_H) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - backcolor .37 .1 .1 1 - visible 1 - action - { - play "sound/misc/menu1.wav"; - close findplayer_popmenu; - open joinserver - } + visible MENU_TRUE + action { ui_script FoundPlayerJoinServer } } - + itemDef { - name search - text "Search" - type 1 + name close + text "Close" textscale .25 - group grpControlbutton type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 131 295 60 26 - textalign 1 - textalignx 30 - textaligny 20 + rect (W-BUTT_W) (H-BUTT_H) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - backcolor .37 .1 .1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; - ui_script FindPlayer + close findplayer_popmenu } } - - itemDef - { - name join - text "Join" - type 1 - textscale .25 - group grpControlbutton - type ITEM_TYPE_BUTTON - style WINDOW_STYLE_EMPTY - rect 238 295 45 26 - textalign 1 - textalignx 22 - textaligny 20 - forecolor 1 1 1 1 - backcolor .37 .1 .1 1 - visible 1 - action { ui_script FoundPlayerJoinServer } - } } } @@ -1,11 +1,11 @@ // hud menu defs -// +// { loadMenu { "ui/tremulous_human_hud.menu" } loadMenu { "ui/tremulous_alien_builder_hud.menu" } loadMenu { "ui/tremulous_alien_general_hud.menu" } loadMenu { "ui/tremulous_default_hud.menu" } - + loadMenu { "ui/teamscore.menu" } loadMenu { "ui/loading.menu" } } diff --git a/ui/ingame.menu b/ui/ingame.menu index 13bd1f3c..07b969e6 100644 --- a/ui/ingame.menu +++ b/ui/ingame.menu @@ -1,32 +1,41 @@ #include "ui/menudef.h" { + +#define BUTT_BAR_X 35 +#define BUTT_BAR_Y 0 +#define BUTT_BAR_W 235 +#define BUTT_BAR_H 56 +#define BUTT_W (BUTT_BAR_W/3) +#define BUTT_H BUTT_BAR_H +#define BUTT_TEXT_S 20 + assetGlobalDef { font "fonts/font" 26 // font smallFont "fonts/smallfont" 20 // font bigFont "fonts/bigfont" 34 // font - cursor "ui/assets/3_cursor3" // cursor + cursor "ui/assets/3_cursor3" // cursor gradientBar "ui/assets/gradientbar2.tga" // gradient bar itemFocusSound "sound/misc/menu2.wav" // sound for item getting focus (via keyboard or mouse ) - + fadeClamp 1.0 // sets the fadeup alpha fadeCycle 1 // how often fade happens in milliseconds fadeAmount 0.1 // amount to adjust alpha per cycle shadowColor 0.1 0.1 0.1 0.25 // shadow color } - + \\ INGAME MENU \\ - menuDef + menuDef { name "ingame" style WINDOW_STYLE_FILLED - visible 0 + visible MENU_FALSE fullScreen 0 outOfBoundsClick // this closes the window if it gets a click out of the rectangle - rect 0 0 640 48 + rect 0 0 640 48 focusColor 1 .75 0 1 disableColor .5 .5 .5 1 backColor 0 0 0 1 @@ -35,38 +44,38 @@ { close ingame; } - + itemDef { name splashmodel - rect 0 -10 640 66 + rect 0 -10 640 66 type ITEM_TYPE_MODEL style WINDOW_STYLE_FILLED asset_model "models/splash/splash_screen.md3" model_fovx 32.0 model_fovy 3.8 model_angle 180 - visible 1 + visible MENU_TRUE decoration backcolor 0 0 0 1 } itemdef { - name game - text "Game" - rect 35 6 65 40 + name game + text "Game" + rect BUTT_BAR_X BUTT_BAR_Y BUTT_W BUTT_H type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - textalign ITEM_ALIGN_CENTER - textalignx 32 - textaligny 28 + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textalignx -BUTT_TEXT_S textscale .4 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; open ingame_game } } @@ -77,16 +86,15 @@ text "Options" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 100 6 70 40 + rect (BUTT_BAR_X+BUTT_W) BUTT_BAR_Y BUTT_W BUTT_H textalign ITEM_ALIGN_CENTER - textalignx 35 - textaligny 28 + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; open ingame_options } } @@ -97,17 +105,16 @@ text "Exit" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - //rect 220 6 50 40 - rect 170 6 50 40 - textalign ITEM_ALIGN_CENTER - textalignx 25 - textaligny 28 + rect (BUTT_BAR_X+(2*BUTT_W)) BUTT_BAR_Y BUTT_W BUTT_H + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER + textalignx BUTT_TEXT_S textscale .4 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; open ingame_leave } } diff --git a/ui/ingame.txt b/ui/ingame.txt index 185ce97a..251aa779 100644 --- a/ui/ingame.txt +++ b/ui/ingame.txt @@ -1,6 +1,6 @@ // menu defs -// -{ +// +{ loadMenu { "ui/ingame.menu" } loadMenu { "ui/ingame_game.menu" } loadMenu { "ui/ingame_options.menu" } diff --git a/ui/ingame_game.menu b/ui/ingame_game.menu index 77931914..11603536 100644 --- a/ui/ingame_game.menu +++ b/ui/ingame_game.menu @@ -3,13 +3,67 @@ { \\ INGAME GAME BOX \\ +#define W 320 +#define H 290 +#define X 10 +#define Y 60 +#define BORDER 10 + +#define TOPBUTT_W 80 +#define TOPBUTT_H 30 + +#define SIDEBUTT_W 50 +#define SIDEBUTT_H 25 + +#define MAP_X (SIDEBUTT_W+BORDER) +#define MAP_Y ((2*BORDER)+TOPBUTT_H) +#define MAP_W 100 +#define MAP_H 75 +#define MAPLIST_X MAP_X +#define MAPLIST_Y ((3*BORDER)+TOPBUTT_H+MAP_H) +#define MAPLIST_W (W-((2*BORDER)+SIDEBUTT_W)) +#define MAPLIST_H (H-((4*BORDER)+MAP_H+TOPBUTT_H)) +#define MAPBUTT_X (MAP_X+MAP_W+BORDER) +#define MAPBUTT_Y MAP_Y +#define MAPBUTT_W (W-(MAPBUTT_X+BORDER)) +#define MAPBUTT_H 25 + +#define PBUTT_X MAP_X +#define PBUTT_Y (H-((2*PBUTT_H)+BORDER)) +#define PBUTT_W (W-((2*BORDER)+SIDEBUTT_W)) +#define PBUTT_H 25 +#define PLIST_X PBUTT_X +#define PLIST_Y ((2*BORDER)+TOPBUTT_H) +#define PLIST_W PBUTT_W +#define PLIST_H (H-((4*BORDER)+(2*PBUTT_H)+TOPBUTT_H)) + +#define PLAYER_C 0.7 +#define IGN_C 0.15 +#define IGNY_C 0.15 +#define IGNHEAD_H 15 +#define IGNHEAD_Y ((2*BORDER)+TOPBUTT_H) +#define IGNBUTT_W ((W-(2*BORDER))/2) +#define IGNBUTT_H 25 +#define IGNBUTT_X BORDER +#define IGNBUTT_Y (H-(BORDER+IGNBUTT_H)) +#define IGNORE_W (W-(2*BORDER)) +#define IGNORE_W2 ((W-(2*BORDER))-15) +#define IGNORE_H (H-((4*BORDER)+TOPBUTT_H+IGNHEAD_H+IGNBUTT_H)) +#define IGNORE_X BORDER +#define IGNORE_Y ((2*BORDER)+TOPBUTT_H+IGNHEAD_H) +#define IGNORE_TOFF 5 + +#define INFO_Y ((2*BORDER)+TOPBUTT_H+10) +#define INFOELEM_H 15 +#define INFO_OFF (0-(W-90)) + menuDef { name "ingame_game" - visible 0 - fullscreen 0 + visible MENU_FALSE + fullscreen MENU_FALSE outOfBoundsClick // this closes the window if it gets a click out of the rectangle - rect 10 56 292 280 + rect X Y W H focusColor 1 .75 0 1 onopen { @@ -28,14 +82,14 @@ itemDef { name window - rect 10 5 292 270 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration - border WINDOW_BORDER_KCGRADIENT - borderSize 2.0 + border WINDOW_BORDER_FULL + borderSize 1.0 borderColor 0.5 0.5 0.5 1 } @@ -46,21 +100,20 @@ text "Vote" group menuGrp style WINDOW_STYLE_EMPTY - rect 35 22 40 20 + rect (W-((3*TOPBUTT_W)+BORDER)) BORDER TOPBUTT_W TOPBUTT_H type ITEM_TYPE_BUTTON - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 15 + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .35 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide gameGrp; show vote; show mapvote; - + setitemcolor infoBtn forecolor 1.0 1.0 1.0 1.0; setitemcolor voteBtn forecolor 0.2 0.2 0.2 1.0; setitemcolor ignoreBtn forecolor 1.0 1.0 1.0 1.0 @@ -73,46 +126,44 @@ text "Ignore" group menuGrp style WINDOW_STYLE_EMPTY - rect 100 22 40 20 + rect (W-((2*TOPBUTT_W)+BORDER)) BORDER TOPBUTT_W TOPBUTT_H type ITEM_TYPE_BUTTON - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 15 + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .35 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide gameGrp; show ignore; - + setitemcolor infoBtn forecolor 1.0 1.0 1.0 1.0; setitemcolor voteBtn forecolor 1.0 1.0 1.0 1.0; setitemcolor ignoreBtn forecolor 0.2 0.2 0.2 1.0 } } - + itemDef { name infoBtn text "Info" group menuGrp style WINDOW_STYLE_EMPTY - rect 165 22 40 20 + rect (W-((1*TOPBUTT_W)+BORDER)) BORDER TOPBUTT_W TOPBUTT_H type ITEM_TYPE_BUTTON - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 15 + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .35 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide gameGrp; show info; - + setitemcolor infoBtn forecolor 0.2 0.2 0.2 1.0; setitemcolor voteBtn forecolor 1.0 1.0 1.0 1.0; setitemcolor ignoreBtn forecolor 1.0 1.0 1.0 1.0 @@ -120,159 +171,6 @@ } -//////// INFO - - itemDef - { - name info - group gameGrp - rect 30 55 256 20 - type 4 - style 0 - text "Server Name:" - cvar ui_serverinfo_hostname - maxPaintChars 32 - textalign ITEM_ALIGN_RIGHT - textaligny 12 - textalignx 75 - textscale .25 - forecolor 1 1 1 1 - visible 0 - decoration - } - - itemDef - { - name info - group gameGrp - rect 30 70 256 20 - type 4 - style 0 - text "Time Limit:" - maxPaintChars 12 - cvar ui_serverinfo_timelimit - textalign ITEM_ALIGN_RIGHT - textaligny 12 - textalignx 75 - textscale .25 - forecolor 1 1 1 1 - visible 0 - decoration - } - - itemDef - { - name info - group gameGrp - rect 30 85 256 20 - type 4 - style 0 - text "Sudden Death Time:" - cvar ui_serverinfo_sd - maxPaintChars 12 - textalign ITEM_ALIGN_RIGHT - textaligny 12 - textalignx 75 - textscale .25 - forecolor 1 1 1 1 - visible 0 - decoration - } - - itemDef - { - name info - group gameGrp - rect 30 100 256 20 - type 4 - style 0 - text "Max Clients:" - cvar ui_serverinfo_maxclients - maxPaintChars 12 - textalign ITEM_ALIGN_RIGHT - textaligny 12 - textalignx 75 - textscale .25 - forecolor 1 1 1 1 - visible 0 - decoration - } - - itemDef - { - name info - group gameGrp - rect 30 115 256 20 - type 4 - style 0 - text "Map Name:" - cvar ui_serverinfo_mapname - maxPaintChars 12 - textalign ITEM_ALIGN_RIGHT - textaligny 12 - textalignx 75 - textscale .25 - forecolor 1 1 1 1 - visible 0 - decoration - } - - itemDef - { - name info - group gameGrp - rect 30 130 256 20 - type 11 - style 0 - text "Lag Correction:" - cvar ui_serverinfo_unlagged - textalign ITEM_ALIGN_RIGHT - textaligny 12 - textalignx 75 - textscale .25 - forecolor 1 1 1 1 - visible 0 - decoration - } - - itemDef - { - name info - group gameGrp - rect 30 145 256 20 - type ITEM_TYPE_MULTI - style 0 - text "Friendly Fire:" - cvarFloat ui_serverinfo_ff 0 0 7 - cvarFloatList { "Off" 0 "Humans Only" 1 "Aliens Only" 2 "Both Teams" 3 "Buildables Only" 4 "Humans and Buildables" 5 "Aliens and Buildables" 6 "Both Teams and Buildables" 7 } - textalign ITEM_ALIGN_RIGHT - textaligny 12 - textalignx 75 - textscale .25 - forecolor 1 1 1 1 - visible 0 - decoration - } - - itemDef - { - name info - group gameGrp - rect 30 160 256 20 - type 4 - style 0 - text "Version:" - cvar ui_serverinfo_version - maxPaintChars 45 - textalign ITEM_ALIGN_RIGHT - textaligny 12 - textalignx 75 - textscale .25 - forecolor 1 1 1 1 - visible 0 - decoration - } - //////// VOTE //Vote menu @@ -282,17 +180,16 @@ text "Map" group gameGrp style WINDOW_STYLE_EMPTY - rect 20 60 64 20 + rect 0 ((2*BORDER)+TOPBUTT_H) SIDEBUTT_W SIDEBUTT_H type ITEM_TYPE_BUTTON textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 16 + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide gameGrp; show mapvote; show vote; @@ -305,40 +202,38 @@ text "Players" group gameGrp style WINDOW_STYLE_EMPTY - rect 20 85 64 20 + rect 0 ((2*BORDER)+TOPBUTT_H+SIDEBUTT_H) SIDEBUTT_W SIDEBUTT_H type ITEM_TYPE_BUTTON textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 16 + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide gameGrp; show playervote; show vote; } } - + itemDef { name vote text "Team" group gameGrp style WINDOW_STYLE_EMPTY - rect 20 110 64 20 + rect 0 ((2*BORDER)+TOPBUTT_H+(2*SIDEBUTT_H)) SIDEBUTT_W SIDEBUTT_H type ITEM_TYPE_BUTTON textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 16 + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide gameGrp; show teamvote; show vote; @@ -348,48 +243,21 @@ ///// Map Vote itemDef { - name mapvote + name mapvote group gameGrp - style 0 + style WINDOW_STYLE_EMPTY ownerdraw UI_STARTMAPCINEMATIC - rect 111 61 80 60 - border 1 - bordercolor .5 .5 .5 .5 - visible 0 - } - - itemDef - { - name mapvote - group gameGrp - style WINDOW_STYLE_FILLED - rect 110 60 82 62 - border 1 + rect MAP_X MAP_Y MAP_W MAP_H + border WINDOW_BORDER_FULL bordercolor .5 .5 .5 .5 - visible 0 - } - - itemDef - { - name mapvote - group gameGrp - text "" - ownerdraw UI_ALLMAPS_SELECTION - textscale .225 - rect 200 80 110 20 - textalign 0 - textalignx 0 - textaligny 16 - forecolor 1 1 1 1 - decoration - visible 0 + visible MENU_FALSE } itemDef { name mapvote group gameGrp - rect 110 122 150 85 + rect MAPLIST_X MAPLIST_Y MAPLIST_W MAPLIST_H type ITEM_TYPE_LISTBOX style WINDOW_STYLE_EMPTY elementwidth 120 @@ -397,12 +265,12 @@ textscale .225 elementtype LISTBOX_TEXT feeder FEEDER_ALLMAPS - border 1 + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 0 + visible MENU_FALSE doubleclick { play "sound/misc/menu1.wav"; @@ -418,12 +286,11 @@ text "Load Selected Map" type ITEM_TYPE_BUTTON textscale .25 - rect 110 210 80 20 + rect MAPBUTT_X MAPBUTT_Y MAPBUTT_W MAPBUTT_H textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 15 + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { play "sound/misc/menu1.wav"; @@ -439,12 +306,11 @@ text "Restart Current Map" type ITEM_TYPE_BUTTON textscale .25 - rect 110 230 90 20 + rect MAPBUTT_X (MAPBUTT_Y+MAPBUTT_H) MAPBUTT_W MAPBUTT_H textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 15 + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { play "sound/misc/menu1.wav"; @@ -452,7 +318,7 @@ uiScript closeingame } } - + itemDef { name mapvote @@ -460,12 +326,11 @@ text "End Match In Draw" type ITEM_TYPE_BUTTON textscale .25 - rect 110 250 110 20 + rect MAPBUTT_X (MAPBUTT_Y+(2*MAPBUTT_H)) MAPBUTT_W MAPBUTT_H textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 15 + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { play "sound/misc/menu1.wav"; @@ -479,23 +344,7 @@ { name playervote group gameGrp - text "Selected Player:" - ownerdraw UI_PLAYERLIST_SELECTION - textscale .225 - rect 110 60 110 20 - textalign 0 - textalignx 0 - textaligny 16 - forecolor 1 1 1 1 - decoration - visible 0 - } - - itemDef - { - name playervote - group gameGrp - rect 110 80 170 85 + rect PLIST_X PLIST_Y PLIST_W PLIST_H style WINDOW_STYLE_EMPTY type ITEM_TYPE_LISTBOX elementwidth 120 @@ -503,73 +352,70 @@ textscale .225 elementtype LISTBOX_TEXT feeder FEEDER_PLAYER_LIST - border 1 + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 0 + visible MENU_FALSE } - + itemDef { name playervote group gameGrp - text "Kick Selected Player" + text "Mute Player" type ITEM_TYPE_BUTTON textscale .25 - rect 110 175 90 20 - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 15 + rect PBUTT_X PBUTT_Y (PBUTT_W/2) PBUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { play "sound/misc/menu1.wav"; - uiScript voteKick; + uiScript voteMute; uiScript closeingame } } - + itemDef { name playervote group gameGrp - text "Mute Selected Player" + text "Un-Mute Player" type ITEM_TYPE_BUTTON textscale .25 - rect 110 195 90 20 - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 15 + rect (PBUTT_X+(PBUTT_W/2)) PBUTT_Y (PBUTT_W/2) PBUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { play "sound/misc/menu1.wav"; - uiScript voteMute; + uiScript voteUnMute; uiScript closeingame } } - + itemDef { name playervote group gameGrp - text "Un-Mute Selected Player" + text "Kick Player" type ITEM_TYPE_BUTTON textscale .25 - rect 110 215 100 20 - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 15 + rect PBUTT_X (PBUTT_Y+PBUTT_H) PBUTT_W PBUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { play "sound/misc/menu1.wav"; - uiScript voteUnMute; + uiScript voteKick; uiScript closeingame } } @@ -580,23 +426,7 @@ { name teamvote group gameGrp - text "Selected Teammate:" - ownerdraw UI_TEAMLIST_SELECTION - textscale .225 - rect 110 60 110 20 - textalign 0 - textalignx 0 - textaligny 16 - forecolor 1 1 1 1 - decoration - visible 0 - } - - itemDef - { - name teamvote - group gameGrp - rect 110 80 170 85 + rect PLIST_X PLIST_Y PLIST_W PLIST_H style WINDOW_STYLE_EMPTY type ITEM_TYPE_LISTBOX elementwidth 120 @@ -604,27 +434,26 @@ textscale .225 elementtype LISTBOX_TEXT feeder FEEDER_TEAM_LIST - border 1 + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 0 + visible MENU_FALSE } - + itemDef { name teamvote group gameGrp - text "Kick Selected Teammate" + text "Kick Teammate" type ITEM_TYPE_BUTTON textscale .25 - rect 110 175 100 20 - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 15 + rect PBUTT_X PBUTT_Y (PBUTT_W/2) PBUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { play "sound/misc/menu1.wav"; @@ -632,20 +461,19 @@ uiScript closeingame } } - + itemDef { name teamvote group gameGrp - text "Deny Building For Selected Teammate" + text "Deny Building For Teammate" type ITEM_TYPE_BUTTON textscale .25 - rect 110 195 150 20 - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 15 + rect (PBUTT_X+(PBUTT_W/2)) PBUTT_Y (PBUTT_W/2) PBUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { play "sound/misc/menu1.wav"; @@ -653,20 +481,20 @@ uiScript closeingame } } - + itemDef { name teamvote group gameGrp - text "Allow Building For Selected Teammate" + text "Allow Building For Teammate" type ITEM_TYPE_BUTTON textscale .25 rect 110 215 150 20 - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 15 + rect PBUTT_X (PBUTT_Y+PBUTT_H) (PBUTT_W/2) PBUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { play "sound/misc/menu1.wav"; @@ -674,7 +502,7 @@ uiScript closeingame } } - + itemDef { name teamvote @@ -682,12 +510,11 @@ text "Admit Defeat" type ITEM_TYPE_BUTTON textscale .25 - rect 110 235 150 20 - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 15 + rect (PBUTT_X+(PBUTT_W/2)) (PBUTT_Y+PBUTT_H) (PBUTT_W/2) PBUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { play "sound/misc/menu1.wav"; @@ -701,43 +528,50 @@ { name ignore group gameGrp - rect 45 70 40 5 + rect IGNORE_X IGNHEAD_Y (PLAYER_C*IGNORE_W2) IGNHEAD_H text "Player Name" - visible 0 - type ITEM_TYPE_TEXT + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER + textalignx IGNORE_TOFF + visible MENU_FALSE + type ITEM_TYPE_TEXT textscale .225 } itemDef { name ignore group gameGrp - rect 190 70 40 5 + rect (IGNORE_X+(PLAYER_C*IGNORE_W2)) IGNHEAD_Y (IGN_C*IGNORE_W2) IGNHEAD_H text "Ignored" - visible 0 - type ITEM_TYPE_TEXT + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER + visible MENU_FALSE + type ITEM_TYPE_TEXT textscale .225 } itemDef { name ignore group gameGrp - rect 230 70 40 5 + rect (IGNORE_X+((PLAYER_C+IGN_C)*IGNORE_W2)) IGNHEAD_Y (IGNY_C*IGNORE_W2) IGNHEAD_H text "Ignoring You" - visible 0 - type ITEM_TYPE_TEXT + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER + visible MENU_FALSE + type ITEM_TYPE_TEXT textscale .225 } itemDef { name ignore group gameGrp - rect 35 75 240 130 + rect IGNORE_X IGNORE_Y IGNORE_W IGNORE_H type ITEM_TYPE_LISTBOX style WINDOW_STYLE_EMPTY elementwidth 120 elementheight 16 textscale .225 - border 1 + border WINDOW_BORDER_FULL bordersize 1 bordercolor .5 .5 .5 1 forecolor 1 1 1 1 @@ -745,52 +579,51 @@ outlinecolor 0.1 0.1 0.1 0.5 elementtype LISTBOX_TEXT feeder FEEDER_IGNORE_LIST - visible 0 + visible MENU_FALSE columns 3 - 2 40 ITEM_ALIGN_LEFT - 150 15 ITEM_ALIGN_LEFT - 190 15 ITEM_ALIGN_LEFT - doubleClick { - play "sound/misc/menu1.wav"; + IGNORE_TOFF ((PLAYER_C*IGNORE_W)-(3*IGNORE_TOFF)) ITEM_ALIGN_LEFT + (IGNORE_TOFF+((PLAYER_C)*IGNORE_W)) ((IGN_C*IGNORE_W)-(3*IGNORE_TOFF)) ITEM_ALIGN_CENTER + (IGNORE_TOFF+((PLAYER_C+IGN_C)*IGNORE_W)) ((IGNY_C*IGNORE_W)-(3*IGNORE_TOFF)) ITEM_ALIGN_CENTER + doubleClick + { + play "sound/misc/menu1.wav"; uiScript ToggleIgnore } } itemDef { - name ignore + name ignore text "Ignore Player" group gameGrp style WINDOW_STYLE_EMPTY - rect 60 210 64 20 + rect IGNBUTT_X IGNBUTT_Y IGNBUTT_W IGNBUTT_H type ITEM_TYPE_BUTTON - textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 16 + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { play "sound/misc/menu1.wav"; uiScript IgnorePlayer } } - + itemDef { - name ignore + name ignore text "Stop Ignoring Player" group gameGrp style WINDOW_STYLE_EMPTY - rect 190 210 64 20 + rect (IGNBUTT_X+IGNBUTT_W) IGNBUTT_Y IGNBUTT_W IGNBUTT_H type ITEM_TYPE_BUTTON - textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 16 + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { play "sound/misc/menu1.wav"; @@ -798,5 +631,151 @@ } } +//////// INFO + + itemDef + { + name info + group gameGrp + rect 0 (INFO_Y+(0*INFOELEM_H)) W INFOELEM_H + type ITEM_TYPE_EDITFIELD + style WINDOW_STYLE_EMPTY + text "Server Name:" + cvar ui_serverinfo_hostname + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textalignx INFO_OFF + textscale .25 + forecolor 1 1 1 1 + visible MENU_FALSE + decoration + } + + itemDef + { + name info + group gameGrp + rect 0 (INFO_Y+(1*INFOELEM_H)) W INFOELEM_H + type ITEM_TYPE_EDITFIELD + style WINDOW_STYLE_EMPTY + text "Time Limit:" + cvar ui_serverinfo_timelimit + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textalignx INFO_OFF + textscale .25 + forecolor 1 1 1 1 + visible MENU_FALSE + decoration + } + + itemDef + { + name info + group gameGrp + rect 0 (INFO_Y+(2*INFOELEM_H)) W INFOELEM_H + type ITEM_TYPE_EDITFIELD + style WINDOW_STYLE_EMPTY + text "Sudden Death Time:" + cvar ui_serverinfo_sd + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textalignx INFO_OFF + textscale .25 + forecolor 1 1 1 1 + visible MENU_FALSE + decoration + } + + itemDef + { + name info + group gameGrp + rect 0 (INFO_Y+(3*INFOELEM_H)) W INFOELEM_H + type ITEM_TYPE_EDITFIELD + style WINDOW_STYLE_EMPTY + text "Max Clients:" + cvar ui_serverinfo_maxclients + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textalignx INFO_OFF + textscale .25 + forecolor 1 1 1 1 + visible MENU_FALSE + decoration + } + + itemDef + { + name info + group gameGrp + rect 0 (INFO_Y+(4*INFOELEM_H)) W INFOELEM_H + type ITEM_TYPE_EDITFIELD + style WINDOW_STYLE_EMPTY + text "Map Name:" + cvar ui_serverinfo_mapname + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textalignx INFO_OFF + textscale .25 + forecolor 1 1 1 1 + visible MENU_FALSE + decoration + } + + itemDef + { + name info + group gameGrp + rect 0 (INFO_Y+(5*INFOELEM_H)) W INFOELEM_H + type ITEM_TYPE_BUTTON + style WINDOW_STYLE_EMPTY + text "Lag Correction:" + cvar ui_serverinfo_unlagged + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textalignx INFO_OFF + textscale .25 + forecolor 1 1 1 1 + visible MENU_FALSE + decoration + } + + itemDef + { + name info + group gameGrp + rect 0 (INFO_Y+(6*INFOELEM_H)) W INFOELEM_H + type ITEM_TYPE_MULTI + style WINDOW_STYLE_EMPTY + text "Friendly Fire:" + cvarFloat ui_serverinfo_ff 0 0 7 + cvarFloatList { "Off" 0 "Humans Only" 1 "Aliens Only" 2 "Both Teams" 3 "Buildables Only" 4 "Humans and Buildables" 5 "Aliens and Buildables" 6 "Both Teams and Buildables" 7 } + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textalignx INFO_OFF + textscale .25 + forecolor 1 1 1 1 + visible MENU_FALSE + decoration + } + + itemDef + { + name info + group gameGrp + rect 0 (INFO_Y+(7*INFOELEM_H)) W INFOELEM_H + type ITEM_TYPE_EDITFIELD + style WINDOW_STYLE_EMPTY + text "Version:" + cvar ui_serverinfo_version + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textalignx INFO_OFF + textscale .25 + forecolor 1 1 1 1 + visible MENU_FALSE + decoration + } } } diff --git a/ui/ingame_leave.menu b/ui/ingame_leave.menu index 07bd0b2c..38fcb931 100644 --- a/ui/ingame_leave.menu +++ b/ui/ingame_leave.menu @@ -3,13 +3,27 @@ { \\ INGAME_LEAVE MENU \\ +#define X 160 +#define Y 60 +#define W 120 +#define H 100 + +#define L1_X 0 +#define L1_Y (H/6) +#define L1_W W +#define L1_H (H/3) +#define L2_X 0 +#define L2_Y (H/2) +#define L2_W W +#define L2_H (H/3) + menuDef { name "ingame_leave" - visible 1 + visible MENU_TRUE fullScreen 0 outOfBoundsClick // this closes the window if it gets a click out of the rectangle - rect 160 56 128 125 + rect X Y W H focusColor 1 .75 0 1 onOpen { @@ -21,33 +35,32 @@ { name leave style WINDOW_STYLE_FILLED - rect 5 5 107 90 + rect 0 0 W H backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration - border WINDOW_BORDER_KCGRADIENT - borderSize 2.0 + border WINDOW_BORDER_FULL + borderSize 1.0 borderColor 0.5 0.5 0.5 1 } itemDef { name leave + type ITEM_TYPE_BUTTON text "Main Menu" group grpMenu - style WINDOW_STYLE_EMPTY - rect 0 20 128 20 - type 1 - textalign 1 - textalignx 64 - textaligny 18 + style WINDOW_STYLE_EMPTY + rect L1_X L1_Y L1_W L1_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide grpMenu; show leaveConfirm } @@ -57,41 +70,18 @@ { name leave group grpMenu - text "Restart" - style WINDOW_STYLE_EMPTY - type 1 - rect 0 40 128 20 - textalign 1 - textalignx 65 - textaligny 18 - textscale .25 - forecolor 1 1 1 1 - visible 1 - action - { - play "sound/misc/menu1.wav"; - hide grpMenu; - show restartConfirm - } - } - - itemDef - { - name leave - group grpMenu - type 1 + type ITEM_TYPE_BUTTON text "Quit" - style WINDOW_STYLE_EMPTY - rect 0 60 128 20 - textalign 1 - textalignx 64 - textaligny 18 + style WINDOW_STYLE_EMPTY + rect L2_X L2_Y L2_W L2_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide grpMenu; show quitConfirm } @@ -104,33 +94,16 @@ itemDef { name leaveConfirm - text "Exit to" - group grpConfirm - style WINDOW_STYLE_EMPTY - rect 0 23 128 20 - textalign 1 - textalignx 64 - textaligny 18 - textscale .25 - decoration - forecolor 1 1 1 1 - visible 1 - } - - itemDef - { - name leaveConfirm - text "Main Menu?" + text "Return To Main Menu?" group grpConfirm - style WINDOW_STYLE_EMPTY - rect 0 40 128 20 - textalign 1 - textalignx 64 - textaligny 18 + style WINDOW_STYLE_EMPTY + rect L1_X L1_Y L1_W L1_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .25 decoration forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } itemDef @@ -138,18 +111,17 @@ name leaveConfirm text "Yes" group grpConfirm - type 1 + type ITEM_TYPE_BUTTON textscale .25 style WINDOW_STYLE_EMPTY - rect 18 70 40 20 - textalign 1 - textalignx 20 - textaligny 15 + rect L2_X L2_Y (L2_W/2) L2_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript leave } } @@ -159,95 +131,17 @@ name leaveConfirm text "No" group grpConfirm - type 1 - textscale .25 - style WINDOW_STYLE_EMPTY - rect 70 70 40 20 - textalign 1 - textalignx 20 - textaligny 15 - forecolor 1 1 1 1 - visible 1 - action - { - play "sound/misc/menu3.wav"; - hide grpConfirm; - show grpMenu - } - } - - itemDef - { - name restartConfirm - text "Want to" - group grpConfirm - style WINDOW_STYLE_EMPTY - rect 0 23 128 20 - textalign 1 - textalignx 64 - textaligny 18 - textscale .25 - decoration - forecolor 1 1 1 1 - visible 1 - } - - itemDef - { - name restartConfirm - text "Restart Map?" - group grpConfirm - style WINDOW_STYLE_EMPTY - rect 0 40 128 20 - textalign 1 - textalignx 64 - textaligny 18 - textscale .25 - decoration - forecolor 1 1 1 1 - visible 1 - } - - itemDef - { - name restartConfirm - text "Yes" - group grpConfirm - type 1 - textscale .25 - style WINDOW_STYLE_EMPTY - rect 18 70 40 20 - textalign 1 - textalignx 20 - textaligny 15 - forecolor 1 1 1 1 - visible 1 - action - { - play "sound/misc/menu1.wav"; - exec "map_restart"; - close ingame_leave; - close ingame - } - } - - itemDef - { - name restartConfirm - text "No" - group grpConfirm - type 1 + type ITEM_TYPE_BUTTON textscale .25 style WINDOW_STYLE_EMPTY - rect 70 70 40 20 - textalign 1 - textalignx 20 - textaligny 15 + rect (L2_X+(L2_W/2)) L2_Y (L2_W/2) L2_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu3.wav"; + play "sound/misc/menu3.wav"; hide grpConfirm; show grpMenu } @@ -256,33 +150,16 @@ itemDef { name quitConfirm - text "Want to" + text "Want To Quit Game?" group grpConfirm - style WINDOW_STYLE_EMPTY - rect 0 23 128 20 - textalign 1 - textalignx 64 - textaligny 18 - textscale .25 - forecolor 1 1 1 1 - decoration - visible 1 - } - - itemDef - { - name quitConfirm - text "Quit Game?" - group grpConfirm - style WINDOW_STYLE_EMPTY - rect 0 40 128 20 - textalign 1 - textalignx 64 - textaligny 18 + style WINDOW_STYLE_EMPTY + rect L1_X L1_Y L1_W L1_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 decoration - visible 1 + visible MENU_TRUE } itemDef @@ -290,18 +167,17 @@ name quitConfirm text "Yes" group grpConfirm - type 1 + type ITEM_TYPE_BUTTON textscale .25 style WINDOW_STYLE_EMPTY - rect 18 70 40 20 - textalign 1 - textalignx 20 - textaligny 15 + rect L2_X L2_Y (L2_W/2) L2_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript quit } } @@ -311,18 +187,17 @@ name quitConfirm text "No" group grpConfirm - type 1 + type ITEM_TYPE_BUTTON textscale .25 style WINDOW_STYLE_EMPTY - rect 70 70 40 20 - textalign 1 - textalignx 20 - textaligny 15 + rect (L2_X+(L2_W/2)) L2_Y (L2_W/2) L2_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action - { - play "sound/misc/menu3.wav"; + { + play "sound/misc/menu3.wav"; hide grpConfirm; show grpMenu } diff --git a/ui/ingame_options.menu b/ui/ingame_options.menu index e0f08aa4..74a42f76 100644 --- a/ui/ingame_options.menu +++ b/ui/ingame_options.menu @@ -3,13 +3,36 @@ { \\ INGAME OPTIONS BOX \\ +#define W 320 +#define H 290 +#define X 10 +#define Y 60 +#define BORDER 10 + +#define TOPBUTT_W 80 +#define TOPBUTT_H 30 + +#define CONTENT_X BORDER +#define CONTENT_Y ((2*BORDER)+TOPBUTT_H) +#define CONTENT_W (W-(2*BORDER)) +#define CONTENT_OFF (0-(CONTENT_W/2)) + +#define SIDEBUTT_W 65 +#define SIDEBUTT_H 25 +#define SCONTENT_X (SIDEBUTT_W+BORDER) +#define SCONTENT_Y CONTENT_Y +#define SCONTENT_W (W-(SIDEBUTT_W+(2*BORDER))) +#define SCONTENT_OFF (0-(SCONTENT_W/2)) + +#define ELEM_H 16 + menuDef { name "ingame_options" - visible 0 - fullscreen 0 + visible MENU_FALSE + fullscreen MENU_FALSE outOfBoundsClick // this closes the window if it gets a click out of the rectangle - rect 10 56 292 280 + rect X Y W H focusColor 1 .75 0 1 onopen { @@ -24,14 +47,14 @@ itemDef { name window - rect 10 5 292 270 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration - border WINDOW_BORDER_KCGRADIENT - borderSize 2.0 + border WINDOW_BORDER_FULL + borderSize 1.0 borderColor 0.5 0.5 0.5 1 } @@ -42,20 +65,19 @@ text "Game" group menuGrp style WINDOW_STYLE_EMPTY - rect 80 20 64 20 + rect (W-((3*TOPBUTT_W)+BORDER)) BORDER TOPBUTT_W TOPBUTT_H type ITEM_TYPE_BUTTON - textalign ITEM_ALIGN_CENTER - textalignx 34 - textaligny 18 + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .35 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide optionsGrp; show game; - + setitemcolor gameBtn forecolor 0.2 0.2 0.2 1.0; setitemcolor controlsBtn forecolor 1.0 1.0 1.0 1.0; setitemcolor systemBtn forecolor 1.0 1.0 1.0 1.0 @@ -68,21 +90,20 @@ text "Controls" group menuGrp style WINDOW_STYLE_EMPTY - rect 160 20 64 20 + rect (W-((2*TOPBUTT_W)+BORDER)) BORDER TOPBUTT_W TOPBUTT_H type ITEM_TYPE_BUTTON - textalign ITEM_ALIGN_CENTER - textalignx 34 - textaligny 18 + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .35 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide optionsGrp; show controls; show look; - + setitemcolor gameBtn forecolor 1.0 1.0 1.0 1.0; setitemcolor controlsBtn forecolor 0.2 0.2 0.2 1.0; setitemcolor systemBtn forecolor 1.0 1.0 1.0 1.0 @@ -95,21 +116,20 @@ text "System" group menuGrp style WINDOW_STYLE_EMPTY - rect 230 20 64 20 + rect (W-((1*TOPBUTT_W)+BORDER)) BORDER TOPBUTT_W TOPBUTT_H type ITEM_TYPE_BUTTON - textalign ITEM_ALIGN_CENTER - textalignx 34 - textaligny 18 + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .35 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide optionsGrp; show system; show ghardware; - + setitemcolor gameBtn forecolor 1.0 1.0 1.0 1.0; setitemcolor controlsBtn forecolor 1.0 1.0 1.0 1.0; setitemcolor systemBtn forecolor 0.2 0.2 0.2 1.0 @@ -123,20 +143,19 @@ name game group optionsGrp type ITEM_TYPE_EDITFIELD - style 0 + style WINDOW_STYLE_EMPTY text "Name:" cvar "name" - maxchars 31 - maxPaintChars 31 - rect 50 85 220 15 - textalign ITEM_ALIGN_LEFT - textalignx 64 - textaligny 12 - textscale .25 + maxchars 40 + rect CONTENT_X (CONTENT_Y+(0*ELEM_H)) CONTENT_W ELEM_H + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textalignx CONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE } - + itemDef { name game @@ -144,76 +163,76 @@ type ITEM_TYPE_YESNO text "Auto Download:" cvar "cl_allowDownload" - rect 80 115 192 15 + rect CONTENT_X (CONTENT_Y+(1*ELEM_H)) CONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 128 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx CONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } itemDef { - name game + name game group optionsGrp type ITEM_TYPE_YESNO text "Taunts Sounds Off:" cvar "cg_noTaunt" - rect 80 130 192 15 + rect CONTENT_X (CONTENT_Y+(2*ELEM_H)) CONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 128 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx CONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } itemDef { - name game + name game group optionsGrp type ITEM_TYPE_YESNO text "Team Chats Only:" cvar "cg_teamChatsOnly" - rect 80 145 192 15 + rect CONTENT_X (CONTENT_Y+(3*ELEM_H)) CONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 128 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx CONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } itemDef { - name game + name game group optionsGrp type ITEM_TYPE_YESNO text "Auto Wallwalk Pitching:" cvar "cg_wwFollow" - rect 80 160 192 15 + rect CONTENT_X (CONTENT_Y+(4*ELEM_H)) CONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 128 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx CONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -225,36 +244,36 @@ text "Wallwalking Speed:" cvarfloat "cg_wwSmoothTime" 300 0 1000 cvarFloatList { "Medium" 300 "Fast" 150 "Instant" 0 "Slow" 600 } - rect 80 175 192 15 + rect CONTENT_X (CONTENT_Y+(5*ELEM_H)) CONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 128 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx CONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { - name game + name game group optionsGrp type ITEM_TYPE_YESNO text "Wallwalk Control Toggles:" cvar "cg_wwToggle" - rect 80 190 192 15 + rect CONTENT_X (CONTENT_Y+(6*ELEM_H)) CONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 128 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx CONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -265,16 +284,16 @@ type ITEM_TYPE_YESNO text "Disable Warning Dialogs:" cvar "cg_disableWarningDialogs" - rect 80 205 192 15 + rect CONTENT_X (CONTENT_Y+(7*ELEM_H)) CONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 128 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx CONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -285,19 +304,19 @@ type ITEM_TYPE_YESNO text "Tutorial Mode:" cvar "cg_tutorial" - rect 80 220 192 15 + rect CONTENT_X (CONTENT_Y+(8*ELEM_H)) CONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 128 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx CONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name game @@ -306,16 +325,16 @@ text "Show Clock:" cvar "cg_drawClock" cvarFloatList { "No" 0 "12 Hour" 1 "24 Hour" 2 } - rect 80 235 192 15 + rect CONTENT_X (CONTENT_Y+(9*ELEM_H)) CONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 128 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx CONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -327,16 +346,16 @@ text "Draw Crosshair:" cvar "cg_drawCrosshair" cvarFloatList { "Never" 0 "Ranged Weapons Only" 1 "Always" 2 } - rect 80 250 192 15 + rect CONTENT_X (CONTENT_Y+(10*ELEM_H)) CONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 128 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx CONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -349,17 +368,16 @@ text "Look" group optionsGrp style WINDOW_STYLE_EMPTY - rect 20 60 64 20 + rect 0 ((2*BORDER)+TOPBUTT_H+(0*SIDEBUTT_H)) SIDEBUTT_W SIDEBUTT_H type ITEM_TYPE_BUTTON textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 16 + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide optionsGrp; show controls; show look @@ -375,17 +393,16 @@ type ITEM_TYPE_BIND text "Lookup:" cvar "+lookup" - rect 96 85 192 15 + rect SCONTENT_X (SCONTENT_Y+(0*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -396,17 +413,16 @@ type ITEM_TYPE_BIND text "Look Down:" cvar "+lookdown" - rect 96 100 192 15 + rect SCONTENT_X (SCONTENT_Y+(1*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -417,20 +433,19 @@ type ITEM_TYPE_BIND text "Mouse Look:" cvar "+mlook" - rect 96 115 192 15 + rect SCONTENT_X (SCONTENT_Y+(2*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name look @@ -438,17 +453,16 @@ type ITEM_TYPE_BIND text "Centerview:" cvar "centerview" - rect 96 130 192 15 + rect SCONTENT_X (SCONTENT_Y+(3*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -459,17 +473,16 @@ type ITEM_TYPE_YESNO text "Free Look:" cvar "cl_freelook" - rect 96 145 192 15 + rect SCONTENT_X (SCONTENT_Y+(4*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -480,14 +493,13 @@ type ITEM_TYPE_SLIDER text "Mouse Sensitivity:" cvarfloat "sensitivity" 5 1 30 - rect 96 160 192 20 + rect SCONTENT_X (SCONTENT_Y+(5*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 15 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE } itemDef @@ -497,17 +509,16 @@ type ITEM_TYPE_YESNO text "Invert Mouse:" cvar "ui_mousePitch" - rect 96 180 192 15 + rect SCONTENT_X (SCONTENT_Y+(6*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 - action + visible MENU_FALSE + action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript update ui_mousePitch } } @@ -519,20 +530,19 @@ type ITEM_TYPE_YESNO text "Smooth Mouse:" cvar "m_filter" - rect 96 195 192 15 + rect SCONTENT_X (SCONTENT_Y+(7*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 - action + visible MENU_FALSE + action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + //////// MOVE itemDef @@ -541,17 +551,16 @@ text "Move" group optionsGrp style WINDOW_STYLE_EMPTY - rect 20 80 64 20 + rect 0 ((2*BORDER)+TOPBUTT_H+(1*SIDEBUTT_H)) SIDEBUTT_W SIDEBUTT_H type ITEM_TYPE_BUTTON textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 16 + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide optionsGrp; show controls; show move @@ -565,20 +574,19 @@ type ITEM_TYPE_YESNO text "Always Run:" cvar "cl_run" - rect 96 65 192 15 + rect SCONTENT_X (SCONTENT_Y+(0*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name move @@ -586,17 +594,16 @@ type ITEM_TYPE_BIND text "Run / Walk:" cvar "+speed" - rect 96 80 192 15 + rect SCONTENT_X (SCONTENT_Y+(1*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -607,17 +614,16 @@ type ITEM_TYPE_BIND text "Sprint:" cvar "boost" - rect 96 95 192 15 + rect SCONTENT_X (SCONTENT_Y+(2*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -628,17 +634,16 @@ type ITEM_TYPE_BIND text "Forward:" cvar "+forward" - rect 96 110 192 15 + rect SCONTENT_X (SCONTENT_Y+(3*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -649,20 +654,19 @@ type ITEM_TYPE_BIND text "Backpedal:" cvar "+back" - rect 96 125 192 15 + rect SCONTENT_X (SCONTENT_Y+(4*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name move @@ -670,17 +674,16 @@ type ITEM_TYPE_BIND text "Move Left:" cvar "+moveleft" - rect 96 140 192 15 + rect SCONTENT_X (SCONTENT_Y+(5*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -691,17 +694,16 @@ type ITEM_TYPE_BIND text "Move Right:" cvar "+moveright" - rect 96 155 192 15 + rect SCONTENT_X (SCONTENT_Y+(6*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -712,17 +714,16 @@ type ITEM_TYPE_BIND text "Jump:" cvar "+moveup" - rect 96 170 192 15 + rect SCONTENT_X (SCONTENT_Y+(7*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -733,17 +734,16 @@ type ITEM_TYPE_BIND text "Crouch:" cvar "+movedown" - rect 96 185 192 15 + rect SCONTENT_X (SCONTENT_Y+(8*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -754,17 +754,16 @@ type ITEM_TYPE_BIND text "Turn Left:" cvar "+left" - rect 96 200 192 15 + rect SCONTENT_X (SCONTENT_Y+(9*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -775,20 +774,19 @@ type ITEM_TYPE_BIND text "Turn Right:" cvar "+right" - rect 96 215 192 15 + rect SCONTENT_X (SCONTENT_Y+(10*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name move @@ -796,17 +794,16 @@ type ITEM_TYPE_BIND text "Strafe:" cvar "+strafe" - rect 96 230 192 15 + rect SCONTENT_X (SCONTENT_Y+(11*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -820,17 +817,16 @@ text "Upgrades" group optionsGrp style WINDOW_STYLE_EMPTY - rect 20 100 64 20 + rect 0 ((2*BORDER)+TOPBUTT_H+(2*SIDEBUTT_H)) SIDEBUTT_W SIDEBUTT_H type ITEM_TYPE_BUTTON textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 16 + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide optionsGrp; show controls; show upgrades @@ -839,43 +835,41 @@ itemDef { - name upgrades + name upgrades group optionsGrp type ITEM_TYPE_BIND text "Primary Attack:" cvar "+attack" - rect 96 90 192 15 + rect SCONTENT_X (SCONTENT_Y+(0*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } itemDef { - name upgrades + name upgrades group optionsGrp type ITEM_TYPE_BIND text "Secondary Attack:" cvar "+button5" - rect 96 105 192 15 + rect SCONTENT_X (SCONTENT_Y+(1*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -886,17 +880,16 @@ type ITEM_TYPE_BIND text "Previous Upgrade:" cvar "weapprev" - rect 96 120 192 15 + rect SCONTENT_X (SCONTENT_Y+(2*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -907,20 +900,19 @@ type ITEM_TYPE_BIND text "Next Upgrade:" cvar "weapnext" - rect 96 135 192 15 + rect SCONTENT_X (SCONTENT_Y+(3*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name upgrades @@ -928,20 +920,19 @@ type ITEM_TYPE_BIND text "Activate Upgrade:" cvar "+button2" - rect 96 150 192 15 + rect SCONTENT_X (SCONTENT_Y+(4*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name upgrades @@ -949,20 +940,19 @@ type ITEM_TYPE_BIND text "Reload:" cvar "reload" - rect 96 165 192 15 + rect SCONTENT_X (SCONTENT_Y+(5*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name upgrades @@ -970,20 +960,19 @@ type ITEM_TYPE_BIND text "Buy Ammo:" cvar "buy ammo" - rect 96 180 192 15 + rect SCONTENT_X (SCONTENT_Y+(6*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name upgrades @@ -991,20 +980,19 @@ type ITEM_TYPE_BIND text "Use Medkit:" cvar "itemact medkit" - rect 96 195 192 15 + rect SCONTENT_X (SCONTENT_Y+(7*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + //////// MISC itemDef @@ -1013,17 +1001,16 @@ text "Misc" group optionsGrp style WINDOW_STYLE_EMPTY - rect 20 120 64 20 + rect 0 ((2*BORDER)+TOPBUTT_H+(3*SIDEBUTT_H)) SIDEBUTT_W SIDEBUTT_H type ITEM_TYPE_BUTTON textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 16 + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide optionsGrp; show controls; show misc @@ -1037,20 +1024,19 @@ type ITEM_TYPE_BIND text "Show Scores:" cvar "+scores" - rect 96 65 192 15 + rect SCONTENT_X (SCONTENT_Y+(0*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name misc @@ -1058,20 +1044,19 @@ type ITEM_TYPE_BIND text "Scroll Scores Up:" cvar "scoresUp" - rect 96 80 192 15 + rect SCONTENT_X (SCONTENT_Y+(1*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name misc @@ -1079,17 +1064,16 @@ type ITEM_TYPE_BIND text "Scroll Scores Down:" cvar "scoresDown" - rect 96 95 192 15 + rect SCONTENT_X (SCONTENT_Y+(2*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1100,20 +1084,19 @@ type ITEM_TYPE_BIND text "Use Structure/Evolve:" cvar "+button7" - rect 96 110 192 15 + rect SCONTENT_X (SCONTENT_Y+(3*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name misc @@ -1121,20 +1104,19 @@ type ITEM_TYPE_BIND text "Deconstruct Structure:" cvar "deconstruct" - rect 96 125 192 15 + rect SCONTENT_X (SCONTENT_Y+(4*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name misc @@ -1142,20 +1124,19 @@ type ITEM_TYPE_BIND text "Gesture:" cvar "+button3" - rect 96 140 192 15 + rect SCONTENT_X (SCONTENT_Y+(5*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name misc @@ -1163,17 +1144,16 @@ type ITEM_TYPE_BIND text "Chat:" cvar "messagemode" - rect 96 155 192 15 + rect SCONTENT_X (SCONTENT_Y+(6*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1184,17 +1164,16 @@ type ITEM_TYPE_BIND text "Team Chat:" cvar "messagemode2" - rect 96 170 192 15 + rect SCONTENT_X (SCONTENT_Y+(7*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1205,17 +1184,16 @@ type ITEM_TYPE_BIND text "Target Chat:" cvar "messagemode3" - rect 96 185 192 15 + rect SCONTENT_X (SCONTENT_Y+(8*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1226,17 +1204,16 @@ type ITEM_TYPE_BIND text "Attack Chat:" cvar "messagemode4" - rect 96 200 192 15 + rect SCONTENT_X (SCONTENT_Y+(9*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1247,17 +1224,16 @@ type ITEM_TYPE_BIND text "Vote Yes:" cvar "vote yes" - rect 96 215 192 15 + rect SCONTENT_X (SCONTENT_Y+(10*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1268,17 +1244,16 @@ type ITEM_TYPE_BIND text "Vote No:" cvar "vote no" - rect 96 230 192 15 + rect SCONTENT_X (SCONTENT_Y+(11*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1289,17 +1264,16 @@ type ITEM_TYPE_BIND text "Team Vote Yes:" cvar "teamvote yes" - rect 96 245 192 15 + rect SCONTENT_X (SCONTENT_Y+(12*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1310,17 +1284,16 @@ type ITEM_TYPE_BIND text "Team Vote No:" cvar "teamvote no" - rect 96 260 192 15 + rect SCONTENT_X (SCONTENT_Y+(13*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - maxPaintChars 20 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1335,17 +1308,16 @@ text "GFX Hardware" group optionsGrp style WINDOW_STYLE_EMPTY - rect 20 60 64 20 + rect 0 ((2*BORDER)+TOPBUTT_H+(0*SIDEBUTT_H)) SIDEBUTT_W SIDEBUTT_H type ITEM_TYPE_BUTTON textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 16 + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide optionsGrp; show system; show ghardware @@ -1356,22 +1328,22 @@ itemDef { - name ghardware + name ghardware group optionsGrp type ITEM_TYPE_MULTI text "Quality:" cvar "ui_glCustom" cvarFloatList { "High Quality" 0 "Normal" 1 "Fast" 2 "Fastest" 3 "Custom" 4 } - rect 96 50 192 15 + rect SCONTENT_X (SCONTENT_Y+(0*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript update "ui_glCustom" } } @@ -1380,41 +1352,23 @@ { name ghardware group optionsGrp - type ITEM_TYPE_EDITFIELD - text "GL Driver:" - cvar "r_gldriver" - //cvarFloatList { } - rect 96 65 192 15 - textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 - forecolor 1 1 1 1 - visible 0 - decoration - } - - itemDef - { - name ghardware - group optionsGrp type ITEM_TYPE_YESNO text "GL Extensions:" cvar "r_allowExtensions" - rect 96 80 192 15 + rect SCONTENT_X (SCONTENT_Y+(1*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript glCuston } } - + itemDef { name ghardware @@ -1425,16 +1379,16 @@ cvarFloatList { "320x240" 0 "400x300" 1 "512x384" 2 "640x480" 3 "800x600" 4 "960x720" 5 "1024x768" 6 "1152x864" 7 "1280x1024" 8 "1600x1200" 9 "2048x1536" 10 "856x480 wide screen" 11 } - rect 96 95 192 15 + rect SCONTENT_X (SCONTENT_Y+(2*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript glCustom } } @@ -1447,16 +1401,16 @@ text "Color Depth:" cvar "r_colorbits" cvarFloatList { "Default" 0 "16 bit" 16 "32 bit" 32 } - rect 96 110 192 15 + rect SCONTENT_X (SCONTENT_Y+(3*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript glCustom; uiScript update "r_colorbits" } @@ -1469,16 +1423,16 @@ type ITEM_TYPE_YESNO text "Fullscreen:" cvar "r_fullscreen" - rect 96 125 192 15 + rect SCONTENT_X (SCONTENT_Y+(4*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript glCustom } } @@ -1491,16 +1445,16 @@ text "Lighting:" cvar "r_vertexlight" cvarFloatList { "Light Map (high)" 0 "Vertex (low)" 1 } - rect 96 140 192 15 + rect SCONTENT_X (SCONTENT_Y+(5*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript glCustom } } @@ -1513,16 +1467,16 @@ text "Geometric Detail:" cvar "r_lodbias" cvarFloatList { "High" 0 "Medium" 1 "Low" 2 } - rect 96 155 192 15 + rect SCONTENT_X (SCONTENT_Y+(6*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript glCustom; uiScript update "r_lodbias" } @@ -1536,20 +1490,20 @@ text "Texture Detail:" cvar "r_picmip" cvarFloatList { "Low" 2 "Normal" 1 "High" 0 } - rect 96 170 192 15 + rect SCONTENT_X (SCONTENT_Y+(7*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript glCustom } } - + itemDef { name ghardware @@ -1558,16 +1512,16 @@ text "Texture Quality:" cvar "r_texturebits" cvarFloatList { "Default" 0 "16 bit" 16 "32 bit" 32 } - rect 96 185 192 15 + rect SCONTENT_X (SCONTENT_Y+(8*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1579,16 +1533,16 @@ text "Texture Filter:" cvar "r_texturemode" cvarStrList { "Bilinear", "GL_LINEAR_MIPMAP_NEAREST", "Trilinear", "GL_LINEAR_MIPMAP_LINEAR" } - rect 96 200 192 15 + rect SCONTENT_X (SCONTENT_Y+(9*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript glCustom } } @@ -1600,16 +1554,16 @@ type ITEM_TYPE_YESNO text "Anisotropic Filtering:" cvar "r_ext_texture_filter_anisotropic" - rect 96 215 192 15 + rect SCONTENT_X (SCONTENT_Y+(10*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript glCustom } } @@ -1621,16 +1575,16 @@ type ITEM_TYPE_YESNO text "Compress Textures:" cvar "r_ext_compressed_textures " - rect 96 230 192 15 + rect SCONTENT_X (SCONTENT_Y+(11*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript glCustom } } @@ -1643,15 +1597,14 @@ text "APPLY" textscale .25 style WINDOW_STYLE_EMPTY - rect 144 245 75 20 + rect SCONTENT_X (SCONTENT_Y+(13*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_CENTER - textalignx 37 - textaligny 15 + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; exec "vid_restart" } } @@ -1664,17 +1617,16 @@ text "GFX Software" group optionsGrp style WINDOW_STYLE_EMPTY - rect 20 80 64 20 + rect 0 ((2*BORDER)+TOPBUTT_H+(1*SIDEBUTT_H)) SIDEBUTT_W SIDEBUTT_H type ITEM_TYPE_BUTTON textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 16 + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide optionsGrp; show system; show gsoftware @@ -1688,13 +1640,13 @@ type ITEM_TYPE_SLIDER text "Brightness:" cvarfloat "r_gamma" 1 .5 2 - rect 96 60 192 20 + rect SCONTENT_X (SCONTENT_Y+(0*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 80 - textaligny 17 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE } itemDef @@ -1704,34 +1656,13 @@ type ITEM_TYPE_SLIDER text "Screen Size:" cvarfloat "cg_viewsize" 100 30 100 - //cvarFloatList { } - rect 96 80 192 20 - textalign ITEM_ALIGN_RIGHT - textalignx 80 - textaligny 17 - textscale .25 - forecolor 1 1 1 1 - visible 0 - } - - itemDef - { - name gsoftware - group optionsGrp - type ITEM_TYPE_YESNO - text "Simple Items:" - cvar "cg_simpleItems" - rect 96 100 192 15 + rect SCONTENT_X (SCONTENT_Y+(1*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 1 - action - { - play "sound/misc/menu1.wav"; - } + visible MENU_FALSE } itemDef @@ -1741,19 +1672,19 @@ type ITEM_TYPE_YESNO text "Marks On Walls:" cvar "cg_marks" - rect 96 115 192 15 + rect SCONTENT_X (SCONTENT_Y+(2*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } - + itemDef { name gsoftware @@ -1761,16 +1692,16 @@ type ITEM_TYPE_YESNO text "Dynamic Lights:" cvar "r_dynamiclight" - rect 96 130 192 15 + rect SCONTENT_X (SCONTENT_Y+(3*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1781,16 +1712,16 @@ type ITEM_TYPE_YESNO text "Draw Gun:" cvar "cg_drawGun" - rect 96 145 192 15 + rect SCONTENT_X (SCONTENT_Y+(4*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1801,16 +1732,16 @@ type ITEM_TYPE_YESNO text "Low Quality Sky:" cvar "r_fastsky" - rect 96 160 192 15 + rect SCONTENT_X (SCONTENT_Y+(5*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1820,17 +1751,17 @@ group optionsGrp type ITEM_TYPE_YESNO text "Sync Every Frame:" - cvar "weapon 5" - rect 96 175 192 15 + cvar "r_finish" + rect SCONTENT_X (SCONTENT_Y+(6*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1841,98 +1772,98 @@ type ITEM_TYPE_YESNO text "Show Time:" cvar "cg_drawTimer" - rect 96 190 192 15 + rect SCONTENT_X (SCONTENT_Y+(7*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } itemDef { - name gsoftware + name gsoftware group optionsGrp type ITEM_TYPE_YESNO text "In Game Videos:" cvar "r_inGameVideo" - rect 96 205 192 15 + rect SCONTENT_X (SCONTENT_Y+(8*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } itemDef { - name gsoftware + name gsoftware group optionsGrp type ITEM_TYPE_YESNO text "Depth Sort Particles:" cvar "cg_depthSortParticles" - rect 96 220 192 15 + rect SCONTENT_X (SCONTENT_Y+(9*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } itemDef { - name gsoftware + name gsoftware group optionsGrp type ITEM_TYPE_MULTI text "Particle Physics:" cvar "cg_bounceParticles" cvarFloatList { "Low Quality" 0 "High Quality" 1 } - rect 96 235 192 15 + rect SCONTENT_X (SCONTENT_Y+(10*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } itemDef { - name gsoftware + name gsoftware group optionsGrp type ITEM_TYPE_MULTI text "Light Flares:" cvar "cg_lightFlare" cvarFloatList { "Off" 0 "No Fade" 1 "Timed Fade" 2 "Real Fade" 3 } - rect 96 250 192 15 + rect SCONTENT_X (SCONTENT_Y+(11*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -1941,20 +1872,19 @@ itemDef { name system - text "GL Info" + text "OpenGL Info" group optionsGrp style WINDOW_STYLE_EMPTY - rect 20 100 64 20 + rect 0 ((2*BORDER)+TOPBUTT_H+(2*SIDEBUTT_H)) SIDEBUTT_W SIDEBUTT_H type ITEM_TYPE_BUTTON textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 16 + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide optionsGrp; show system; show glinfo @@ -1965,36 +1895,36 @@ { name glinfo group optionsGrp - rect 104 35 230 230 - ownerdraw UI_GLINFO - textalign 1 - textscale .15 - textalignx 0 - textaligny 17 + rect SCONTENT_X SCONTENT_Y SCONTENT_W (H-(SCONTENT_Y+BORDER)) + ownerdraw UI_GLINFO + textscale .25 + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_TOP + textalignx 4 + textaligny 4 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE decoration } //////// NET & SOUND - + itemDef { name system text "Net & Sound" group optionsGrp style WINDOW_STYLE_EMPTY - rect 20 120 64 20 + rect 0 ((2*BORDER)+TOPBUTT_H+(3*SIDEBUTT_H)) SIDEBUTT_W SIDEBUTT_H type ITEM_TYPE_BUTTON textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 16 + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; hide optionsGrp; show system; show netsound @@ -2003,21 +1933,20 @@ itemDef { - name netsound + name netsound group optionsGrp - style 1 + style WINDOW_STYLE_FILLED text "Sound" - rect 96 50 192 20 + rect SCONTENT_X (SCONTENT_Y+(0*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_CENTER - textalignx 80 - textaligny 17 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE decoration action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -2028,15 +1957,15 @@ type ITEM_TYPE_SLIDER text "Effects Volume:" cvarfloat "s_volume" 0.7 0 1 - rect 96 70 192 20 + rect SCONTENT_X (SCONTENT_Y+(1*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - textaligny 17 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE } - + itemDef { name netsound @@ -2044,32 +1973,32 @@ type ITEM_TYPE_SLIDER text "Music Volume:" cvarfloat "s_musicvolume" 0.25 0 1 - rect 96 90 192 20 + rect SCONTENT_X (SCONTENT_Y+(2*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 90 - textaligny 17 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE } itemDef { name netsound group optionsGrp - type ITEM_TYPE_YESNO + type ITEM_TYPE_YESNO text "OpenAL:" cvar "s_useOpenAL" - rect 96 120 192 15 + rect SCONTENT_X (SCONTENT_Y+(3*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -2077,20 +2006,20 @@ { name netsound group optionsGrp - type ITEM_TYPE_MULTI + type ITEM_TYPE_MULTI text "Sound Quality:" cvar "s_khz" cvarFloatList { "44 khz (very high)" 44 "22 khz (high)" 22 "11 khz (low)" 11 } - rect 96 135 192 15 + rect SCONTENT_X (SCONTENT_Y+(4*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -2098,19 +2027,19 @@ { name netsound group optionsGrp - type ITEM_TYPE_YESNO + type ITEM_TYPE_YESNO text "Doppler Sound:" cvar "s_doppler" - rect 96 150 192 15 + rect SCONTENT_X (SCONTENT_Y+(5*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 12 - textscale .25 + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -2118,41 +2047,39 @@ { name netsound group optionsGrp - type ITEM_TYPE_BUTTON - text "APPLY" - textscale .25 - style WINDOW_STYLE_EMPTY - rect 155 170 75 20 + style WINDOW_STYLE_FILLED + text "Network" + rect SCONTENT_X (SCONTENT_Y+(7*ELEM_H)) SCONTENT_W ELEM_H textalign ITEM_ALIGN_CENTER - textalignx 37 - textaligny 15 + textvalign ITEM_VALIGN_CENTER + textscale .25 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE + decoration action { - play "sound/misc/menu1.wav"; - exec "snd_restart" + play "sound/misc/menu1.wav"; } } - itemDef { - name netsound + name netsound group optionsGrp - style 1 - text "Network" - rect 96 200 192 20 - textalign ITEM_ALIGN_CENTER - textalignx 80 - textaligny 17 - textscale .25 + type ITEM_TYPE_MULTI + text "Net Data Rate:" + cvar "rate" + cvarFloatList { "<=28.8k" 2500 "33.6k" 3000 "56k" 4000 "ISDN" 5000 "LAN/CABLE/xDSl" 25000 } + rect SCONTENT_X (SCONTENT_Y+(8*ELEM_H)) SCONTENT_W ELEM_H + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textalignx SCONTENT_OFF + textscale .25 forecolor 1 1 1 1 - visible 0 - decoration + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; } } @@ -2160,20 +2087,19 @@ { name netsound group optionsGrp - type ITEM_TYPE_MULTI - text "Net Data Rate:" - cvar "rate" - cvarFloatList { "<=28.8k" 2500 "33.6k" 3000 "56k" 4000 "ISDN" 5000 "LAN/CABLE/xDSl" 25000 } - rect 96 220 192 20 - textalign ITEM_ALIGN_RIGHT - textalignx 100 - textaligny 17 - textscale .25 + type ITEM_TYPE_BUTTON + text "APPLY" + textscale .25 + style WINDOW_STYLE_EMPTY + rect SCONTENT_X (SCONTENT_Y+(10*ELEM_H)) SCONTENT_W ELEM_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; + exec "snd_restart" } } } diff --git a/ui/joinserver.menu b/ui/joinserver.menu index 499348dd..e169183e 100644 --- a/ui/joinserver.menu +++ b/ui/joinserver.menu @@ -4,83 +4,74 @@ \\ Server Join \\ +#define W 640 +#define H 480 +#define BORDER 10 + +#define PREVIEW_W 112 +#define PREVIEW_H 84 +#define TOP_W (W-((2*BORDER)+PREVIEW_W)) +#define TOP_H PREVIEW_H +#define TOP_X BORDER +#define TOP_Y BORDER +#define TOPBUTT_W (TOP_W/3) +#define TOPBUTT_H (TOP_H/2) +#define TOP_TOFF_X 20 +#define TOP_TOFF_Y 10 + +#define BCJ_W (W-(2*BORDER)) +#define BCJ_H 50 +#define BCJ_X BORDER +#define BCJ_Y (H-(BCJ_H+BORDER)) +#define ARROW_W 50 +#define ARROW_H BCJ_H + +#define BOT_W (W-(2*BORDER)) +#define BOT_H 45 +#define BOT_X BORDER +#define BOT_Y (BCJ_Y-BOT_H) +#define BOTBUTT_W (BOT_W/5) +#define BOTBUTT_H BOT_H + +#define SERVER_C 0.6 +#define MAP_C 0.2 +#define PLAYERS_C 0.1 +#define PING_C 0.1 +#define LIST_W (W-(2*BORDER)) +#define LIST_H (H-((2*BORDER)+TOP_H+BOT_H+BCJ_H)) +#define LIST_X BORDER +#define LIST_Y (BORDER+TOP_H) +#define LIST_TOFF 5 +#define HEADFOOT_H 25 + menuDef { name "joinserver" - visible 0 - fullscreen 1 - rect 0 0 640 480 + visible MENU_FALSE + fullscreen MENU_TRUE + rect 0 0 W H focusColor 1 .75 0 1 - outOfBoundsClick - style 0 + outOfBoundsClick + style WINDOW_STYLE_EMPTY onOpen { uiScript InitServerList 3; - hide accept_alt; + hide accept_alt; show accept; hide back_alt; show back; uiScript UpdateFilter } - + onEsc { uiScript closeJoin } itemDef { name background - rect 0 0 640 480 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 - decoration - } - - // DATE AND MESSAGE OF THE DAY // - - itemDef - { - name datewindow - rect 10 365 265 25 - style WINDOW_STYLE_FILLED - border 1 - bordercolor .5 .5 .5 1 - backcolor 0 0 0 .15 - visible 1 - } - - itemDef - { - name messagewindow - rect 275 365 355 25 - style WINDOW_STYLE_FILLED - border 1 - bordercolor .5 .5 .5 1 - backcolor 0 0 0 .15 - visible 1 - } - - itemDef - { - name refreshdate - ownerdraw UI_SERVERREFRESHDATE - textscale .33 - rect 10 365 265 25 - textalign 0 - textalignx 10 - textaligny 20 - forecolor 1 1 1 1 - visible 1 - decoration - } - - itemDef - { - name messageoftheday - ownerdraw UI_SERVERMOTD - textscale .33 - rect 280 365 345 25 - forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE decoration } @@ -90,16 +81,18 @@ itemDef { name gametypefield + text "Source:" style WINDOW_STYLE_EMPTY ownerdraw UI_NETSOURCE - rect 26 20 128 26 - textalign ITEM_ALIGN_LEFT - textalignx 10 - textaligny 22 + rect TOP_X TOP_Y TOPBUTT_W TOPBUTT_H + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_TOP + textalignx TOP_TOFF_X + textaligny TOP_TOFF_Y textscale .4 forecolor 1 1 1 1 backcolor .5 .5 .5 .5 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav" @@ -115,18 +108,19 @@ type ITEM_TYPE_BUTTON textscale .4 style WINDOW_STYLE_EMPTY - rect 190 20 128 26 + rect (TOP_X+TOPBUTT_W) TOP_Y TOPBUTT_W TOPBUTT_H textalign ITEM_ALIGN_LEFT - textalignx 10 - textaligny 22 + textvalign ITEM_VALIGN_TOP + textalignx TOP_TOFF_X + textaligny TOP_TOFF_Y backcolor .5 .5 .5 .5 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; uiScript RefreshServers - } + } } itemDef @@ -136,18 +130,19 @@ textscale .4 style WINDOW_STYLE_EMPTY type ITEM_TYPE_BUTTON - rect 354 20 128 26 + rect (TOP_X+(2*TOPBUTT_W)) TOP_Y TOPBUTT_W TOPBUTT_H textalign ITEM_ALIGN_LEFT - textalignx 10 - textaligny 22 + textvalign ITEM_VALIGN_TOP + textalignx TOP_TOFF_X + textaligny TOP_TOFF_Y backcolor .5 .5 .5 .5 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; uiScript RefreshFilter - } + } } itemDef @@ -158,20 +153,21 @@ text "View Empty:" cvar "ui_browserShowEmpty" textscale .4 - rect 26 50 128 26 + rect TOP_X (TOP_Y+TOPBUTT_H) TOPBUTT_W TOPBUTT_H textalign ITEM_ALIGN_LEFT - textalignx 10 - textaligny 22 + textvalign ITEM_VALIGN_TOP + textalignx TOP_TOFF_X + textaligny TOP_TOFF_Y forecolor 1 1 1 1 backcolor .5 .5 .5 .5 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; uiScript RefreshFilter } } - + itemDef { name viewFull @@ -180,13 +176,14 @@ text "View Full:" cvar "ui_browserShowFull" textscale .4 - rect 190 50 128 26 + rect (TOP_X+TOPBUTT_W) (TOP_Y+TOPBUTT_H) TOPBUTT_W TOPBUTT_H textalign ITEM_ALIGN_LEFT - textalignx 10 - textaligny 22 + textvalign ITEM_VALIGN_TOP + textalignx TOP_TOFF_X + textaligny TOP_TOFF_Y forecolor 1 1 1 1 backcolor .5 .5 .5 .5 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; @@ -195,115 +192,21 @@ } - // map selection + // MAP PREVIEW // itemDef { name mappreview - style 0 + style WINDOW_STYLE_EMPTY ownerdraw UI_NETMAPCINEMATIC - rect 502 5 128 96 - border 1 - bordercolor 0 .5 0 .5 - visible 1 - } - - itemDef - { - name mappreview - style WINDOW_STYLE_FILLED - rect 502 5 128 96 - border 1 - bordercolor .5 .5 .5 .5 - visible 1 - } - - // COLUMNS // - - itemDef - { - name serverColumn - group grpColumn - rect 10 130 365 232 - style WINDOW_STYLE_FILLED - border 1 - backcolor 0 0 0 0 - bordersize 1 - bordercolor .5 .5 .5 1 - visible 1 - decoration - } - - itemDef - { - name mapColumn - group grpColumn - rect 375 130 125 232 - style WINDOW_STYLE_FILLED - border 1 - backcolor 0 0 0 0 - bordersize 1 - bordercolor .5 .5 .5 1 - visible 1 - decoration - } - - itemDef - { - name playerColumn - group grpColumn - rect 500 130 60 232 - style WINDOW_STYLE_FILLED - border 1 - backcolor 0 0 0 0 - bordersize 1 + rect (W-(PREVIEW_W+BORDER)) BORDER PREVIEW_W PREVIEW_H + border WINDOW_BORDER_FULL bordercolor .5 .5 .5 1 - visible 1 - decoration - } - - itemDef - { - name pingColumn - group grpColumn - rect 560 130 52 232 - style WINDOW_STYLE_FILLED - border 1 - backcolor 0 0 0 0 - bordersize 1 - bordercolor .5 .5 .5 1 - visible 1 - decoration + visible MENU_TRUE } - itemDef - { - name serverlist - rect 10 130 620 232 - type ITEM_TYPE_LISTBOX - style WINDOW_STYLE_EMPTY - elementwidth 120 - elementheight 20 - textscale .33 - elementtype LISTBOX_TEXT - feeder FEEDER_SERVERS - border 1 - bordercolor 0.5 0.5 0.5 1 - forecolor 1 1 1 1 - backcolor 0.2 0.2 0.2 1 - outlinecolor 0.1 0.1 0.1 0.5 - visible 1 - columns 4 - 2 355 ITEM_ALIGN_LEFT - 375 100 ITEM_ALIGN_LEFT - 500 40 ITEM_ALIGN_LEFT - 560 30 ITEM_ALIGN_LEFT - - doubleClick { uiScript JoinServer } - } - - // SORT TABS // + // COLUMNS // itemDef { @@ -313,82 +216,123 @@ type ITEM_TYPE_BUTTON textscale .33 style WINDOW_STYLE_EMPTY - rect 10 103 365 26 + rect LIST_X LIST_Y (SERVER_C*LIST_W) HEADFOOT_H textalign ITEM_ALIGN_LEFT - textalignx 10 - textaligny 18 - border 1 + textvalign ITEM_VALIGN_CENTER + textalignx LIST_TOFF + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 1 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; - uiScript ServerSort 0; - - setitemcolor grpColumn backcolor 0 0 0 0; + play "sound/misc/menu1.wav"; + uiScript ServerSort 0; + + setitemcolor grpColumn backcolor 0 0 0 0; setitemcolor serverColumn backcolor 0.3 1 1 0.5 } } itemDef { + name serverColumn + group grpColumn + rect LIST_X (LIST_Y+HEADFOOT_H) (SERVER_C*LIST_W) (LIST_H-(2*HEADFOOT_H)) + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_FULL + backcolor 0 0 0 0 + bordersize 1 + bordercolor .5 .5 .5 1 + visible MENU_TRUE + decoration + } + + itemDef + { name map group grpTabs type ITEM_TYPE_BUTTON text "Map Name" textscale .33 style WINDOW_STYLE_EMPTY - rect 375 103 125 26 + rect (LIST_X+(SERVER_C*LIST_W)) LIST_Y (MAP_C*LIST_W) HEADFOOT_H textalign ITEM_ALIGN_LEFT - textalignx 10 - textaligny 18 - border 1 + textvalign ITEM_VALIGN_CENTER + textalignx LIST_TOFF + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 1 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; - uiScript ServerSort 1; - - setitemcolor grpColumn backcolor 0 0 0 0; + play "sound/misc/menu1.wav"; + uiScript ServerSort 1; + + setitemcolor grpColumn backcolor 0 0 0 0; setitemcolor mapColumn backcolor 0.3 1 1 0.5 } } itemDef { + name mapColumn + group grpColumn + rect (LIST_X+(SERVER_C*LIST_W)) (LIST_Y+HEADFOOT_H) (MAP_C*LIST_W) (LIST_H-(2*HEADFOOT_H)) + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_FULL + backcolor 0 0 0 0 + bordersize 1 + bordercolor .5 .5 .5 1 + visible MENU_TRUE + decoration + } + + itemDef + { name Players group grpTabs text "Players" type ITEM_TYPE_BUTTON textscale .33 style WINDOW_STYLE_EMPTY - rect 500 103 60 26 + rect (LIST_X+((SERVER_C+MAP_C)*LIST_W)) LIST_Y (PLAYERS_C*LIST_W) HEADFOOT_H textalign ITEM_ALIGN_LEFT - textalignx 10 - textaligny 18 - border 1 + textvalign ITEM_VALIGN_CENTER + textalignx LIST_TOFF + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 1 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; - uiScript ServerSort 2; - - setitemcolor grpColumn backcolor 0 0 0 0; + play "sound/misc/menu1.wav"; + uiScript ServerSort 2; + + setitemcolor grpColumn backcolor 0 0 0 0; setitemcolor playerColumn backcolor 0.3 1 1 0.5 } } + itemDef + { + name playerColumn + group grpColumn + rect (LIST_X+((SERVER_C+MAP_C)*LIST_W)) (LIST_Y+HEADFOOT_H) (PLAYERS_C*LIST_W) (LIST_H-(2*HEADFOOT_H)) + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_FULL + backcolor 0 0 0 0 + bordersize 1 + bordercolor .5 .5 .5 1 + visible MENU_TRUE + decoration + } itemDef { @@ -398,44 +342,121 @@ type ITEM_TYPE_BUTTON textscale .33 style WINDOW_STYLE_EMPTY - rect 560 103 70 26 + rect (LIST_X+((SERVER_C+MAP_C+PLAYERS_C)*LIST_W)) LIST_Y (PING_C*LIST_W) HEADFOOT_H textalign ITEM_ALIGN_LEFT - textalignx 10 - textaligny 18 - border 1 + textvalign ITEM_VALIGN_CENTER + textalignx LIST_TOFF + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 1 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; - uiScript ServerSort 3; - - setitemcolor grpColumn backcolor 0 0 0 0; + play "sound/misc/menu1.wav"; + uiScript ServerSort 3; + + setitemcolor grpColumn backcolor 0 0 0 0; setitemcolor pingColumn backcolor 0.3 1 1 0.5 } } + itemDef + { + name pingColumn + group grpColumn + rect (LIST_X+((SERVER_C+MAP_C+PLAYERS_C)*LIST_W)) (LIST_Y+HEADFOOT_H) (PING_C*LIST_W) (LIST_H-(2*HEADFOOT_H)) + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_FULL + backcolor 0 0 0 0 + bordersize 1 + bordercolor .5 .5 .5 1 + visible MENU_TRUE + decoration + } + + // SERVER LIST // + + itemDef + { + name serverlist + rect LIST_X (LIST_Y+HEADFOOT_H) LIST_W (LIST_H-(2*HEADFOOT_H)) + type ITEM_TYPE_LISTBOX + style WINDOW_STYLE_EMPTY + elementwidth 120 + elementheight 20 + textscale .33 + elementtype LISTBOX_TEXT + feeder FEEDER_SERVERS + border WINDOW_BORDER_FULL + bordercolor 0.5 0.5 0.5 1 + forecolor 1 1 1 1 + backcolor 0.2 0.2 0.2 1 + outlinecolor 0.1 0.1 0.1 0.5 + visible MENU_TRUE + columns 4 + LIST_TOFF ((SERVER_C*LIST_W)-(3*LIST_TOFF)) ITEM_ALIGN_LEFT + (LIST_TOFF+((SERVER_C)*LIST_W)) ((MAP_C*LIST_W)-(3*LIST_TOFF)) ITEM_ALIGN_LEFT + (LIST_TOFF+((SERVER_C+MAP_C)*LIST_W)) ((PLAYERS_C*LIST_W)-(3*LIST_TOFF)) ITEM_ALIGN_LEFT + (LIST_TOFF+((SERVER_C+MAP_C+PLAYERS_C)*LIST_W)) ((PING_C*LIST_W)-(3*LIST_TOFF)) ITEM_ALIGN_LEFT + + doubleClick { uiScript JoinServer } + } + + + // DATE AND MESSAGE OF THE DAY // + + itemDef + { + name refreshdate + ownerdraw UI_SERVERREFRESHDATE + textscale .33 + rect LIST_X (LIST_Y+(LIST_H-HEADFOOT_H)) (LIST_W/2) HEADFOOT_H + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER + textalignx LIST_TOFF + forecolor 1 1 1 1 + border WINDOW_BORDER_FULL + bordercolor .5 .5 .5 1 + visible MENU_TRUE + decoration + } + + itemDef + { + name messageoftheday + ownerdraw UI_SERVERMOTD + textscale .33 + rect (LIST_X+(LIST_W/2)) (LIST_Y+(LIST_H-HEADFOOT_H)) (LIST_W/2) HEADFOOT_H + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER + textalignx LIST_TOFF + forecolor 1 1 1 1 + border WINDOW_BORDER_FULL + bordercolor .5 .5 .5 1 + visible MENU_TRUE + decoration + } + + + // BOTTOM BUTTONS // itemDef { name password - text "Password" + text "Set Password" type ITEM_TYPE_BUTTON textscale .4 - style WINDOW_STYLE_FILLED - rect 20 395 92 26 - textalign 1 - textalignx 46 // center - textaligny 22 - backcolor 0 0 0 1 + style WINDOW_STYLE_EMPTY + rect BOT_X BOT_Y BOTBUTT_W BOTBUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; open password_popmenu } } @@ -443,113 +464,105 @@ itemDef { name createFavorite - text "New Favorite" + text "Create Favorite" type ITEM_TYPE_BUTTON textscale .4 - style WINDOW_STYLE_FILLED - rect 148 395 92 26 - textalign 1 - textalignx 46 // center - textaligny 22 - backcolor 0 0 0 1 + style WINDOW_STYLE_EMPTY + rect (BOT_X+BOTBUTT_W) BOT_Y BOTBUTT_W BOTBUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; open createfavorite_popmenu } } - + itemDef { name addFavorite text "Add Favorite" type ITEM_TYPE_BUTTON textscale .4 - style WINDOW_STYLE_FILLED + style WINDOW_STYLE_EMPTY ownerdrawFlag UI_SHOW_NOTFAVORITESERVERS - rect 276 395 92 26 - textalign 1 - textalignx 46 // center - textaligny 22 - backcolor 0 0 0 1 + rect (BOT_X+(2*BOTBUTT_W)) BOT_Y BOTBUTT_W BOTBUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; - uiScript addFavorite + play "sound/misc/menu1.wav"; + uiScript addFavorite } } itemDef { name delfavorite - text "Del. Favorite" + text "Delete Favorite" type ITEM_TYPE_BUTTON textscale .4 - style WINDOW_STYLE_FILLED + style WINDOW_STYLE_EMPTY ownerdrawFlag UI_SHOW_FAVORITESERVERS - rect 276 395 92 26 - textalign 1 - textalignx 46 // center - textaligny 22 - backcolor 0 0 0 1 + rect (BOT_X+(2*BOTBUTT_W)) BOT_Y BOTBUTT_W BOTBUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript DeleteFavorite; uiScript UpdateFilter } } - + itemDef { name serverinfo text "Server Info" type ITEM_TYPE_BUTTON textscale .4 - style WINDOW_STYLE_FILLED - rect 404 395 92 26 - textalign 1 - textalignx 46 // center - textaligny 22 - backcolor 0 0 0 1 + style WINDOW_STYLE_EMPTY + rect (BOT_X+(3*BOTBUTT_W)) BOT_Y BOTBUTT_W BOTBUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; open serverinfo_popmenu } } - + itemDef { name findplayer - text "Find Friend" + text "Find a Friend" type ITEM_TYPE_BUTTON textscale .4 - style WINDOW_STYLE_FILLED - rect 532 395 92 26 - textalign 1 - textalignx 46 // center - textaligny 22 - backcolor 0 0 0 1 + style WINDOW_STYLE_EMPTY + rect (BOT_X+(4*BOTBUTT_W)) BOT_Y BOTBUTT_W BOTBUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; open findplayer_popmenu } } - + + // BACK CREATE JOIN // + itemDef { name createServer @@ -557,36 +570,32 @@ textscale .5 style WINDOW_STYLE_EMPTY type ITEM_TYPE_BUTTON - rect 254 436 128 26 - textalign ITEM_ALIGN_LEFT - textalignx 10 - textaligny 24 - backcolor .5 .5 .5 .5 + rect (BCJ_X+ARROW_W) BCJ_Y (BCJ_W-(2*ARROW_W)) BCJ_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; open createserver - } + } } - // BACK BAR // - itemDef { name back - style 3 + style WINDOW_STYLE_SHADER background "ui/assets/backarrow.tga" - rect 16 424 50 50 - visible 1 + rect BCJ_X BCJ_Y ARROW_H ARROW_W + visible MENU_TRUE action { - play "sound/misc/menu4.wav"; + play "sound/misc/menu4.wav"; close joinserver } - + mouseEnter { hide back; @@ -599,29 +608,29 @@ name back_alt style WINDOW_STYLE_SHADER background "ui/assets/backarrow_alt.tga" - rect 16 424 50 50 + rect BCJ_X BCJ_Y ARROW_H ARROW_W backcolor 0 0 0 0 forecolor 1 1 1 1 - visible 0 + visible MENU_FALSE type ITEM_TYPE_BUTTON - + text "Back" textalign ITEM_ALIGN_LEFT - textaligny 36 - textalignx 60 + textvalign ITEM_VALIGN_CENTER + textalignx ARROW_W textscale .6 - + mouseExit { hide back_alt; show back } - + action { - play "sound/misc/menu4.wav"; + play "sound/misc/menu4.wav"; close joinserver - } + } } @@ -630,21 +639,21 @@ itemDef { name accept - style 3 - rect 574 424 50 50 + style WINDOW_STYLE_SHADER + rect ((BCJ_X+BCJ_W)-ARROW_W) BCJ_Y ARROW_H ARROW_W background "ui/assets/forwardarrow.tga" backcolor 0 0 0 0 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE mouseEnter { hide accept; show accept_alt } - + action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript JoinServer } } @@ -653,29 +662,29 @@ { name accept_alt style WINDOW_STYLE_SHADER - rect 574 424 50 50 + rect ((BCJ_X+BCJ_W)-ARROW_W) BCJ_Y ARROW_H ARROW_W background "ui/assets/forwardarrow_alt.tga" backcolor 0 0 0 0 type ITEM_TYPE_BUTTON forecolor 1 1 1 1 - visible 0 - type ITEM_TYPE_BUTTON - + visible MENU_FALSE + type ITEM_TYPE_BUTTON + text "Join" - textalign ITEM_ALIGN_LEFT - textaligny 36 - textalignx -55 + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textalignx -ARROW_W textscale .6 - + mouseExit { hide accept_alt; show accept } - + action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript JoinServer } } diff --git a/ui/loading.menu b/ui/loading.menu index 80718529..f7f35cfa 100644 --- a/ui/loading.menu +++ b/ui/loading.menu @@ -1,9 +1,39 @@ #include "ui/menudef.h" { + +#define W 640 +#define H 480 +#define BORDER 10 + +#define SHOT_W 320 +#define SHOT_H 240 +#define SHOT_X (W-(BORDER+SHOT_W)) +#define SHOT_Y BORDER + +#define INFO_X BORDER +#define INFO_W (W-((3*BORDER)+SHOT_W)) +#define LEVEL_Y BORDER +#define LEVEL_H 30 +#define HOST_Y (LEVEL_H+(2*BORDER)) +#define HOST_H 30 +#define MOTD_Y (LEVEL_H+HOST_H+(3*BORDER)) +#define MOTD_H ((BORDER+SHOT_H)-MOTD_Y) + +#define MAIN_W (W-(2*BORDER)) +#define LABEL_W 180 +#define LABEL_X (W-(LABEL_W+BORDER)) +#define BAR_H ((H-((6*BORDER)+SHOT_H))/4) +#define BAR_W (MAIN_W-(LABEL_W+BORDER)) +#define BAR_X BORDER +#define MEDIA_Y (H-((4*BORDER)+(4*BAR_H))) +#define BUILD_Y (H-((3*BORDER)+(3*BAR_H))) +#define CHAR_Y (H-((2*BORDER)+(2*BAR_H))) +#define OVER_Y (H-(BORDER+BAR_H)) + assetGlobalDef { - cursor "ui/assets/3_cursor3" // cursor + cursor "ui/assets/3_cursor3" // cursor gradientBar "ui/assets/gradientbar2.tga" // gradient bar fadeClamp 1.0 // sets the fadeup alpha fadeCycle 1 // how often fade happens in milliseconds @@ -21,100 +51,100 @@ menuDef { name "Loading" - rect 0 0 640 480 + rect 0 0 W H fullScreen MENU_TRUE itemDef { name background - rect 0 0 640 480 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration } itemDef { name "levelname" - rect 20 20 260 20 - visible 1 + rect INFO_X LEVEL_Y INFO_W LEVEL_H + visible MENU_TRUE decoration forecolor 1 1 1 1 - align ITEM_ALIGN_LEFT + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER textstyle ITEM_TEXTSTYLE_NORMAL textscale 0.4 - textaligny 28 - textalignx 0 ownerdraw CG_LOAD_LEVELNAME } itemDef { name "hostname" - rect 20 100 260 20 - visible 1 + rect INFO_X HOST_Y INFO_W HOST_H + visible MENU_TRUE decoration forecolor 1 1 1 1 - align ITEM_ALIGN_LEFT + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER textstyle ITEM_TEXTSTYLE_NORMAL textscale 0.4 - textaligny 28 - textalignx 0 ownerdraw CG_LOAD_HOSTNAME } - + itemDef { name "motd" - rect 20 180 260 20 - visible 1 + rect INFO_X MOTD_Y INFO_W MOTD_H + visible MENU_TRUE decoration forecolor 1 1 1 1 - align ITEM_ALIGN_LEFT + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER textstyle ITEM_TEXTSTYLE_NORMAL textscale 0.4 - textaligny 28 - textalignx 0 ownerdraw CG_LOAD_MOTD } itemDef { name "levelshot" - rect 300 20 320 240 - visible 1 + rect SHOT_X SHOT_Y SHOT_W SHOT_H + visible MENU_TRUE decoration forecolor 1 1 1 1 ownerdraw CG_LOAD_LEVELSHOT + + border WINDOW_BORDER_FULL + borderSize 1.0 + borderColor 0.5 0.5 0.5 1 } - + itemDef { name "media" - rect 20 300 380 30 - visible 1 + rect BAR_X MEDIA_Y BAR_W BAR_H + visible MENU_TRUE decoration forecolor 0.0 0.8 1 1 ownerdraw CG_LOAD_MEDIA - align ITEM_ALIGN_CENTER + textalign ITEM_ALIGN_CENTER textstyle ITEM_TEXTSTYLE_NEON textscale 0.5 special 1.0 } - + itemDef { name "medialabel" style WINDOW_STYLE_EMPTY textscale 0.6 - rect 420 300 200 40 - align ITEM_ALIGN_RIGHT - textaligny 28 - textalignx 0 + rect LABEL_X MEDIA_Y LABEL_W BAR_H + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER forecolor 0.0 0.8 1 1 - visible 1 - decoration + visible MENU_TRUE + decoration ownerdraw CG_LOAD_MEDIA_LABEL } @@ -122,69 +152,68 @@ { name "buildables" rect 20 340 380 30 - visible 1 + rect BAR_X BUILD_Y BAR_W BAR_H + visible MENU_TRUE decoration forecolor 0.0 0.8 1 1 ownerdraw CG_LOAD_BUILDABLES - align ITEM_ALIGN_CENTER + textalign ITEM_ALIGN_CENTER textstyle ITEM_TEXTSTYLE_NEON textscale 0.5 special 1.0 } - + itemDef { name "buildableslabel" style WINDOW_STYLE_EMPTY textscale 0.6 - rect 420 340 200 40 - align ITEM_ALIGN_RIGHT - textaligny 28 - textalignx 0 + rect LABEL_X BUILD_Y LABEL_W BAR_H + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER forecolor 0.0 0.8 1 1 - visible 1 - decoration + visible MENU_TRUE + decoration ownerdraw CG_LOAD_BUILDABLES_LABEL } itemDef { name "charmodel" - rect 20 380 380 30 - visible 1 + rect BAR_X CHAR_Y BAR_W BAR_H + visible MENU_TRUE decoration forecolor 0.0 0.8 1 1 ownerdraw CG_LOAD_CHARMODEL - align ITEM_ALIGN_CENTER + textalign ITEM_ALIGN_CENTER textstyle ITEM_TEXTSTYLE_NEON textscale 0.5 special 1.0 } - + itemDef { name "charmodellabel" style WINDOW_STYLE_EMPTY textscale 0.6 - rect 420 380 200 40 - align ITEM_ALIGN_RIGHT - textaligny 28 - textalignx 0 + rect LABEL_X CHAR_Y LABEL_W BAR_H + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER forecolor 0.0 0.8 1 1 - visible 1 - decoration + visible MENU_TRUE + decoration ownerdraw CG_LOAD_CHARMODEL_LABEL } itemDef { name "overall" - rect 20 420 600 30 - visible 1 + rect BAR_X OVER_Y MAIN_W BAR_H + visible MENU_TRUE decoration forecolor 0.0 0.8 1 1 ownerdraw CG_LOAD_OVERALL - align ITEM_ALIGN_CENTER + textalign ITEM_ALIGN_CENTER textstyle ITEM_TEXTSTYLE_NEON textscale 0.5 special 1.0 diff --git a/ui/main.menu b/ui/main.menu index 1787dd87..d7745c3a 100644 --- a/ui/main.menu +++ b/ui/main.menu @@ -6,17 +6,17 @@ font "fonts/font" 26 // font smallFont "fonts/smallfont" 20 // font bigFont "fonts/bigfont" 34 // font - cursor "ui/assets/3_cursor3" // cursor + cursor "ui/assets/3_cursor3" // cursor gradientBar "ui/assets/gradientbar2.tga" // gradient bar itemFocusSound "sound/misc/menu2.wav" // sound for item getting focus (via keyboard or mouse ) - + fadeClamp 1.0 // sets the fadeup alpha fadeCycle 1 // how often fade happens in milliseconds fadeAmount 0.1 // amount to adjust alpha per cycle shadowColor 0.1 0.1 0.1 0.25 // shadow color } - + @@ -24,24 +24,14 @@ menuDef { name main - fullScreen MENU_TRUE + fullScreen MENU_TRUE rect 0 0 640 480 // Size and position of the menu visible MENU_TRUE // Visible on open focusColor 1 .75 0 1 // Menu focus color for text and items + background "ui/assets/mainmenu.jpg" - onOpen { uiScript stopRefresh ; playlooped "sound/ui/heartbeat.wav" } + onOpen { uiScript stopRefresh ; playlooped "sound/ui/heartbeat.wav" } onESC { open quit_popmenu } - - itemDef - { - name background - rect 0 0 640 480 - style WINDOW_STYLE_SHADER - backcolor 0 0 0 1 - visible 1 - decoration - background "ui/assets/mainmenu.jpg" - } itemDef { @@ -53,27 +43,30 @@ model_fovx 32.0 model_fovy 24.0 model_angle 180 - visible 1 + visible MENU_TRUE decoration } +#define X 536 +#define Y 20 +#define W 64 +#define ELEM_H 20 + itemDef { name mainmenu text "Play" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - textstyle ITEM_TEXTSTYLE_NORMAL - rect 472 20 128 20 + textstyle ITEM_TEXTSTYLE_NORMAL + rect X Y W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 128 - textaligny 20 textscale .416 - forecolor 1 1 1 1 - visible 1 + forecolor 1 1 1 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; open joinserver } } @@ -83,19 +76,17 @@ name mainmenu text "Options" type ITEM_TYPE_BUTTON - style WINDOW_STYLE_EMPTY + style WINDOW_STYLE_EMPTY textstyle ITEM_TEXTSTYLE_NORMAL textscale .416 - rect 472 40 128 20 - textalignx 128 - textaligny 20 - textalign ITEM_ALIGN_RIGHT + rect X (Y+ELEM_H) W ELEM_H + textalign ITEM_ALIGN_RIGHT backcolor 0 0 0 0 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; open simple_options } } @@ -105,19 +96,17 @@ name mainmenu text "Mods" type ITEM_TYPE_BUTTON - style WINDOW_STYLE_EMPTY + style WINDOW_STYLE_EMPTY textstyle ITEM_TEXTSTYLE_NORMAL textscale .416 - rect 472 60 128 20 - textalignx 128 - textaligny 20 - textalign ITEM_ALIGN_RIGHT + rect X (Y+(2*ELEM_H)) W ELEM_H + textalign ITEM_ALIGN_RIGHT backcolor 0 0 0 0 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; open mod } } @@ -129,13 +118,11 @@ type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY textstyle ITEM_TEXTSTYLE_NORMAL - rect 472 80 128 20 - textalignx 128 - textaligny 20 + rect X (Y+(3*ELEM_H)) W ELEM_H textscale .416 - textalign ITEM_ALIGN_RIGHT + textalign ITEM_ALIGN_RIGHT forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; @@ -146,17 +133,15 @@ itemDef { name copyright - text "Tremulous (C) 2005-2006 darklegion development" + text "Tremulous (C) 2005-2007 darklegion development" style WINDOW_STYLE_EMPTY textstyle ITEM_TEXTSTYLE_NORMAL textscale .25 - rect 0 440 640 40 - textalign 1 - textaligny 32 - textalignx 320 + rect 0 450 640 10 + textalign ITEM_ALIGN_CENTER forecolor .75 .75 .75 .75 - visible 1 - decoration + visible MENU_TRUE + decoration } } } diff --git a/ui/menudef.h b/ui/menudef.h index 0702698f..42196031 100644 --- a/ui/menudef.h +++ b/ui/menudef.h @@ -1,11 +1,13 @@ +#ifndef MENUDEF_H +#define MENUDEF_H #define ITEM_TYPE_TEXT 0 // simple text -#define ITEM_TYPE_BUTTON 1 // button, basically text with a border -#define ITEM_TYPE_RADIOBUTTON 2 // toggle button, may be grouped +#define ITEM_TYPE_BUTTON 1 // button, basically text with a border +#define ITEM_TYPE_RADIOBUTTON 2 // toggle button, may be grouped #define ITEM_TYPE_CHECKBOX 3 // check box #define ITEM_TYPE_EDITFIELD 4 // editable text, associated with a cvar #define ITEM_TYPE_COMBO 5 // drop down list -#define ITEM_TYPE_LISTBOX 6 // scrollable list +#define ITEM_TYPE_LISTBOX 6 // scrollable list #define ITEM_TYPE_MODEL 7 // model #define ITEM_TYPE_OWNERDRAW 8 // owner draw, name specs what it is #define ITEM_TYPE_NUMERICFIELD 9 // editable text, associated with a cvar @@ -13,11 +15,15 @@ #define ITEM_TYPE_YESNO 11 // yes no cvar setting #define ITEM_TYPE_MULTI 12 // multiple list setting, enumerated #define ITEM_TYPE_BIND 13 // multiple list setting, enumerated - + #define ITEM_ALIGN_LEFT 0 // left alignment #define ITEM_ALIGN_CENTER 1 // center alignment #define ITEM_ALIGN_RIGHT 2 // right alignment +#define ITEM_VALIGN_BOTTOM 0 // bottom alignment +#define ITEM_VALIGN_CENTER 1 // center alignment +#define ITEM_VALIGN_TOP 2 // top alignment + #define ITEM_TEXTSTYLE_NORMAL 0 // normal text #define ITEM_TEXTSTYLE_BLINK 1 // fast blinking #define ITEM_TEXTSTYLE_PULSE 2 // slow pulsing @@ -26,17 +32,17 @@ #define ITEM_TEXTSTYLE_OUTLINESHADOWED 5 // drop shadow ( need a color for this ) #define ITEM_TEXTSTYLE_SHADOWEDMORE 6 // drop shadow ( need a color for this ) #define ITEM_TEXTSTYLE_NEON 7 // drop shadow ( need a color for this ) - + #define WINDOW_BORDER_NONE 0 // no border #define WINDOW_BORDER_FULL 1 // full border based on border color ( single pixel ) #define WINDOW_BORDER_HORZ 2 // horizontal borders only -#define WINDOW_BORDER_VERT 3 // vertical borders only +#define WINDOW_BORDER_VERT 3 // vertical borders only #define WINDOW_BORDER_KCGRADIENT 4 // horizontal border using the gradient bars - + #define WINDOW_STYLE_EMPTY 0 // no background #define WINDOW_STYLE_FILLED 1 // filled with background color -#define WINDOW_STYLE_GRADIENT 2 // gradient bar based on background color -#define WINDOW_STYLE_SHADER 3 // gradient bar based on background color +#define WINDOW_STYLE_GRADIENT 2 // gradient bar based on background color +#define WINDOW_STYLE_SHADER 3 // gradient bar based on background color #define WINDOW_STYLE_TEAMCOLOR 4 // team color #define WINDOW_STYLE_CINEMATIC 5 // cinematic @@ -125,10 +131,10 @@ // owner draw types // ideally these should be done outside of this file but -// this makes it much easier for the macro expansion to +// this makes it much easier for the macro expansion to // convert them for the designers ( from the .menu files ) #define CG_OWNERDRAW_BASE 1 -#define CG_PLAYER_ARMOR_ICON 1 +#define CG_PLAYER_ARMOR_ICON 1 #define CG_PLAYER_ARMOR_VALUE 2 #define CG_PLAYER_HEAD 3 #define CG_PLAYER_HEALTH 4 @@ -193,13 +199,13 @@ #define CG_PLAYER_LOCATION 33 #define CG_TEAM_COLOR 34 #define CG_CTF_POWERUP 35 - + #define CG_AREA_POWERUP 36 #define CG_AREA_LAGOMETER 37 // painted with old system -#define CG_PLAYER_HASFLAG 38 +#define CG_PLAYER_HASFLAG 38 #define CG_GAME_TYPE 39 // not done -#define CG_SELECTEDPLAYER_ARMOR 40 +#define CG_SELECTEDPLAYER_ARMOR 40 #define CG_SELECTEDPLAYER_HEALTH 41 #define CG_PLAYER_STATUS 42 #define CG_FRAGGED_MSG 43 // painted with old system @@ -207,7 +213,7 @@ #define CG_AREA_FPSINFO 45 // painted with old system #define CG_GAME_STATUS 49 #define CG_KILLER 50 -#define CG_PLAYER_ARMOR_ICON2D 51 +#define CG_PLAYER_ARMOR_ICON2D 51 #define CG_PLAYER_AMMO_ICON2D 52 #define CG_ACCURACY 53 #define CG_ASSISTS 54 @@ -220,9 +226,9 @@ #define CG_TEAMINFO 61 #define CG_VOICE_HEAD 62 #define CG_VOICE_NAME 63 -#define CG_PLAYER_HASFLAG2D 64 +#define CG_PLAYER_HASFLAG2D 64 #define CG_HARVESTER_SKULLS2D 65 // only shows in harvester -#define CG_CAPFRAGLIMIT 66 +#define CG_CAPFRAGLIMIT 66 #define CG_1STPLACE 67 #define CG_2NDPLACE 68 #define CG_CAPTURES 69 @@ -249,6 +255,8 @@ #define CG_LAGOMETER 90 #define CG_PLAYER_CROSSHAIRNAMES 114 #define CG_STAGE_REPORT_TEXT 116 +#define CG_ALIENS_SCORE_LABEL 121 +#define CG_HUMANS_SCORE_LABEL 122 #define CG_DEMO_PLAYBACK 117 #define CG_DEMO_RECORDING 118 @@ -357,3 +365,5 @@ #define VOICECHAT_WHOISLEADER "whoisleader" // who is the team leader #define VOICECHAT_WANTONDEFENSE "wantondefense" // I want to be on defense #define VOICECHAT_WANTONOFFENSE "wantonoffense" // I want to be on offense + +#endif diff --git a/ui/menus.txt b/ui/menus.txt index 3fa3dcf6..25cc09bd 100644 --- a/ui/menus.txt +++ b/ui/menus.txt @@ -1,6 +1,6 @@ // menu defs -// -{ +// +{ loadMenu { "ui/main.menu" } loadMenu { "ui/joinserver.menu" } loadMenu { "ui/options.menu" } diff --git a/ui/mod.menu b/ui/mod.menu index bfebebd8..88045167 100644 --- a/ui/mod.menu +++ b/ui/mod.menu @@ -3,15 +3,21 @@ { \\ MOD \\ +#define W 300 +#define H 240 +#define BUTT_W 45 +#define BUTT_H 35 +#define BORDER 10 + menuDef { name "mod" - visible 0 - fullscreen 0 - rect 160 120 320 240 + visible MENU_FALSE + fullscreen MENU_FALSE + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 - border 1 + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_FULL popup onEsc { @@ -25,21 +31,21 @@ itemDef { name window - rect 0 0 320 240 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL borderSize 1.0 borderColor 0.5 0.5 0.5 1 } - + itemDef { name modlist - rect 10 10 300 200 + rect BORDER BORDER (W-(2*BORDER)) (H-(BUTT_H+BORDER)) type ITEM_TYPE_LISTBOX style WINDOW_STYLE_EMPTY elementwidth 120 @@ -49,53 +55,51 @@ feeder FEEDER_MODS textalign 3 textaligny 14 - border 1 + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE doubleClick { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript RunMod } } itemDef { - name ok - text "OK" - type 1 + name load + text "Load" + type ITEM_TYPE_BUTTON textscale .25 - rect 250 210 30 26 - textalign 1 - textalignx 15 - textaligny 20 + rect (W-(2*BUTT_W)) (H-BUTT_H) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action - { + { play "sound/misc/menu1.wav"; close mod; uiScript RunMod } } - + itemDef { name cancel text "Cancel" - type 1 + type ITEM_TYPE_BUTTON textscale .25 - rect 280 210 30 26 - textalign 1 - textalignx 15 - textaligny 20 + rect (W-BUTT_W) (H-BUTT_H) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action - { + { play "sound/misc/menu3.wav"; close mod } diff --git a/ui/options.menu b/ui/options.menu index 6ce80d57..eb9c823c 100644 --- a/ui/options.menu +++ b/ui/options.menu @@ -3,29 +3,38 @@ { \\ FRONT END OPTIONS BOX \\ +#define X 0 +#define Y 20 +#define W 250 +#define H 280 +#define TOFF_X (0-(W/2)) +#define ELEM_H 16 +#define BUTT_W 35 +#define BUTT_H 35 + menuDef { name "simple_options" - visible 0 - fullscreen 0 - rect 200 80 240 320 + visible MENU_FALSE + fullscreen MENU_FALSE + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 - border 1 + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_FULL popup onEsc { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; close simple_options } itemDef { name window - rect 0 0 240 320 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL @@ -38,17 +47,17 @@ itemDef { type ITEM_TYPE_EDITFIELD - style 0 + style WINDOW_STYLE_EMPTY text "Name:" cvar "name" maxchars 26 - rect 50 20 192 15 + rect X Y W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 12 + textalignx TOFF_X + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } itemDef @@ -57,13 +66,13 @@ text "Video Quality:" cvar "ui_glCustom" cvarFloatList { "High Quality" 0 "Normal" 1 "Fast" 2 "Fastest" 3 "Custom" 4 } - rect 50 45 192 15 + rect X (Y+ELEM_H) W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 12 + textalignx TOFF_X + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; @@ -76,16 +85,16 @@ type ITEM_TYPE_MULTI text "Video Mode:" cvar "r_mode" - cvarFloatList { "320x240" 0 "400x300" 1 "512x384" 2 "640x480" 3 + cvarFloatList { "Custom" -1 "320x240" 0 "400x300" 1 "512x384" 2 "640x480" 3 "800x600" 4 "960x720" 5 "1024x768" 6 "1152x864" 7 "1280x1024" 8 "1600x1200" 9 "2048x1536" 10 "856x480 wide screen" 11 } - rect 50 60 192 15 + rect X (Y+(2*ELEM_H)) W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 12 + textalignx TOFF_X + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; @@ -98,13 +107,13 @@ type ITEM_TYPE_SLIDER text "Video Brightness:" cvarfloat "r_gamma" 1 .5 2 - rect 50 75 192 20 + rect X (Y+(3*ELEM_H)) W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 12 + textalignx TOFF_X + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } @@ -114,13 +123,13 @@ type ITEM_TYPE_SLIDER text "Effects Volume:" cvarfloat "s_volume" 0.7 0 1 - rect 50 110 192 20 + rect X (Y+(4*ELEM_H)) W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 12 + textalignx TOFF_X + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } itemDef @@ -128,13 +137,13 @@ type ITEM_TYPE_SLIDER text "Music Volume:" cvarfloat "s_musicvolume" 0.25 0 1 - rect 50 130 192 20 + rect X (Y+(5*ELEM_H)) W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 12 + textalignx TOFF_X + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } itemDef @@ -142,13 +151,13 @@ type ITEM_TYPE_YESNO text "OpenAL Sound:" cvar "s_useOpenAL" - rect 50 145 192 15 + rect X (Y+(6*ELEM_H)) W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 12 + textalignx TOFF_X + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; @@ -162,13 +171,13 @@ type ITEM_TYPE_SLIDER text "Mouse Sensitivity:" cvarfloat "sensitivity" 5 1 30 - rect 50 175 192 20 + rect X (Y+(7*ELEM_H)) W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 12 + textalignx TOFF_X + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } itemDef @@ -176,13 +185,13 @@ type ITEM_TYPE_YESNO text "Invert Mouse:" cvar "ui_mousePitch" - rect 50 190 192 15 + rect X (Y+(8*ELEM_H)) W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 12 + textalignx TOFF_X + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; @@ -197,14 +206,14 @@ type ITEM_TYPE_MULTI text "Network Connection:" cvar "rate" - cvarFloatList { "<=28.8k" 2500 "33.6k" 3000 "56k" 4000 "ISDN" 5000 "LAN/CABLE/xDSl" 25000 } - rect 50 220 192 20 + cvarFloatList { "<=28.8k" 2500 "33.6k" 3000 "56k" 4000 "ISDN" 5000 "LAN/CABLE/xDSL" 25000 } + rect X (Y+(9*ELEM_H)) W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 12 + textalignx TOFF_X + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; @@ -216,13 +225,13 @@ type ITEM_TYPE_YESNO text "Allow Auto Download:" cvar "cl_allowDownload" - rect 50 235 192 15 + rect X (Y+(10*ELEM_H)) W ELEM_H textalign ITEM_ALIGN_RIGHT - textalignx 64 - textaligny 12 + textalignx TOFF_X + textvalign ITEM_VALIGN_CENTER textscale .25 forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; @@ -232,16 +241,30 @@ itemDef { + text "For further options please use the in-game options menu" + style WINDOW_STYLE_EMPTY + textstyle ITEM_TEXTSTYLE_NORMAL + textscale .25 + rect 0 (H-60) W 10 + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER + forecolor 1 1 1 1 + visible MENU_TRUE + decoration + } + + + itemDef + { text "APPLY" type ITEM_TYPE_BUTTON textscale .25 style WINDOW_STYLE_EMPTY - rect 95 255 30 20 + rect (W-(2*BUTT_W)) (H-BUTT_H) BUTT_W BUTT_H textalign ITEM_ALIGN_CENTER - textalignx 15 - textaligny 15 + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; @@ -255,33 +278,16 @@ type ITEM_TYPE_BUTTON textscale .25 style WINDOW_STYLE_EMPTY - rect 125 255 20 20 + rect (W-BUTT_W) (H-BUTT_H) BUTT_W BUTT_H textalign ITEM_ALIGN_CENTER - textalignx 10 - textaligny 15 + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; close simple_options } } - - - itemDef - { - text "For further options please use the in-game options menu" - style WINDOW_STYLE_EMPTY - textstyle ITEM_TEXTSTYLE_NORMAL - textscale .25 - rect 0 300 240 40 - textalign ITEM_ALIGN_CENTER - textaligny 0 - textalignx 120 - forecolor 1 1 1 1 - visible 1 - decoration - } } } diff --git a/ui/password.menu b/ui/password.menu index 27eb72a4..1ac91cc3 100644 --- a/ui/password.menu +++ b/ui/password.menu @@ -3,89 +3,82 @@ { \\ PASSWORD POPUP MENU \\ +#define BUTT_W 45 +#define BUTT_H 35 +#define BORDER 10 +#define INPUT_H 20 +#define W 250 +#define H ((2*BORDER)+INPUT_H+BUTT_H) + menuDef { name "password_popmenu" - visible 0 - fullscreen 0 - rect 204 122 235 235 + visible MENU_FALSE + fullscreen MENU_FALSE + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 - border 1 + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_FULL popup + + onOpen + { + setfocus passwordEntry + } + onESC { - close password_popmenu; - open joinserver + close password_popmenu } - + itemDef { name window - rect 47 47 144 144 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL borderSize 1.0 borderColor 0.5 0.5 0.5 1 } - - // PASSWORD // - itemDef - { - name password - text "Password" - style 0 - decoration - textscale .3 - rect 0 86 110 20 - textalign 1 - textalignx 117 - textaligny 16 - forecolor 1 1 1 1 - visible 1 - } - + // PASSWORD // + itemDef { name passwordEntry - style 1 - text "" - maxchars 15 - textscale .25 - TYPE 4 - cvar "password" - rect 60 106 120 20 + style WINDOW_STYLE_EMPTY + text "Password:" + maxChars 40 + textscale .4 + type ITEM_TYPE_EDITFIELD + cvar "password" + rect BORDER BORDER (W-(2*BORDER)) INPUT_H textalign ITEM_ALIGN_LEFT - textalignx 10 - textaligny 16 + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - backcolor .2 .2 .2 .5 - visible 1 + visible MENU_TRUE } itemDef { name yes text "OK" - type 1 + type ITEM_TYPE_BUTTON textscale .25 style WINDOW_STYLE_EMPTY - rect 103 140 30 26 - textalign 1 - textalignx 15 - textaligny 20 + rect (W-BUTT_W) (H-BUTT_H) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { play "sound/misc/menu1.wav"; - close password_popmenu; - open joinserver + close password_popmenu } } } diff --git a/ui/ptrc.menu b/ui/ptrc.menu index c11f11bd..c73e4b7d 100644 --- a/ui/ptrc.menu +++ b/ui/ptrc.menu @@ -3,30 +3,42 @@ { // PTRC POPUP MENU // +#define W 280 +#define H 140 +#define BORDER 10 + +#define BUTT_H 25 +#define BUTT_W 45 + +#define INFO_W (W-(2*BORDER)) +#define INFO_H (H-((3*BORDER)+BUTT_H)) +#define INFO_X BORDER +#define INFO_Y BORDER + menuDef { name "ptrc_popmenu" - visible 0 - fullscreen 0 - rect 140 170 360 140 + visible MENU_FALSE + fullscreen MENU_FALSE + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 - border 1 + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_FULL popup onESC { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; close ptrc_popmenu } - + itemDef { name window - rect 0 0 360 140 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL @@ -40,68 +52,53 @@ itemDef { name confirm - text "It seems that you disconnected during this game." - style 0 - textscale .4 - textstyle 3 - rect 180 40 0 0 - textalign ITEM_ALIGN_CENTER - decoration - forecolor 1 1 1 1 - visible 1 - } - - itemDef - { - name confirm - text "Would you like to be restored to your previous state?" - style 0 - textscale .4 - textstyle 3 - rect 180 65 0 0 + text "It seems that you disconnected during this game. Would you like to be restored to your previous state?" + style WINDOW_STYLE_EMPTY + textscale .4 + textstyle WINDOW_STYLE_SHADER + rect INFO_X INFO_Y INFO_W INFO_H textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER decoration + wrapped forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } - itemDef { name yes text "YES" - type 1 - textscale .25 - rect 80 96 20 20 + type ITEM_TYPE_BUTTON + textscale .4 + rect (W-((2*BORDER)+(2*BUTT_W))) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H textalign ITEM_ALIGN_CENTER - textalignx 10 - textaligny 14 + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action - { - play "sound/misc/menu4.wav"; + { + play "sound/misc/menu4.wav"; uiScript PTRCRestore; - close ptrc_popmenu + close ptrc_popmenu } } - + itemDef { name no text "NO" - type 1 - textscale .25 - rect 260 96 20 20 + type ITEM_TYPE_BUTTON + textscale .4 + rect (W-(BORDER+BUTT_W)) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H textalign ITEM_ALIGN_CENTER - textalignx 10 - textaligny 14 + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; close ptrc_popmenu } } diff --git a/ui/quit.menu b/ui/quit.menu index 6926b93e..e3c6be24 100644 --- a/ui/quit.menu +++ b/ui/quit.menu @@ -3,30 +3,33 @@ { \\ QUIT POPUP MENU \\ +#define W 120 +#define H 120 + menuDef { name "quit_popmenu" - visible 0 - fullscreen 0 - rect 204 122 235 235 + visible MENU_FALSE + fullscreen MENU_FALSE + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 - border 1 + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_FULL popup onESC { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; close quit_popmenu } - + itemDef { name window - rect 47 47 144 144 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL @@ -41,16 +44,15 @@ { name confirm text "Quit Tremulous?" - style 0 - textscale .3 - textstyle 3 - rect 0 90 110 20 - textalign 1 - textalignx 117 - textaligny 16 + style WINDOW_STYLE_EMPTY + textscale .3 + textstyle WINDOW_STYLE_SHADER + rect 0 0 W ((2*H)/3) + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER decoration forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE } @@ -58,37 +60,35 @@ { name yes text "YES" - type 1 + type ITEM_TYPE_BUTTON textscale .25 - rect 75 120 30 26 - textalign 1 - textalignx 15 - textaligny 20 + rect 0 (H/3) (W/2) ((2*H)/3) + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action - { - play "sound/misc/menu4.wav"; + { + play "sound/misc/menu4.wav"; open quitCredit } } - + itemDef { name no text "NO" - type 1 + type ITEM_TYPE_BUTTON textscale .25 - rect 128 120 30 26 - textalign 1 - textalignx 15 - textaligny 20 + rect (W/2) (H/3) (W/2) ((2*H)/3) + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; close quit_popmenu } } diff --git a/ui/quitcredit.menu b/ui/quitcredit.menu index 679d6a80..e628026c 100644 --- a/ui/quitcredit.menu +++ b/ui/quitcredit.menu @@ -6,12 +6,12 @@ menuDef { name "quitCredit" - visible 0 - fullscreen 1 + visible MENU_FALSE + fullscreen MENU_TRUE rect 0 0 640 480 focusColor 1 .75 0 1 - style 1 - border 0 + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_NONE onEsc { uiScript "quit" @@ -23,7 +23,7 @@ style WINDOW_STYLE_SHADER rect 0 0 640 480 type ITEM_TYPE_BUTTON - visible 1 + visible MENU_TRUE backcolor 0 0 0 1 background "ui/assets/credits_splash.jpg" action @@ -32,15 +32,15 @@ uiScript "quit" } } - + itemDef { name topstripe style WINDOW_STYLE_FILLED rect -5 -5 645 64 - visible 1 + visible MENU_TRUE backcolor 0 0 0 1 - + border WINDOW_BORDER_FULL borderSize 1.5 borderColor 1 0 0 1 @@ -51,9 +51,9 @@ name bottomstripe style WINDOW_STYLE_FILLED rect -5 416 645 485 - visible 1 + visible MENU_TRUE backcolor 0 0 0 1 - + border WINDOW_BORDER_FULL borderSize 1.5 borderColor 1 0 0 1 @@ -66,17 +66,15 @@ style WINDOW_STYLE_EMPTY rect 320 48 1 1 textalign ITEM_ALIGN_CENTER - textalignx 0 - textaligny 0 textscale 0.75 textstyle ITEM_TEXTSTYLE_NORMAL text "CREDITS" forecolor 1 1 1 1 backcolor 1 0 0 1 visible 1 - decoration + decoration } - + itemDef { name "credit1left" @@ -84,15 +82,13 @@ style WINDOW_STYLE_EMPTY rect 10 96 1 1 textalign ITEM_ALIGN_LEFT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Tim 'Timbo' Angus" forecolor 1 1 1 1 backcolor 1 0 0 1 visible 1 - decoration + decoration } itemDef { @@ -101,15 +97,13 @@ style WINDOW_STYLE_EMPTY rect 630 96 1 1 textalign ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Programming and Direction" forecolor 1 1 1 1 backcolor 0 1 0 1 visible 1 - decoration + decoration } itemDef @@ -119,15 +113,13 @@ style WINDOW_STYLE_EMPTY rect 10 128 1 1 textalign ITEM_ALIGN_LEFT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Nick 'jex' Jansens" forecolor 1 1 1 1 backcolor 1 0 0 1 visible 1 - decoration + decoration } itemDef { @@ -136,15 +128,13 @@ style WINDOW_STYLE_EMPTY rect 630 128 1 1 textalign ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Mapping, texturing and 2D artwork" forecolor 1 1 1 1 backcolor 0 1 0 1 visible 1 - decoration + decoration } itemDef @@ -154,15 +144,13 @@ style WINDOW_STYLE_EMPTY rect 10 160 1 1 textalign ITEM_ALIGN_LEFT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Robin 'OverFlow' Marshall" forecolor 1 1 1 1 backcolor 1 0 0 1 visible 1 - decoration + decoration } itemDef { @@ -171,15 +159,13 @@ style WINDOW_STYLE_EMPTY rect 630 160 1 1 textalign ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Modelling, animation and mapping" forecolor 1 1 1 1 backcolor 0 1 0 1 visible 1 - decoration + decoration } itemDef @@ -189,15 +175,13 @@ style WINDOW_STYLE_EMPTY rect 10 192 1 1 textalign ITEM_ALIGN_LEFT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Jan 'Stannum' van der Weg" forecolor 1 1 1 1 backcolor 1 0 0 1 visible 1 - decoration + decoration } itemDef { @@ -206,15 +190,13 @@ style WINDOW_STYLE_EMPTY rect 630 192 1 1 textalign ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Texturing and mapping" forecolor 1 1 1 1 backcolor 0 1 0 1 visible 1 - decoration + decoration } itemDef @@ -224,15 +206,13 @@ style WINDOW_STYLE_EMPTY rect 10 224 1 1 textalign ITEM_ALIGN_LEFT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Mike 'Veda' McInerney" forecolor 1 1 1 1 backcolor 1 0 0 1 visible 1 - decoration + decoration } itemDef { @@ -241,15 +221,13 @@ style WINDOW_STYLE_EMPTY rect 630 224 1 1 textalign ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Modelling, animation and texturing" forecolor 1 1 1 1 backcolor 0 1 0 1 visible 1 - decoration + decoration } itemDef @@ -259,15 +237,13 @@ style WINDOW_STYLE_EMPTY rect 10 256 1 1 textalign ITEM_ALIGN_LEFT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Gordon 'Godmil' Miller" forecolor 1 1 1 1 backcolor 1 0 0 1 visible 1 - decoration + decoration } itemDef { @@ -276,15 +252,13 @@ style WINDOW_STYLE_EMPTY rect 630 256 1 1 textalign ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Mapping" forecolor 1 1 1 1 backcolor 0 1 0 1 visible 1 - decoration + decoration } itemDef @@ -294,15 +268,13 @@ style WINDOW_STYLE_EMPTY rect 10 288 1 1 textalign ITEM_ALIGN_LEFT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "'Who-[Soup]'" forecolor 1 1 1 1 backcolor 1 0 0 1 visible 1 - decoration + decoration } itemDef { @@ -311,15 +283,13 @@ style WINDOW_STYLE_EMPTY rect 630 288 1 1 textalign ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Mapping" forecolor 1 1 1 1 backcolor 0 1 0 1 visible 1 - decoration + decoration } itemDef @@ -329,15 +299,13 @@ style WINDOW_STYLE_EMPTY rect 10 320 1 1 textalign ITEM_ALIGN_LEFT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Tristan 'jhrx' Blease" forecolor 1 1 1 1 backcolor 1 0 0 1 visible 1 - decoration + decoration } itemDef { @@ -346,15 +314,13 @@ style WINDOW_STYLE_EMPTY rect 630 320 1 1 textalign ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Mapping" forecolor 1 1 1 1 backcolor 0 1 0 1 visible 1 - decoration + decoration } itemDef @@ -364,15 +330,13 @@ style WINDOW_STYLE_EMPTY rect 10 352 1 1 textalign ITEM_ALIGN_LEFT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Paul 'MoP' Greveson" forecolor 1 1 1 1 backcolor 1 0 0 1 visible 1 - decoration + decoration } itemDef { @@ -381,17 +345,15 @@ style WINDOW_STYLE_EMPTY rect 630 352 1 1 textalign ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Modelling and texturing" forecolor 1 1 1 1 backcolor 0 1 0 1 visible 1 - decoration + decoration } - + itemDef { name "credit10left" @@ -399,15 +361,13 @@ style WINDOW_STYLE_EMPTY rect 10 384 1 1 textalign ITEM_ALIGN_LEFT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Chris 'Dolby' McCarthy" forecolor 1 1 1 1 backcolor 1 0 0 1 visible 1 - decoration + decoration } itemDef { @@ -416,15 +376,13 @@ style WINDOW_STYLE_EMPTY rect 630 384 1 1 textalign ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 10 textscale 0.50 textstyle ITEM_TEXTSTYLE_NORMAL text "Sound" forecolor 1 1 1 1 backcolor 0 1 0 1 visible 1 - decoration + decoration } } } diff --git a/ui/serverinfo.menu b/ui/serverinfo.menu index 18daf6ae..626788a6 100644 --- a/ui/serverinfo.menu +++ b/ui/serverinfo.menu @@ -3,15 +3,25 @@ { \\ SERVER INFO POPUP MENU \\ +#define W 400 +#define H 300 +#define BUTT_W 45 +#define BUTT_H 35 +#define BORDER 10 +#define LIST_W (W-(2*BORDER)) +#define LIST_DW (LIST_W-40) +#define LEFT_C 0.13 +#define RIGHT_C 0.61 + menuDef { name "serverinfo_popmenu" - visible 0 - fullscreen 0 - rect 158 80 320 340 + visible MENU_FALSE + fullscreen MENU_FALSE + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 - border 1 + style WINDOW_STYLE_FILLED + border WINDOW_BORDER_FULL popup onClose { } onOpen { uiScript ServerStatus } @@ -23,10 +33,10 @@ itemDef { name window - rect 10 15 300 320 - style 1 + rect 0 0 W H + style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL @@ -37,102 +47,65 @@ itemDef { name serverinfo - rect 0 20 320 20 - text "Server Information" - textstyle 3 - textalign 1 - textscale .333 - textalignx 160 - textaligny 20 - forecolor 1 1 1 1 - visible 1 - decoration - } - - - itemDef - { - name serverinfo - rect 20 55 280 230 + rect BORDER BORDER LIST_W (H-(BUTT_H+BORDER)) type ITEM_TYPE_LISTBOX - style WINDOW_STYLE_FILLED + style WINDOW_STYLE_EMPTY elementwidth 120 elementheight 16 - textscale .225 - backcolor 0 0 0 1 - border 1 + textscale .25 + border WINDOW_BORDER_FULL bordersize 1 bordercolor .5 .5 .5 1 elementtype LISTBOX_TEXT feeder FEEDER_SERVERSTATUS notselectable - visible 1 + visible MENU_TRUE columns 4 - 2 90 ITEM_ALIGN_LEFT - 34 40 ITEM_ALIGN_LEFT - 66 40 ITEM_ALIGN_LEFT - 100 150 ITEM_ALIGN_LEFT - } - - itemDef - { - name window - rect 20 55 264 230 - style 1 - backcolor 0 0 0 0 - forecolor 0 0 0 0 - border 1 - bordersize 1 - bordercolor .5 .5 .5 1 - visible 1 - decoration + 0 ((2*LEFT_C)*LIST_DW) ITEM_ALIGN_LEFT + (LEFT_C*LIST_DW) (LEFT_C*LIST_DW) ITEM_ALIGN_LEFT + ((2*LEFT_C)*LIST_DW) (LEFT_C*LIST_DW) ITEM_ALIGN_LEFT + ((1-RIGHT_C)*LIST_DW) (RIGHT_C*LIST_DW) ITEM_ALIGN_LEFT } // BUTTON // itemDef { - name exit - text "Exit" - type 1 - textscale .23 - group grpControlbutton + name refresh + text "Refresh" + type ITEM_TYPE_BUTTON + textscale .25 type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 95 295 45 26 - textalign 1 - textalignx 23 - textaligny 20 + rect (W-(2*BUTT_W)) (H-BUTT_H) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - backcolor .37 .1 .1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; - close serverinfo_popmenu + play "sound/misc/menu1.wav"; + uiScript ServerStatus } } itemDef { - name refresh - text "Refresh" - type 1 - textscale .23 - group grpControlbutton + name close + text "Close" + type ITEM_TYPE_BUTTON + textscale .25 type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 180 295 45 26 - textalign 1 - textalignx 23 - textaligny 20 + rect (W-BUTT_W) (H-BUTT_H) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER forecolor 1 1 1 1 - backcolor .37 .1 .1 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; - uiScript ServerStatus + play "sound/misc/menu1.wav"; + close serverinfo_popmenu } } } diff --git a/ui/teamscore.menu b/ui/teamscore.menu index 98eb5bc2..bf9f0f07 100644 --- a/ui/teamscore.menu +++ b/ui/teamscore.menu @@ -3,256 +3,327 @@ { \\ score_menu \\ +#define W 500 +#define H 338 +#define BORDER 10 + +#define TOFF 10 +#define SPEC_W 75 +#define BAR_H 30 + +#define LLIST_L 0 +#define LLIST_R (W/2) +#define RLIST_L (W/2) +#define RLIST_R W + menuDef { name "teamscore_menu" - visible 0 - fullscreen 0 - rect 0 0 640 480 + visible MENU_FALSE + fullscreen MENU_FALSE + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 0 - border 1 - - // GAMETYPE BAR // + style WINDOW_STYLE_EMPTY - // TEAM NAME // + // TEAM NAME // itemDef { name teamNameWindow - rect 14 78 612 30 + rect 0 0 W BAR_H style WINDOW_STYLE_FILLED - border 1 + border WINDOW_BORDER_FULL + borderSize 1.0 bordercolor .5 .5 .5 1 forecolor 1 1 1 1 - backcolor 0 0 0 .5 - visible 1 + backcolor 0 0 0 .8 + visible MENU_TRUE decoration } - + itemDef { name alienteamname - text "Aliens" textalign ITEM_ALIGN_LEFT - textscale .5 - textaligny 26 - rect 20 78 306 23 - forecolor 1 1 1 1 + textvalign ITEM_VALIGN_CENTER + textalignx TOFF + textscale 0.4 + rect 0 0 (W/3) BAR_H + forecolor 1 1 1 1 decoration - visible 1 + visible MENU_TRUE + ownerdraw CG_ALIENS_SCORE_LABEL } itemDef { name stagereport - align ITEM_ALIGN_CENTER - textscale 0.4 - textaligny 24 - rect 14 78 612 23 - forecolor 1 1 1 1 + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER + textscale 0.33 + rect (W/3) 0 (W/3) BAR_H + forecolor 1 1 1 1 decoration - visible 1 + visible MENU_TRUE ownerdraw CG_STAGE_REPORT_TEXT } itemDef { name humanteamname - text "Humans" textalign ITEM_ALIGN_RIGHT - textscale .5 - textaligny 26 - rect 620 78 0 23 + textvalign ITEM_VALIGN_CENTER + textalignx -TOFF + textscale 0.4 + rect ((2*W)/3) 0 (W/3) BAR_H forecolor 1 1 1 1 decoration - visible 1 + visible MENU_TRUE + ownerdraw CG_HUMANS_SCORE_LABEL } - // TEAM BARS // - + // TEAM BARS // + itemDef { name leftteambar - rect 14 112 307 25 + rect 0 (BAR_H+BORDER) (W/2) BAR_H style WINDOW_STYLE_FILLED - border 1 + border WINDOW_BORDER_FULL + borderSize 1.0 bordercolor .5 .5 .5 1 forecolor 1 1 1 1 - backcolor 0 0 0 .5 - visible 1 + backcolor 0 0 0 .8 + visible MENU_TRUE decoration } itemDef { name rightteambar - rect 320 112 306 25 + rect (W/2) (BAR_H+BORDER) (W/2) BAR_H style WINDOW_STYLE_FILLED - border 1 + border WINDOW_BORDER_FULL + borderSize 1.0 bordercolor .5 .5 .5 1 forecolor 1 1 1 1 - backcolor 0 0 0 .5 - visible 1 + backcolor 0 0 0 .8 + visible MENU_TRUE decoration } - // TEAM HEADINGS // + // TEAM HEADINGS // itemDef { - name leftteamheadings - text "Status Name Kills Time Ping" - textscale .25 - style 0 - rect 25 112 128 30 - textalign 0 - textalignx 0 // x alignment point for text - // use it to offset left/right text from the edge - // or to center the text on a different point - textaligny 18 + text "Status" + textscale .33 + style WINDOW_STYLE_EMPTY + rect (LLIST_L+10) (BAR_H+BORDER) 1 BAR_H + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER backcolor 0 0 0 0 forecolor 1 .75 0 1 decoration - visible 1 + visible MENU_TRUE } - + itemDef { - name rightteamheadings - text "Status Name Kills Time Ping" - textscale .25 - style 0 - rect 331 112 128 30 - textalign 0 - textalignx 0 // x alignment point for text - // use it to offset left/right text from the edge - // or to center the text on a different point - textaligny 18 + text "Name" + textscale .33 + style WINDOW_STYLE_EMPTY + rect (LLIST_L+50) (BAR_H+BORDER) 1 BAR_H + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER backcolor 0 0 0 0 forecolor 1 .75 0 1 decoration - visible 1 + visible MENU_TRUE } + itemDef + { + text "Kills" + textscale .33 + style WINDOW_STYLE_EMPTY + rect (LLIST_R-95) (BAR_H+BORDER) 1 BAR_H + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + backcolor 0 0 0 0 + forecolor 1 .75 0 1 + decoration + visible MENU_TRUE + } - // GRADIENT BACKGROUNDS // + itemDef + { + text "Time" + textscale .33 + style WINDOW_STYLE_EMPTY + rect (LLIST_R-55) (BAR_H+BORDER) 1 BAR_H + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + backcolor 0 0 0 0 + forecolor 1 .75 0 1 + decoration + visible MENU_TRUE + } itemDef { - name window - rect 320 142 1 220 - style WINDOW_STYLE_FILLED - border 1 - bordercolor .5 .5 .5 1 - forecolor 1 1 1 1 - backcolor 0 0 0 1 - visible 1 + text "Ping" + textscale .33 + style WINDOW_STYLE_EMPTY + rect (LLIST_R-15) (BAR_H+BORDER) 1 BAR_H + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + backcolor 0 0 0 0 + forecolor 1 .75 0 1 decoration + visible MENU_TRUE } itemDef { - name window - rect 300 142 1 220 - style WINDOW_STYLE_FILLED - border 1 - bordercolor .5 .5 .5 1 - visible 1 + text "Status" + textscale .33 + style WINDOW_STYLE_EMPTY + rect (RLIST_L+10) (BAR_H+BORDER) 1 BAR_H + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER + backcolor 0 0 0 0 + forecolor 1 .75 0 1 decoration + visible MENU_TRUE } itemDef { - name window - rect 606 142 1 220 - style WINDOW_STYLE_FILLED - border 1 - bordercolor .5 .5 .5 1 - visible 1 + text "Name" + textscale .33 + style WINDOW_STYLE_EMPTY + rect (RLIST_L+50) (BAR_H+BORDER) 1 BAR_H + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER + backcolor 0 0 0 0 + forecolor 1 .75 0 1 decoration + visible MENU_TRUE } + itemDef + { + text "Kills" + textscale .33 + style WINDOW_STYLE_EMPTY + rect (RLIST_R-95) (BAR_H+BORDER) 1 BAR_H + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + backcolor 0 0 0 0 + forecolor 1 .75 0 1 + decoration + visible MENU_TRUE + } - // LIST // + itemDef + { + text "Time" + textscale .33 + style WINDOW_STYLE_EMPTY + rect (RLIST_R-55) (BAR_H+BORDER) 1 BAR_H + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + backcolor 0 0 0 0 + forecolor 1 .75 0 1 + decoration + visible MENU_TRUE + } + + itemDef + { + text "Ping" + textscale .33 + style WINDOW_STYLE_EMPTY + rect (RLIST_R-15) (BAR_H+BORDER) 1 BAR_H + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + backcolor 0 0 0 0 + forecolor 1 .75 0 1 + decoration + visible MENU_TRUE + } itemDef { name leftlist - rect 14 136 306 222 + rect 0 ((2*BAR_H)+BORDER) (W/2) (H-((3*BAR_H)+(2*BORDER))) + style WINDOW_STYLE_FILLED + backcolor 0 0 0 .6 + border WINDOW_BORDER_FULL + borderSize 1.0 + bordercolor .5 .5 .5 1 forecolor .75 .75 .75 1 - visible 1 + visible MENU_TRUE type ITEM_TYPE_LISTBOX elementwidth 135 - elementheight 20 + elementheight 16 textscale .25 elementtype LISTBOX_TEXT feeder FEEDER_ALIENTEAM_LIST notselectable columns 7 - 5 15 ITEM_ALIGN_LEFT - 21 15 ITEM_ALIGN_LEFT - 7 30 ITEM_ALIGN_LEFT - 45 100 ITEM_ALIGN_LEFT - 172 20 ITEM_ALIGN_RIGHT - 209 20 ITEM_ALIGN_RIGHT - 247 20 ITEM_ALIGN_RIGHT + 5 15 ITEM_ALIGN_LEFT + 21 15 ITEM_ALIGN_LEFT + 7 30 ITEM_ALIGN_LEFT + 45 ((W/2)-200) ITEM_ALIGN_LEFT + ((W/2)-120) 20 ITEM_ALIGN_RIGHT + ((W/2)-80) 20 ITEM_ALIGN_RIGHT + ((W/2)-40) 20 ITEM_ALIGN_RIGHT } - itemDef + itemDef { name rightlist - rect 320 136 306 222 - forecolor 1 1 1 1 - visible 1 + rect (W/2) ((2*BAR_H)+BORDER) (W/2) (H-((3*BAR_H)+(2*BORDER))) + style WINDOW_STYLE_FILLED + backcolor 0 0 0 .6 + border WINDOW_BORDER_FULL + borderSize 1.0 + bordercolor .5 .5 .5 1 + forecolor .75 .75 .75 1 + visible MENU_TRUE type ITEM_TYPE_LISTBOX elementwidth 135 - elementheight 20 + elementheight 16 textscale .25 elementtype LISTBOX_TEXT feeder FEEDER_HUMANTEAM_LIST notselectable columns 7 - 5 15 ITEM_ALIGN_LEFT - 21 15 ITEM_ALIGN_LEFT - 7 30 ITEM_ALIGN_LEFT - 45 100 ITEM_ALIGN_LEFT - 172 20 ITEM_ALIGN_RIGHT - 209 20 ITEM_ALIGN_RIGHT - 247 20 ITEM_ALIGN_RIGHT + 5 15 ITEM_ALIGN_LEFT + 21 15 ITEM_ALIGN_LEFT + 7 30 ITEM_ALIGN_LEFT + 45 ((W/2)-200) ITEM_ALIGN_LEFT + ((W/2)-120) 20 ITEM_ALIGN_RIGHT + ((W/2)-80) 20 ITEM_ALIGN_RIGHT + ((W/2)-40) 20 ITEM_ALIGN_RIGHT } - - // PLAYER LIST BORDER // + // spectators // itemDef { name window - rect 14 141 612 221 - style WINDOW_STYLE_EMPTY - border 1 - bordercolor .5 .5 .5 1 - forecolor 1 1 1 1 - backcolor 0 0 0 .5 - visible 1 - decoration - } - - - // spectators // - - itemDef - { - name window - rect 14 366 612 24 + rect 0 (H-BAR_H) W BAR_H style WINDOW_STYLE_FILLED - border 1 + border WINDOW_BORDER_FULL + borderSize 1.0 bordercolor .5 .5 .5 1 - forecolor 1 1 1 .7 - backcolor 0 0 0 .5 + backcolor 0 0 0 .8 textscale .33 - visible 1 + visible MENU_TRUE decoration } @@ -260,46 +331,28 @@ { name window text "Spectating:" - textaligny 20 - rect 19 366 82 24 + rect 0 (H-BAR_H) SPEC_W BAR_H style WINDOW_STYLE_FILLED forecolor 1 1 1 1 textscale .33 - textalignx 3 - visible 1 + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER + textalignx TOFF + visible MENU_TRUE decoration } itemDef { name window - rect 100 366 520 24 + rect SPEC_W (H-BAR_H) (W-SPEC_W) BAR_H style WINDOW_STYLE_FILLED forecolor 1 1 1 1 textscale .33 - visible 1 + textvalign ITEM_VALIGN_CENTER + visible MENU_TRUE ownerdraw CG_SPECTATORS decoration } - - // WINNAR // - - itemDef - { - name winner - rect 310 400 612 40 - type 4 - style 0 - text "" - cvar ui_winner - maxPaintChars 24 - textalign ITEM_ALIGN_CENTER - textaligny 20 - textscale .5 - forecolor 1 1 1 1 - visible 1 - decoration - } - } } diff --git a/ui/tremulous.txt b/ui/tremulous.txt index 6bcc08f1..deb04d9a 100644 --- a/ui/tremulous.txt +++ b/ui/tremulous.txt @@ -1,18 +1,18 @@ // menu defs -// -{ +// +{ loadMenu { "ui/tremulous_teamselect.menu" } loadMenu { "ui/tremulous_alienclass.menu" } loadMenu { "ui/tremulous_humanitem.menu" } - + loadMenu { "ui/tremulous_alienbuild.menu" } loadMenu { "ui/tremulous_humanbuild.menu" } - + loadMenu { "ui/tremulous_humanarmoury.menu" } - + loadMenu { "ui/tremulous_humandialogs.menu" } loadMenu { "ui/tremulous_aliendialogs.menu" } - + loadMenu { "ui/tremulous_alienupgrade.menu" } loadMenu { "ui/ptrc.menu" } diff --git a/ui/tremulous_alien_builder_hud.menu b/ui/tremulous_alien_builder_hud.menu index bf75327c..5274d707 100644 --- a/ui/tremulous_alien_builder_hud.menu +++ b/ui/tremulous_alien_builder_hud.menu @@ -1,285 +1,26 @@ #include "ui/menudef.h" -// team menu -// -// defines from ui_shared.h - { + +#define W 640 +#define H 480 + menuDef { name "alien_builder_hud" fullScreen MENU_FALSE visible MENU_TRUE - rect 0 0 640 480 - - //CONSOLE - itemDef - { - name "console" - rect 8 8 560 180 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 1 - align ITEM_ALIGN_LEFT - textalignx 0 - textaligny 18 - textscale 0.4 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_CONSOLE - } - - //TUTORIAL - itemDef - { - name "tutorial" - rect 8 250 640 180 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 0.35 - align ITEM_ALIGN_LEFT - textalignx 0 - textaligny 18 - textscale 0.3 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_TUTORIAL - } - - //LAGOMETER - itemDef - { - name "lagometer" - rect 596 68 32 20 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 0 0 1 - textscale 0.3 - textalignx 1 - textaligny 0.5 - ownerdraw CG_LAGOMETER - } - - //DEMO STATE - itemDef - { - name "demoRecording" - rect 596 120 32 32 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 0 0 1 - textscale 0.3 - textalignx 1 - textaligny 0.5 - ownerdraw CG_DEMO_RECORDING - background "ui/assets/neutral/circle.tga" - } - itemDef - { - name "demoPlayback" - rect 596 120 32 32 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 1 - textscale 0.3 - textalignx 1 - textaligny 0.5 - ownerdraw CG_DEMO_PLAYBACK - background "ui/assets/forwardarrow.tga" - } - - //SELECT - itemDef - { - name "select" - rect 240 435 160 32 - visible 0 - decoration - ownerdraw CG_PLAYER_SELECT - } - - ////////////////// - //STATIC OBJECTS// - ////////////////// + rect 0 0 W H - //LEFT RING CIRCLE - itemDef - { - name "left-ring-circle" - rect 47.5 410 25 25 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.25 - style WINDOW_STYLE_SHADER - background "ui/assets/neutral/circle.tga" - } - - //LEFT ARM - itemDef - { - name "left-arm" - rect 77 404.75 104 52.5 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.25 - style WINDOW_STYLE_SHADER - background "ui/assets/alien/left-arm.tga" - } - - //LEFT ARM CIRCLE - itemDef - { - name "left-arm-circle" - rect 150 417.5 25 25 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.25 - style WINDOW_STYLE_SHADER - background "ui/assets/neutral/circle.tga" - } - - //RIGHT RING CIRCLE - itemDef - { - name "right-ring-circle" - rect 567 410 25 25 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.25 - style WINDOW_STYLE_SHADER - background "ui/assets/neutral/circle.tga" - } - - //RIGHT ARM - itemDef - { - name "right-arm" - rect 459 404.75 104 52.5 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.25 - style WINDOW_STYLE_SHADER - background "ui/assets/alien/right-arm.tga" - } - - /////////////////// - //DYNAMIC OBJECTS// - /////////////////// - - //BOLT - itemDef - { - name "bolt" - rect 52.5 412.5 15 20 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.5 - background "ui/assets/alien/bolt.tga" - ownerdraw CG_PLAYER_BOOST_BOLT - } - - //CROSS - itemDef - { - name "cross" - rect 155 422.5 15 15 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.5 - style WINDOW_STYLE_SHADER - background "ui/assets/neutral/cross.tga" - } - - //LEFT RING - itemDef - { - name "left-ring" - rect 7.25 369.5 90.5 106 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.5 - background "ui/assets/alien/left-ring.tga" - ownerdraw CG_PLAYER_BOOSTED - } - - //LEFT SPIKES - itemDef - { - name "left-spikes" - rect 18.5 381 59 83 - visible 1 - decoration - forecolor 1.0 0.0 0.0 1.0 - background "ui/assets/alien/left-spikes.tga" - ownerdraw CG_PLAYER_WALLCLIMBING - } - - //RIGHT RING - itemDef - { - name "right-ring" - rect 542.25 369.5 90.5 106 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.5 - background "ui/assets/alien/right-ring.tga" - ownerdraw CG_PLAYER_BOOSTED - } - - //RIGHT SPIKES - itemDef - { - name "right-spikes" - rect 562.5 381 59 83 - visible 1 - decoration - forecolor 1.0 0.0 0.0 1.0 - background "ui/assets/alien/right-spikes.tga" - ownerdraw CG_PLAYER_WALLCLIMBING - } - - //HEALTH - itemDef - { - name "health" - rect 78.5 421.5 60 15 - visible 1 - decoration - forecolor 1.0 0.0 0.0 .5 - ownerdraw CG_PLAYER_HEALTH - } - - //ALIEN CLASS ICON - itemDef - { - name "alien-icon" - rect 465 417.5 25 25 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.6 - ownerdraw CG_PLAYER_WEAPONICON - } - - //ORGANS - itemDef - { - name "organs" - rect 570.5 415.95 15 15 - visible 1 - decoration - forecolor 1.0 0.0 0.0 .5 - ownerdraw CG_PLAYER_CREDITS_VALUE_NOPAD - } +#include "ui/tremulous_alien_common_hud.h" +#include "ui/tremulous_common_hud.h" //BUILD TIMER itemDef { name "buildtimer" rect 567 410 25 25 - visible 1 + visible MENU_TRUE decoration forecolor 1.0 0.0 0.0 .5 ownerdraw CG_PLAYER_BUILD_TIMER @@ -290,82 +31,10 @@ { name "build-points" rect 483.5 421.5 60 15 - visible 1 + visible MENU_TRUE decoration forecolor 1.0 0.0 0.0 .5 ownerdraw CG_PLAYER_AMMO_VALUE } - - //FPS - itemDef - { - name "fps" - rect 572 8 56 22 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1.0 0.0 0.0 1 - align ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 18 - textscale 0.3 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_FPS - } - - //TIMER - itemDef - { - name "timer" - rect 572 38 56 22 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1.0 0.0 0.0 1 - align ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 18 - textscale 0.3 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_TIMER - } - - //CLOCK - itemDef - { - name "clock" - rect 572 90 56 22 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1.0 0.0 0.0 1 - align ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 18 - textscale 0.25 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_CLOCK - } - - //ALIENSENSE - itemDef - { - name "aliensense" - rect 20 20 600 400 - visible 1 - decoration - ownerdraw CG_PLAYER_ALIEN_SENSE - } - - //PLAYER NAME - itemDef - { - name "playername" - rect 200 275 240 25 - visible 1 - decoration - textScale .5 - ownerdraw CG_PLAYER_CROSSHAIRNAMES - } } } diff --git a/ui/tremulous_alien_common_hud.h b/ui/tremulous_alien_common_hud.h new file mode 100644 index 00000000..6ac76733 --- /dev/null +++ b/ui/tremulous_alien_common_hud.h @@ -0,0 +1,186 @@ +#define COMMON_HUD_R 1.0 +#define COMMON_HUD_G 0.0 +#define COMMON_HUD_B 0.0 + +////////////////// +//STATIC OBJECTS// +////////////////// + +//LEFT RING CIRCLE +itemDef +{ + name "left-ring-circle" + rect 47.5 410 25 25 + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.25 + style WINDOW_STYLE_SHADER + background "ui/assets/neutral/circle.tga" +} + +//LEFT ARM +itemDef +{ + name "left-arm" + rect 77 404.75 104 52.5 + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.25 + style WINDOW_STYLE_SHADER + background "ui/assets/alien/left-arm.tga" +} + +//LEFT ARM CIRCLE +itemDef +{ + name "left-arm-circle" + rect 150 417.5 25 25 + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.25 + style WINDOW_STYLE_SHADER + background "ui/assets/neutral/circle.tga" +} + +//RIGHT RING CIRCLE +itemDef +{ + name "right-ring-circle" + rect 567 410 25 25 + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.25 + style WINDOW_STYLE_SHADER + background "ui/assets/neutral/circle.tga" +} + +//RIGHT ARM +itemDef +{ + name "right-arm" + rect 459 404.75 104 52.5 + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.25 + style WINDOW_STYLE_SHADER + background "ui/assets/alien/right-arm.tga" +} + +/////////////////// +//DYNAMIC OBJECTS// +/////////////////// + +//BOLT +itemDef +{ + name "bolt" + rect 52.5 412.5 15 20 + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 + background "ui/assets/alien/bolt.tga" + ownerdraw CG_PLAYER_BOOST_BOLT +} + +//CROSS +itemDef +{ + name "cross" + rect 155 422.5 15 15 + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 + style WINDOW_STYLE_SHADER + background "ui/assets/neutral/cross.tga" +} + +//LEFT RING +itemDef +{ + name "left-ring" + rect 7.25 369.5 90.5 106 + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 + background "ui/assets/alien/left-ring.tga" + ownerdraw CG_PLAYER_BOOSTED +} + +//LEFT SPIKES +itemDef +{ + name "left-spikes" + rect 18.5 381 59 83 + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 1.0 + background "ui/assets/alien/left-spikes.tga" + ownerdraw CG_PLAYER_WALLCLIMBING +} + +//RIGHT RING +itemDef +{ + name "right-ring" + rect 542.25 369.5 90.5 106 + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 + background "ui/assets/alien/right-ring.tga" + ownerdraw CG_PLAYER_BOOSTED +} + +//RIGHT SPIKES +itemDef +{ + name "right-spikes" + rect 562.5 381 59 83 + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 1.0 + background "ui/assets/alien/right-spikes.tga" + ownerdraw CG_PLAYER_WALLCLIMBING +} + +//HEALTH +itemDef +{ + name "health" + rect 78.5 421.5 60 15 + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B .5 + ownerdraw CG_PLAYER_HEALTH +} + +//ALIEN CLASS ICON +itemDef +{ + name "alien-icon" + rect 465 417.5 25 25 + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.6 + ownerdraw CG_PLAYER_WEAPONICON +} + +//ORGANS +itemDef +{ + name "organs" + rect 570.5 415.95 15 15 + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B .5 + ownerdraw CG_PLAYER_CREDITS_VALUE_NOPAD +} + +//ALIENSENSE +itemDef +{ + name "aliensense" + rect 20 20 600 400 + visible MENU_TRUE + decoration + ownerdraw CG_PLAYER_ALIEN_SENSE +} diff --git a/ui/tremulous_alien_general_hud.menu b/ui/tremulous_alien_general_hud.menu index cc816008..62e8af86 100644 --- a/ui/tremulous_alien_general_hud.menu +++ b/ui/tremulous_alien_general_hud.menu @@ -1,360 +1,29 @@ #include "ui/menudef.h" -// team menu -// -// defines from ui_shared.h - { + +#define W 640 +#define H 480 + menuDef { name "alien_general_hud" fullScreen MENU_FALSE visible MENU_TRUE - rect 0 0 640 480 - - //CONSOLE - itemDef - { - name "console" - rect 8 8 560 180 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 1 - align ITEM_ALIGN_LEFT - textalignx 0 - textaligny 18 - textscale 0.4 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_CONSOLE - } - - //TUTORIAL - itemDef - { - name "tutorial" - rect 8 250 640 180 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 0.35 - align ITEM_ALIGN_LEFT - textalignx 0 - textaligny 18 - textscale 0.3 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_TUTORIAL - } - - //LAGOMETER - itemDef - { - name "lagometer" - rect 596 68 32 20 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 0 0 1 - textscale 0.3 - textalignx 1 - textaligny 0.5 - ownerdraw CG_LAGOMETER - } - - //DEMO STATE - itemDef - { - name "demoRecording" - rect 596 120 32 32 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 0 0 1 - textscale 0.3 - textalignx 1 - textaligny 0.5 - ownerdraw CG_DEMO_RECORDING - background "ui/assets/neutral/circle.tga" - } - itemDef - { - name "demoPlayback" - rect 596 120 32 32 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 1 - textscale 0.3 - textalignx 1 - textaligny 0.5 - ownerdraw CG_DEMO_PLAYBACK - background "ui/assets/forwardarrow.tga" - } - - //SELECT - itemDef - { - name "select" - rect 240 435 160 32 - visible 0 - decoration - ownerdraw CG_PLAYER_SELECT - } - - ////////////////// - //STATIC OBJECTS// - ////////////////// + rect 0 0 W H - //LEFT RING CIRCLE - itemDef - { - name "left-ring-circle" - rect 47.5 410 25 25 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.25 - style WINDOW_STYLE_SHADER - background "ui/assets/neutral/circle.tga" - } - - //LEFT ARM - itemDef - { - name "left-arm" - rect 77 404.75 104 52.5 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.25 - style WINDOW_STYLE_SHADER - background "ui/assets/alien/left-arm.tga" - } - - //LEFT ARM CIRCLE - itemDef - { - name "left-arm-circle" - rect 150 417.5 25 25 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.25 - style WINDOW_STYLE_SHADER - background "ui/assets/neutral/circle.tga" - } - - //RIGHT RING CIRCLE - itemDef - { - name "right-ring-circle" - rect 567 410 25 25 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.25 - style WINDOW_STYLE_SHADER - background "ui/assets/neutral/circle.tga" - } - - //RIGHT ARM - itemDef - { - name "right-arm" - rect 459 404.75 104 52.5 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.25 - style WINDOW_STYLE_SHADER - background "ui/assets/alien/right-arm.tga" - } - - /////////////////// - //DYNAMIC OBJECTS// - /////////////////// +#include "ui/tremulous_alien_common_hud.h" +#include "ui/tremulous_common_hud.h" //BLOB itemDef { name "blob" rect 479 419 57 18 - visible 1 + visible MENU_TRUE forecolor 1.0 0.0 0.0 0.5 background "ui/assets/alien/tremublob.tga" ownerdraw CG_PLAYER_POISON_BARBS } - - //BOLT - itemDef - { - name "bolt" - rect 52.5 412.5 15 20 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.5 - background "ui/assets/alien/bolt.tga" - ownerdraw CG_PLAYER_BOOST_BOLT - } - - //CROSS - itemDef - { - name "cross" - rect 155 422.5 15 15 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.5 - style WINDOW_STYLE_SHADER - background "ui/assets/neutral/cross.tga" - } - - //LEFT RING - itemDef - { - name "left-ring" - rect 7.25 369.5 90.5 106 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.5 - background "ui/assets/alien/left-ring.tga" - ownerdraw CG_PLAYER_BOOSTED - } - - //LEFT SPIKES - itemDef - { - name "left-spikes" - rect 18.5 381 59 83 - visible 1 - decoration - forecolor 1.0 0.0 0.0 1.0 - background "ui/assets/alien/left-spikes.tga" - ownerdraw CG_PLAYER_WALLCLIMBING - } - - //RIGHT RING - itemDef - { - name "right-ring" - rect 542.25 369.5 90.5 106 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.5 - background "ui/assets/alien/right-ring.tga" - ownerdraw CG_PLAYER_BOOSTED - } - - //RIGHT SPIKES - itemDef - { - name "right-spikes" - rect 562.5 381 59 83 - visible 1 - decoration - forecolor 1.0 0.0 0.0 1.0 - background "ui/assets/alien/right-spikes.tga" - ownerdraw CG_PLAYER_WALLCLIMBING - } - - //HEALTH - itemDef - { - name "health" - rect 78.5 421.5 60 15 - visible 1 - decoration - forecolor 1.0 0.0 0.0 .5 - ownerdraw CG_PLAYER_HEALTH - } - - //ALIEN CLASS ICON - itemDef - { - name "alien-icon" - rect 465 417.5 25 25 - visible 1 - decoration - forecolor 1.0 0.0 0.0 0.6 - ownerdraw CG_PLAYER_WEAPONICON - } - - //ORGANS - itemDef - { - name "organs" - rect 570.5 415.95 15 15 - visible 1 - decoration - forecolor 1.0 0.0 0.0 .5 - ownerdraw CG_PLAYER_CREDITS_VALUE_NOPAD - } - - //FPS - itemDef - { - name "fps" - rect 572 8 56 22 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1.0 0.0 0.0 1 - align ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 18 - textscale 0.3 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_FPS - } - - //TIMER - itemDef - { - name "timer" - rect 572 38 56 22 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1.0 0.0 0.0 1 - align ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 18 - textscale 0.3 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_TIMER - } - - //CLOCK - itemDef - { - name "clock" - rect 572 90 56 22 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1.0 0.0 0.0 1 - align ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 18 - textscale 0.25 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_CLOCK - } - - //ALIENSENSE - itemDef - { - name "aliensense" - rect 20 20 600 400 - visible 1 - decoration - ownerdraw CG_PLAYER_ALIEN_SENSE - } - - //PLAYER NAME - itemDef - { - name "playername" - rect 200 275 240 25 - visible 1 - decoration - textScale .5 - ownerdraw CG_PLAYER_CROSSHAIRNAMES - } } } diff --git a/ui/tremulous_alienbuild.menu b/ui/tremulous_alienbuild.menu index 6ea6c0d1..522d17f5 100644 --- a/ui/tremulous_alienbuild.menu +++ b/ui/tremulous_alienbuild.menu @@ -1,36 +1,55 @@ #include "ui/menudef.h" { + +#define W 450 +#define H 250 +#define BORDER 10 + +#define LIST_W 140 +#define LIST_H (H-(2*BORDER)) +#define LIST_X BORDER +#define LIST_Y BORDER + +#define BUTT_H 25 +#define BUTT_W 45 + +#define INFO_W (W-((3*BORDER)+LIST_W)) +#define INFO_H (H-((3*BORDER)+BUTT_H)) +#define INFO_X ((2*BORDER)+LIST_W) +#define INFO_Y BORDER +#define INFO_TOFF 6 + menuDef { name "tremulous_alienbuild" - visible 0 - fullscreen 0 + visible MENU_FALSE + fullscreen MENU_FALSE outOfBoundsClick - rect 112 111 400 247 + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 + style WINDOW_STYLE_FILLED popup onOpen { uiScript LoadAlienBuilds; setFocus list } itemDef { name window - rect 0 0 400 247 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL borderSize 1.0 borderColor 0.5 0.5 0.5 1 } - + itemDef { name "list" - rect 8 8 136 231 + rect LIST_X LIST_Y LIST_W LIST_H type ITEM_TYPE_LISTBOX style WINDOW_STYLE_EMPTY elementwidth 120 @@ -38,78 +57,78 @@ textscale .33 elementtype LISTBOX_TEXT feeder FEEDER_TREMALIENBUILD - border 1 + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 - doubleclick + visible MENU_TRUE + doubleclick { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript BuildAlienBuildable; close tremulous_alienbuild } } - + itemDef { name infopane ownerdraw UI_ABUILDINFOPANE textstyle ITEM_TEXTSTYLE_NORMAL style WINDOW_STYLE_EMPTY - rect 152 8 240 204 + rect INFO_X INFO_Y INFO_W INFO_H textscale .33 - textalignx 6 - textaligny 12 - border 1 + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_TOP + textalignx INFO_TOFF + textaligny INFO_TOFF + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE decoration } - + itemDef { name "OKCancel" text "OK" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 305 218 34 21 - textalign ITEM_ALIGN_LEFT - textalignx 12.5 - textaligny 18 + rect (W-((2*BORDER)+(2*BUTT_W))) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript BuildAlienBuildable; close tremulous_alienbuild } } - + itemDef { name "OKCancel" text "Cancel" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 344 218 50 21 - textalign ITEM_ALIGN_LEFT - textalignx 3.8 - textaligny 18 + rect (W-(BORDER+BUTT_W)) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu3.wav"; + play "sound/misc/menu3.wav"; close tremulous_alienbuild } } diff --git a/ui/tremulous_alienclass.menu b/ui/tremulous_alienclass.menu index 0d8cf5eb..ad891757 100644 --- a/ui/tremulous_alienclass.menu +++ b/ui/tremulous_alienclass.menu @@ -1,36 +1,55 @@ #include "ui/menudef.h" { + +#define W 450 +#define H 250 +#define BORDER 10 + +#define LIST_W 140 +#define LIST_H (H-(2*BORDER)) +#define LIST_X BORDER +#define LIST_Y BORDER + +#define BUTT_H 25 +#define BUTT_W 45 + +#define INFO_W (W-((3*BORDER)+LIST_W)) +#define INFO_H (H-((3*BORDER)+BUTT_H)) +#define INFO_X ((2*BORDER)+LIST_W) +#define INFO_Y BORDER +#define INFO_TOFF 6 + menuDef { name "tremulous_alienclass" - visible 1 - fullscreen 0 + visible MENU_TRUE + fullscreen MENU_FALSE outOfBoundsClick - rect 112 111 400 247 + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 + style WINDOW_STYLE_FILLED popup onOpen { uiScript LoadAlienClasses; setFocus list } itemDef { name window - rect 0 0 400 247 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL borderSize 1.0 borderColor 0.5 0.5 0.5 1 } - + itemDef { name "list" - rect 8 8 136 231 + rect LIST_X LIST_Y LIST_W LIST_H type ITEM_TYPE_LISTBOX style WINDOW_STYLE_EMPTY elementwidth 120 @@ -38,100 +57,99 @@ textscale .33 elementtype LISTBOX_TEXT feeder FEEDER_TREMALIENCLASSES - border 1 + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE doubleclick { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript SpawnAsAlienClass; close tremulous_alienclass } } - + itemDef { name infopane ownerdraw UI_ACLASSINFOPANE textstyle ITEM_TEXTSTYLE_NORMAL style WINDOW_STYLE_EMPTY - rect 152 8 240 204 + rect INFO_X INFO_Y INFO_W INFO_H textscale .33 - textalignx 6 - textaligny 12 - border 1 + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_TOP + textalignx INFO_TOFF + textaligny INFO_TOFF + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE decoration } - + itemDef { name "Back" text "< Back" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 152 218 50 21 - textalign ITEM_ALIGN_LEFT - textalignx 3 - textaligny 18 + rect ((2*BORDER)+LIST_W) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu4.wav"; + play "sound/misc/menu4.wav"; close tremulous_alienclass; open tremulous_teamselect } } - + itemDef { name "OKCancel" text "OK" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 305 218 34 21 - textalign ITEM_ALIGN_LEFT - textalignx 12.5 - textaligny 18 + rect (W-((2*BORDER)+(2*BUTT_W))) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript SpawnAsAlienClass; close tremulous_alienclass } } - + itemDef { name "OKCancel" text "Cancel" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 344 218 50 21 - textalign ITEM_ALIGN_LEFT - textalignx 3.8 - textaligny 18 + rect (W-(BORDER+BUTT_W)) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu3.wav"; + play "sound/misc/menu3.wav"; close tremulous_alienclass } } diff --git a/ui/tremulous_aliendialogs.menu b/ui/tremulous_aliendialogs.menu index 1e55ed79..159afb02 100644 --- a/ui/tremulous_aliendialogs.menu +++ b/ui/tremulous_aliendialogs.menu @@ -1,13 +1,26 @@ #include "ui/menudef.h" { + +#define W 280 +#define H 190 +#define BORDER 10 + +#define BUTT_H 25 +#define BUTT_W 45 + +#define INFO_W (W-(2*BORDER)) +#define INFO_H (H-((4*BORDER)+(2*BUTT_H))) +#define INFO_X BORDER +#define INFO_Y ((2*BORDER)+BUTT_H) + menuDef { name "tremulous_alien_dialog" - visible 0 - fullscreen 0 + visible MENU_FALSE + fullscreen MENU_FALSE outOfBoundsClick - rect 185 140 280 190 + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 style WINDOW_STYLE_EMPTY popup @@ -15,17 +28,17 @@ itemDef { name window - rect 0 0 280 190 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL borderSize 1.0 borderColor 0.5 0.5 0.5 1 } - + itemDef { name alien_dialog @@ -33,51 +46,49 @@ type ITEM_TYPE_TEXT textstyle ITEM_TEXTSTYLE_NORMAL style WINDOW_STYLE_EMPTY - rect 115 10 50 20 - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 18 + rect BORDER BORDER INFO_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE decoration } - + itemDef { name alien_dialog textstyle ITEM_TEXTSTYLE_NORMAL style WINDOW_STYLE_EMPTY - rect 10 50 250 80 + rect INFO_X INFO_Y INFO_W INFO_H cvar "ui_dialog" - autowrapped - textalignx 5 - textaligny 18 + wrapped + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .33 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE decoration } - + itemDef { name alien_dialog text "OK" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 242 150 28 20 - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 18 + rect (W-(BORDER+BUTT_W)) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; close tremulous_alien_dialog } } diff --git a/ui/tremulous_alienupgrade.menu b/ui/tremulous_alienupgrade.menu index 5dc67318..d31b2832 100644 --- a/ui/tremulous_alienupgrade.menu +++ b/ui/tremulous_alienupgrade.menu @@ -1,25 +1,44 @@ #include "ui/menudef.h" { + +#define W 450 +#define H 250 +#define BORDER 10 + +#define LIST_W 140 +#define LIST_H (H-(2*BORDER)) +#define LIST_X BORDER +#define LIST_Y BORDER + +#define BUTT_H 25 +#define BUTT_W 45 + +#define INFO_W (W-((3*BORDER)+LIST_W)) +#define INFO_H (H-((3*BORDER)+BUTT_H)) +#define INFO_X ((2*BORDER)+LIST_W) +#define INFO_Y BORDER +#define INFO_TOFF 6 + menuDef { name "tremulous_alienupgrade" - visible 1 - fullscreen 0 + visible MENU_TRUE + fullscreen MENU_FALSE outOfBoundsClick - rect 112 111 400 247 + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 + style WINDOW_STYLE_FILLED popup onOpen { uiScript LoadAlienUpgrades; setFocus list } itemDef { name window - rect 0 0 400 247 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL @@ -30,7 +49,7 @@ itemDef { name "list" - rect 8 8 136 231 + rect LIST_X LIST_Y LIST_W LIST_H type ITEM_TYPE_LISTBOX style WINDOW_STYLE_EMPTY elementwidth 120 @@ -38,78 +57,78 @@ textscale .33 elementtype LISTBOX_TEXT feeder FEEDER_TREMALIENUPGRADE - border 1 + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE doubleclick { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript UpgradeToNewClass; close tremulous_alienupgrade } } - + itemDef { name infopane ownerdraw UI_AUPGRADEINFOPANE textstyle ITEM_TEXTSTYLE_NORMAL - style WINDOW_STYLE_EMPTY - rect 152 8 240 204 + style WINDOW_STYLE_EMPTY + rect INFO_X INFO_Y INFO_W INFO_H textscale .33 - textalignx 6 - textaligny 12 - border 1 + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_TOP + textalignx INFO_TOFF + textaligny INFO_TOFF + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE decoration } - + itemDef { name "OKCancel" text "OK" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 305 218 34 21 - textalign ITEM_ALIGN_LEFT - textalignx 12.5 - textaligny 18 + rect (W-((2*BORDER)+(2*BUTT_W))) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript UpgradeToNewClass; close tremulous_alienupgrade } } - + itemDef { name "OKCancel" text "Cancel" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 344 218 50 21 - textalign ITEM_ALIGN_LEFT - textalignx 3.8 - textaligny 18 + rect (W-(BORDER+BUTT_W)) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu3.wav"; + play "sound/misc/menu3.wav"; close tremulous_alienupgrade } } diff --git a/ui/tremulous_common_hud.h b/ui/tremulous_common_hud.h new file mode 100644 index 00000000..025bc68e --- /dev/null +++ b/ui/tremulous_common_hud.h @@ -0,0 +1,158 @@ +#define BORDER 10 + +#define STAT_W 45 +#define STAT_H 22 +#define STAT_X (W-(BORDER+STAT_W)) + +#define CONSOLE_W (W-((3*BORDER)+STAT_W)) +#define CONSOLE_H 180 +#define MAIN_W (W-(2*BORDER)) + +//CONSOLE +itemDef +{ + name "console" + rect BORDER BORDER CONSOLE_W CONSOLE_H + style WINDOW_STYLE_EMPTY + visible MENU_TRUE + decoration + forecolor 1 1 1 1 + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_TOP + textscale 0.4 + textstyle ITEM_TEXTSTYLE_NORMAL + ownerdraw CG_CONSOLE +} + +//TUTORIAL +itemDef +{ + name "tutorial" + rect BORDER 250 MAIN_W 180 + style WINDOW_STYLE_EMPTY + visible MENU_TRUE + decoration + forecolor 1 1 1 0.35 + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_TOP + textscale 0.3 + textstyle ITEM_TEXTSTYLE_NORMAL + ownerdraw CG_TUTORIAL +} + +//FPS +itemDef +{ + name "fps" + rect STAT_X BORDER STAT_W STAT_H + style WINDOW_STYLE_EMPTY + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 1 + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textscale 0.3 + textstyle ITEM_TEXTSTYLE_NORMAL + ownerdraw CG_FPS +} +//TIMER +itemDef +{ + name "timer" + rect STAT_X ((2*BORDER)+STAT_H) STAT_W STAT_H + style WINDOW_STYLE_EMPTY + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 1 + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textscale 0.3 + textstyle ITEM_TEXTSTYLE_NORMAL + ownerdraw CG_TIMER +} +//LAGOMETER +itemDef +{ + name "lagometer" + rect STAT_X ((3*BORDER)+(2*STAT_H)) STAT_W STAT_H + style WINDOW_STYLE_EMPTY + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 1 + textscale 0.3 + textalignx 1 + textaligny 0.5 + ownerdraw CG_LAGOMETER +} +//CLOCK +itemDef +{ + name "clock" + rect 572 90 56 22 + rect STAT_X ((4*BORDER)+(3*STAT_H)) STAT_W STAT_H + style WINDOW_STYLE_EMPTY + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 1 + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER + textscale 0.25 + textstyle ITEM_TEXTSTYLE_NORMAL + ownerdraw CG_CLOCK +} +//DEMO STATE +itemDef +{ + name "demoRecording" + rect (STAT_X+(STAT_W-32)) ((5*BORDER)+(4*STAT_H)) 32 32 + style WINDOW_STYLE_EMPTY + visible MENU_TRUE + decoration + forecolor 1 0 0 1 + textscale 0.3 + textalignx 1 + textaligny 0.5 + ownerdraw CG_DEMO_RECORDING + background "ui/assets/neutral/circle.tga" +} +itemDef +{ + name "demoPlayback" + rect (STAT_X+(STAT_W-32)) ((5*BORDER)+(4*STAT_H)) 32 32 + style WINDOW_STYLE_EMPTY + visible MENU_TRUE + decoration + forecolor 1 1 1 1 + textscale 0.3 + textalignx 1 + textaligny 0.5 + ownerdraw CG_DEMO_PLAYBACK + background "ui/assets/forwardarrow.tga" +} + +//SNAPSHOT +itemDef +{ + name "snapshot" + rect BORDER 196 MAIN_W STAT_H + style WINDOW_STYLE_EMPTY + visible MENU_TRUE + decoration + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 1 + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_CENTER + textscale 0.4 + textstyle ITEM_TEXTSTYLE_NORMAL + ownerdraw CG_SNAPSHOT +} + +//PLAYER NAME +itemDef +{ + name "playername" + rect 200 275 240 25 + visible MENU_TRUE + decoration + textScale .5 + ownerdraw CG_PLAYER_CROSSHAIRNAMES +} diff --git a/ui/tremulous_default_hud.menu b/ui/tremulous_default_hud.menu index 0eed6404..02689861 100644 --- a/ui/tremulous_default_hud.menu +++ b/ui/tremulous_default_hud.menu @@ -1,165 +1,20 @@ #include "ui/menudef.h" { + +#define W 640 +#define H 480 + menuDef { name "default_hud" fullScreen MENU_FALSE visible MENU_TRUE - rect 0 0 640 480 - - //CONSOLE - itemDef - { - name "console" - rect 8 8 560 180 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 1 - align ITEM_ALIGN_LEFT - textalignx 0 - textaligny 18 - textscale 0.4 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_CONSOLE - } - - //TUTORIAL - itemDef - { - name "tutorial" - rect 8 250 640 180 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 0.35 - align ITEM_ALIGN_LEFT - textalignx 0 - textaligny 18 - textscale 0.3 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_TUTORIAL - } + rect 0 0 W H - //FPS - itemDef - { - name "fps" - rect 572 8 56 22 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 1 - align ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 18 - textscale 0.3 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_FPS - } - //TIMER - itemDef - { - name "timer" - rect 572 38 56 22 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 1 - align ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 18 - textscale 0.3 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_TIMER - } - //CLOCK - itemDef - { - name "clock" - rect 572 90 56 22 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 1 - align ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 18 - textscale 0.25 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_CLOCK - } - - //SNAPSHOT - itemDef - { - name "snapshot" - rect 8 196 200 22 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 1 - align ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 18 - textscale 0.4 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_SNAPSHOT - } - //LAGOMETER - itemDef - { - name "lagometer" - rect 596 68 32 20 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 1 - textscale 0.3 - textalignx 1 - textaligny 0.5 - ownerdraw CG_LAGOMETER - } - //DEMO STATE - itemDef - { - name "demoRecording" - rect 596 120 32 32 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 0 0 1 - textscale 0.3 - textalignx 1 - textaligny 0.5 - ownerdraw CG_DEMO_RECORDING - background "ui/assets/neutral/circle.tga" - } - itemDef - { - name "demoPlayback" - rect 596 120 32 32 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 1 - textscale 0.3 - textalignx 1 - textaligny 0.5 - ownerdraw CG_DEMO_PLAYBACK - background "ui/assets/forwardarrow.tga" - } - - //PLAYER NAME - itemDef - { - name "playername" - rect 200 275 240 25 - visible 1 - decoration - textScale .5 - ownerdraw CG_PLAYER_CROSSHAIRNAMES - } +#define COMMON_HUD_R 1.0 +#define COMMON_HUD_G 1.0 +#define COMMON_HUD_B 1.0 +#include "ui/tremulous_common_hud.h" } } diff --git a/ui/tremulous_human_hud.menu b/ui/tremulous_human_hud.menu index 8fe00950..38354b4a 100644 --- a/ui/tremulous_human_hud.menu +++ b/ui/tremulous_human_hud.menu @@ -1,163 +1,21 @@ #include "ui/menudef.h" -// team menu -// -// defines from ui_shared.h - { + +#define W 640 +#define H 480 + menuDef { name "human_hud" fullScreen MENU_FALSE visible MENU_TRUE - rect 0 0 640 480 - - //CONSOLE - itemDef - { - name "console" - rect 8 8 560 180 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 1 - align ITEM_ALIGN_LEFT - textalignx 0 - textaligny 18 - textscale 0.4 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_CONSOLE - } - - //TUTORIAL - itemDef - { - name "tutorial" - rect 8 250 640 180 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 0.35 - align ITEM_ALIGN_LEFT - textalignx 0 - textaligny 18 - textscale 0.3 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_TUTORIAL - } - - //LAGOMETER - itemDef - { - name "lagometer" - rect 596 68 32 20 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 0 0.8 1 1 - textscale 0.3 - textalignx 1 - textaligny 0.5 - ownerdraw CG_LAGOMETER - } - - //DEMO STATE - itemDef - { - name "demoRecording" - rect 596 120 32 32 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 0 0 1 - textscale 0.3 - textalignx 1 - textaligny 0.5 - ownerdraw CG_DEMO_RECORDING - background "ui/assets/neutral/circle.tga" - } - itemDef - { - name "demoPlayback" - rect 596 120 32 32 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 1 - textscale 0.3 - textalignx 1 - textaligny 0.5 - ownerdraw CG_DEMO_PLAYBACK - background "ui/assets/forwardarrow.tga" - } - - //FPS - itemDef - { - name "fps" - rect 572 8 56 22 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 0.0 0.8 1.0 1 - align ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 18 - textscale 0.3 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_FPS - } - - //TIMER - itemDef - { - name "timer" - rect 572 38 56 22 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 0.0 0.8 1.0 1 - align ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 18 - textscale 0.3 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_TIMER - } - - //CLOCK - itemDef - { - name "clock" - rect 572 90 56 22 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 0.0 0.8 1.0 1 - align ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 18 - textscale 0.25 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_CLOCK - } + rect 0 0 W H - //SNAPSHOT - itemDef - { - name "snapshot" - rect 8 196 200 22 - style WINDOW_STYLE_EMPTY - visible 1 - decoration - forecolor 1 1 1 1 - align ITEM_ALIGN_RIGHT - textalignx 0 - textaligny 18 - textscale 0.4 - textstyle ITEM_TEXTSTYLE_NORMAL - ownerdraw CG_SNAPSHOT - } +#define COMMON_HUD_R 0.0 +#define COMMON_HUD_G 0.8 +#define COMMON_HUD_B 1.0 +#include "ui/tremulous_common_hud.h" ////////////////// //STATIC OBJECTS// @@ -168,72 +26,72 @@ { name "left-circle" rect 35 417.5 25 25 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.25 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.25 style WINDOW_STYLE_SHADER background "ui/assets/neutral/circle.tga" - } + } //LEFT ARM itemDef { name "left-arm" rect 68.25 420 94.5 35 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.25 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.25 style WINDOW_STYLE_SHADER background "ui/assets/human/left-arm.tga" - } + } //CREDITS LABEL itemDef { name "credits-label" rect 508 403 7 7.5 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 style WINDOW_STYLE_SHADER background "ui/assets/human/credits.tga" - } + } //RIGHT CIRCLE itemDef { name "right-circle" rect 580 417.5 25 25 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.25 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.25 style WINDOW_STYLE_SHADER background "ui/assets/neutral/circle.tga" - } + } //RIGHT ARM itemDef { name "right-arm" rect 477.25 420 94.5 35 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.25 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.25 style WINDOW_STYLE_SHADER background "ui/assets/human/right-arm.tga" - } + } //RIGHT CAP itemDef { name "right-cap" rect 500 400 80 15 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.25 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.25 style WINDOW_STYLE_SHADER background "ui/assets/human/right-cap.tga" - } + } /////////////////// //DYNAMIC OBJECTS// @@ -244,82 +102,82 @@ { name "bolt" rect 40 420 15 20 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 background "ui/assets/human/bolt.tga" ownerdraw CG_PLAYER_STAMINA_BOLT - } + } //CROSS itemDef { name "cross" rect 137.5 430 15 15 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 background "ui/assets/neutral/cross.tga" ownerdraw CG_PLAYER_HEALTH_CROSS - } + } //STAMINA 1 itemDef { name "stamina1" rect 34.5 403.5 9 11.5 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 background "ui/assets/human/stamina1.tga" ownerdraw CG_PLAYER_STAMINA_1 - } + } //STAMINA 2 itemDef { name "stamina2" rect 24 410.75 11.5 10.5 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 background "ui/assets/human/stamina2.tga" ownerdraw CG_PLAYER_STAMINA_2 - } + } //STAMINA 3 itemDef { name "stamina3" rect 20.75 423.5 10.5 7 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 background "ui/assets/human/stamina3.tga" ownerdraw CG_PLAYER_STAMINA_3 - } + } //STAMINA 4 itemDef { name "stamina4" rect 21 402.5 54 55 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 background "ui/assets/human/stamina4.tga" ownerdraw CG_PLAYER_STAMINA_4 - } + } //RING itemDef { name "ring" - // rect 20 402.5 55 55 // Guide for Stamina alignment + //rect 20 402.5 55 55 // Guide for Stamina alignment rect 565 402.5 55 55 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 background "ui/assets/human/ring.tga" ownerdraw CG_PLAYER_CLIPS_RING } @@ -329,20 +187,20 @@ { name "credits" rect 515 402 45 11.25 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 ownerdraw CG_PLAYER_CREDITS_VALUE - } + } //HEALTH itemDef { name "health" rect 67 430 60 15 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 .5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B .5 ownerdraw CG_PLAYER_HEALTH } @@ -351,21 +209,21 @@ { name "weapon" rect 482.5 425 25 25 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 ownerdraw CG_PLAYER_WEAPONICON - } + } - //WEAPON SELECT TEXT - itemDef - { - name "selecttext" + //WEAPON SELECT TEXT + itemDef + { + name "selecttext" rect 200 300 240 25 - visible 1 - decoration - textScale .5 - ownerdraw CG_PLAYER_SELECTTEXT + visible MENU_TRUE + decoration + textScale .5 + ownerdraw CG_PLAYER_SELECTTEXT } //AMMO @@ -373,9 +231,9 @@ { name "ammo" rect 494 430 60 15 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 .5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B .5 ownerdraw CG_PLAYER_AMMO_VALUE } @@ -384,9 +242,9 @@ { name "clips" rect 538 423 60 15 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 .5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B .5 ownerdraw CG_PLAYER_CLIPS_VALUE } @@ -395,20 +253,20 @@ { name "buildtimer" rect 580 417.5 25 25 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 .5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B .5 ownerdraw CG_PLAYER_BUILD_TIMER } //USABLE - itemDef - { + itemDef + { name "usable" rect 307.5 380 25 25 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 .5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B .5 background "ui/assets/neutral/use.tga" ownerdraw CG_PLAYER_USABLE_BUILDABLE } @@ -418,9 +276,9 @@ { name "scanner" rect 164 340 312 72 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 .5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B .5 background "ui/assets/human/scanner.tga" ownerdraw CG_PLAYER_HUMAN_SCANNER } @@ -430,9 +288,9 @@ { name "inventory" rect 232.5 425 175 25 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.5 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.5 ownerdraw CG_PLAYER_SELECT } @@ -441,22 +299,11 @@ { name "selected" rect 306 424 27 27 - visible 1 + visible MENU_TRUE decoration - forecolor 0.0 0.8 1.0 0.25 + forecolor COMMON_HUD_R COMMON_HUD_G COMMON_HUD_B 0.25 style WINDOW_STYLE_SHADER background "ui/assets/neutral/selected.tga" - } - - //PLAYER NAME - itemDef - { - name "playername" - rect 200 275 240 25 - visible 1 - decoration - textScale .5 - ownerdraw CG_PLAYER_CROSSHAIRNAMES } } } diff --git a/ui/tremulous_humanarmoury.menu b/ui/tremulous_humanarmoury.menu index 74514fa2..60bc70b1 100644 --- a/ui/tremulous_humanarmoury.menu +++ b/ui/tremulous_humanarmoury.menu @@ -1,15 +1,38 @@ #include "ui/menudef.h" { + +#define W 550 +#define H 250 +#define BORDER 10 +#define LIST_W 140 +#define LIST_H (H-(2*BORDER)) +#define LIST_LX BORDER +#define LIST_LY BORDER +#define LIST_RX (W-(BORDER+LIST_W)) +#define LIST_RY BORDER + +#define BUTT_H 25 +#define BUTT_Y (H-(BORDER+BUTT_H)) + +#define INFO_W (W-((4*BORDER)+(2*LIST_W))) +#define INFO_H (H-((3*BORDER)+BUTT_H)) +#define INFO_X ((2*BORDER)+LIST_W) +#define INFO_Y BORDER +#define INFO_TOFF 6 + +#define BUTT_X INFO_X +#define BUTT_W (INFO_W/3) + menuDef { name "tremulous_humanarmoury" - visible 0 - fullscreen 0 + visible MENU_FALSE + fullscreen MENU_FALSE outOfBoundsClick - rect 44 111 544 247 + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 + style WINDOW_STYLE_FILLED popup onOpen { @@ -21,21 +44,21 @@ itemDef { name window - rect 0 0 544 247 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL borderSize 1.0 borderColor 0.5 0.5 0.5 1 } - + itemDef { name "buylist" - rect 8 8 136 231 + rect LIST_LX LIST_LY LIST_W LIST_H type ITEM_TYPE_LISTBOX style WINDOW_STYLE_EMPTY elementwidth 120 @@ -43,23 +66,23 @@ textscale .33 elementtype LISTBOX_TEXT feeder FEEDER_TREMHUMANARMOURYBUY - border 1 + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE doubleclick { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript BuyFromArmoury } } - + itemDef { name "selllist" - rect 400 8 136 231 + rect LIST_RX LIST_RY LIST_W LIST_H type ITEM_TYPE_LISTBOX style WINDOW_STYLE_EMPTY elementwidth 120 @@ -67,98 +90,97 @@ textscale .33 elementtype LISTBOX_TEXT feeder FEEDER_TREMHUMANARMOURYSELL - border 1 + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE doubleclick { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript SellToArmoury } } - + itemDef { name infopane ownerdraw UI_HBUYINFOPANE textstyle ITEM_TEXTSTYLE_NORMAL style WINDOW_STYLE_EMPTY - rect 152 8 240 204 + rect INFO_X INFO_Y INFO_W INFO_H textscale .33 - textalignx 6 - textaligny 12 - border 1 + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_TOP + textalignx INFO_TOFF + textaligny INFO_TOFF + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE decoration } - + itemDef { - name "Close" - text "Close" + name "Sell" + text "< Sell" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 254 218 50 21 + rect BUTT_X BUTT_Y BUTT_W BUTT_H textalign ITEM_ALIGN_LEFT - textalignx 3 - textaligny 18 + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu4.wav"; - close tremulous_humanarmoury + play "sound/misc/menu1.wav"; + uiScript SellToArmoury } } - + itemDef { - name "Buy" - text "Buy >" + name "Close" + text "Close" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 152 218 50 21 - textalign ITEM_ALIGN_LEFT - textalignx 12.5 - textaligny 18 + rect (BUTT_X+BUTT_W) BUTT_Y BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; - uiScript BuyFromArmoury + play "sound/misc/menu4.wav"; + close tremulous_humanarmoury } } - + itemDef { - name "Sell" - text "< Sell" + name "Buy" + text "Buy >" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 344 218 50 21 - textalign ITEM_ALIGN_LEFT - textalignx 3.8 - textaligny 18 + rect (BUTT_X+(2*BUTT_W)) BUTT_Y BUTT_W BUTT_H + textalign ITEM_ALIGN_RIGHT + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; - uiScript SellToArmoury + play "sound/misc/menu1.wav"; + uiScript BuyFromArmoury } } } diff --git a/ui/tremulous_humanbuild.menu b/ui/tremulous_humanbuild.menu index a44b84bf..a2f84c85 100644 --- a/ui/tremulous_humanbuild.menu +++ b/ui/tremulous_humanbuild.menu @@ -1,36 +1,55 @@ #include "ui/menudef.h" { + +#define W 450 +#define H 250 +#define BORDER 10 + +#define LIST_W 140 +#define LIST_H (H-(2*BORDER)) +#define LIST_X BORDER +#define LIST_Y BORDER + +#define BUTT_H 25 +#define BUTT_W 45 + +#define INFO_W (W-((3*BORDER)+LIST_W)) +#define INFO_H (H-((3*BORDER)+BUTT_H)) +#define INFO_X ((2*BORDER)+LIST_W) +#define INFO_Y BORDER +#define INFO_TOFF 6 + menuDef { name "tremulous_humanbuild" - visible 0 - fullscreen 0 + visible MENU_FALSE + fullscreen MENU_FALSE outOfBoundsClick - rect 112 111 400 247 + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 + style WINDOW_STYLE_FILLED popup onOpen { uiScript LoadHumanBuilds; setFocus list } itemDef { name window - rect 0 0 400 247 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL borderSize 1.0 borderColor 0.5 0.5 0.5 1 } - + itemDef { name "list" - rect 8 8 136 231 + rect LIST_X LIST_Y LIST_W LIST_H type ITEM_TYPE_LISTBOX style WINDOW_STYLE_EMPTY elementwidth 120 @@ -38,77 +57,77 @@ textscale .33 elementtype LISTBOX_TEXT feeder FEEDER_TREMHUMANBUILD - border 1 + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE doubleclick { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript BuildHumanBuildable; close tremulous_humanbuild } } - + itemDef { name infopane ownerdraw UI_HBUILDINFOPANE textstyle ITEM_TEXTSTYLE_NORMAL style WINDOW_STYLE_EMPTY - rect 152 8 240 204 + rect INFO_X INFO_Y INFO_W INFO_H textscale .33 - textalignx 6 - textaligny 12 - border 1 + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_TOP + textalignx INFO_TOFF + textaligny INFO_TOFF + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 - visible 1 + visible MENU_TRUE decoration } - + itemDef { name "OKCancel" text "OK" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 305 218 34 21 - textalign ITEM_ALIGN_LEFT - textalignx 12.5 - textaligny 18 + rect (W-((2*BORDER)+(2*BUTT_W))) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript BuildHumanBuildable; close tremulous_humanbuild } } - + itemDef { name "OKCancel" text "Cancel" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 344 218 50 21 - textalign ITEM_ALIGN_LEFT - textalignx 3.8 - textaligny 18 + rect (W-(BORDER+BUTT_W)) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu3.wav"; + play "sound/misc/menu3.wav"; close tremulous_humanbuild } } diff --git a/ui/tremulous_humandialogs.menu b/ui/tremulous_humandialogs.menu index ee77c21a..8db2f027 100644 --- a/ui/tremulous_humandialogs.menu +++ b/ui/tremulous_humandialogs.menu @@ -1,13 +1,27 @@ #include "ui/menudef.h" { + +#define W 280 +#define H 190 +#define BORDER 10 + +#define BUTT_H 25 +#define BUTT_W 45 + +#define INFO_W (W-(2*BORDER)) +#define INFO_H (H-((4*BORDER)+(2*BUTT_H))) +#define INFO_X BORDER +#define INFO_Y ((2*BORDER)+BUTT_H) +#define INFO_TOFF 6 + menuDef { name "tremulous_human_dialog" - visible 0 - fullscreen 0 + visible MENU_FALSE + fullscreen MENU_FALSE outOfBoundsClick - rect 185 140 280 190 + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 style WINDOW_STYLE_EMPTY popup @@ -15,17 +29,17 @@ itemDef { name window - rect 0 0 280 190 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL borderSize 1.0 borderColor 0.5 0.5 0.5 1 } - + itemDef { name human_dialog @@ -33,51 +47,49 @@ type ITEM_TYPE_TEXT textstyle ITEM_TEXTSTYLE_NORMAL style WINDOW_STYLE_EMPTY - rect 115 10 50 20 - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 18 + rect BORDER BORDER INFO_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE decoration } - + itemDef { name human_dialog textstyle ITEM_TEXTSTYLE_NORMAL style WINDOW_STYLE_EMPTY - rect 10 50 250 80 + rect INFO_X INFO_Y INFO_W INFO_H cvar "ui_dialog" - autowrapped - textalignx 5 - textaligny 18 + wrapped + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .33 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE decoration } - + itemDef { name human_dialog text "OK" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 242 150 28 20 - textalign ITEM_ALIGN_LEFT - textalignx 5 - textaligny 18 + rect (W-(BORDER+BUTT_W)) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; close tremulous_human_dialog } } diff --git a/ui/tremulous_humanitem.menu b/ui/tremulous_humanitem.menu index b8374ea9..bc2204f6 100644 --- a/ui/tremulous_humanitem.menu +++ b/ui/tremulous_humanitem.menu @@ -1,36 +1,55 @@ #include "ui/menudef.h" { + +#define W 450 +#define H 250 +#define BORDER 10 + +#define LIST_W 140 +#define LIST_H (H-(2*BORDER)) +#define LIST_X BORDER +#define LIST_Y BORDER + +#define BUTT_H 25 +#define BUTT_W 45 + +#define INFO_W (W-((3*BORDER)+LIST_W)) +#define INFO_H (H-((3*BORDER)+BUTT_H)) +#define INFO_X ((2*BORDER)+LIST_W) +#define INFO_Y BORDER +#define INFO_TOFF 6 + menuDef { name "tremulous_humanitem" - visible 0 - fullscreen 0 + visible MENU_FALSE + fullscreen MENU_FALSE outOfBoundsClick - rect 112 111 400 247 + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 + style WINDOW_STYLE_FILLED popup onOpen { uiScript LoadHumanItems; setFocus list } itemDef { name window - rect 0 0 400 247 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL borderSize 1.0 borderColor 0.5 0.5 0.5 1 } - + itemDef { name "list" - rect 8 8 136 231 + rect LIST_X LIST_Y LIST_W LIST_H type ITEM_TYPE_LISTBOX style WINDOW_STYLE_EMPTY elementwidth 120 @@ -38,100 +57,99 @@ textscale .33 elementtype LISTBOX_TEXT feeder FEEDER_TREMHUMANITEMS - border 1 + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE doubleclick { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript SpawnWithHumanItem; close tremulous_humanitem } } - + itemDef { name infopane ownerdraw UI_HITEMINFOPANE textstyle ITEM_TEXTSTYLE_NORMAL style WINDOW_STYLE_EMPTY - rect 152 8 240 204 + rect INFO_X INFO_Y INFO_W INFO_H textscale .33 - textalignx 6 - textaligny 12 - border 1 + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_TOP + textalignx INFO_TOFF + textaligny INFO_TOFF + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE decoration } - + itemDef { name "Back" text "< Back" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 152 218 50 21 - textalign ITEM_ALIGN_LEFT - textalignx 3 - textaligny 18 + rect ((2*BORDER)+LIST_W) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu4.wav"; + play "sound/misc/menu4.wav"; close tremulous_humanitem; open tremulous_teamselect } } - + itemDef { name "OKCancel" text "OK" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 305 218 34 21 - textalign ITEM_ALIGN_LEFT - textalignx 12.5 - textaligny 18 + rect (W-((2*BORDER)+(2*BUTT_W))) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript SpawnWithHumanItem; close tremulous_humanitem } } - + itemDef { name "OKCancel" text "Cancel" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 344 218 50 21 - textalign ITEM_ALIGN_LEFT - textalignx 3.8 - textaligny 18 + rect (W-(BORDER+BUTT_W)) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu3.wav"; + play "sound/misc/menu3.wav"; close tremulous_humanitem } } diff --git a/ui/tremulous_teamselect.menu b/ui/tremulous_teamselect.menu index 72c1dffc..7d638784 100644 --- a/ui/tremulous_teamselect.menu +++ b/ui/tremulous_teamselect.menu @@ -1,36 +1,55 @@ #include "ui/menudef.h" { + +#define W 450 +#define H 250 +#define BORDER 10 + +#define LIST_W 140 +#define LIST_H (H-(2*BORDER)) +#define LIST_X BORDER +#define LIST_Y BORDER + +#define BUTT_H 25 +#define BUTT_W 45 + +#define INFO_W (W-((3*BORDER)+LIST_W)) +#define INFO_H (H-((3*BORDER)+BUTT_H)) +#define INFO_X ((2*BORDER)+LIST_W) +#define INFO_Y BORDER +#define INFO_TOFF 6 + menuDef { name "tremulous_teamselect" - visible 0 - fullscreen 0 + visible MENU_FALSE + fullscreen MENU_FALSE outOfBoundsClick - rect 112 111 400 247 + rect (320-(W/2)) (240-(H/2)) W H focusColor 1 .75 0 1 - style 1 + style WINDOW_STYLE_FILLED popup onOpen { uiScript LoadTeams; setFocus list } itemDef { name window - rect 0 0 400 247 + rect 0 0 W H style WINDOW_STYLE_FILLED backcolor 0 0 0 1 - visible 1 + visible MENU_TRUE decoration border WINDOW_BORDER_FULL borderSize 1.0 borderColor 0.5 0.5 0.5 1 } - + itemDef { name "list" - rect 8 8 136 231 + rect LIST_X LIST_Y LIST_W LIST_H type ITEM_TYPE_LISTBOX style WINDOW_STYLE_EMPTY elementwidth 120 @@ -38,78 +57,78 @@ textscale .33 elementtype LISTBOX_TEXT feeder FEEDER_TREMTEAMS - border 1 + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE doubleclick { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript JoinTeam; close tremulous_teamselect } } - + itemDef { name infopane ownerdraw UI_TEAMINFOPANE textstyle ITEM_TEXTSTYLE_NORMAL style WINDOW_STYLE_EMPTY - rect 152 8 240 204 + rect INFO_X INFO_Y INFO_W INFO_H textscale .33 - textalignx 6 - textaligny 12 - border 1 + textalign ITEM_ALIGN_LEFT + textvalign ITEM_VALIGN_TOP + textalignx INFO_TOFF + textaligny INFO_TOFF + border WINDOW_BORDER_FULL bordercolor 0.5 0.5 0.5 0.5 forecolor 1 1 1 1 backcolor 0.2 0.2 0.2 1 outlinecolor 0.1 0.1 0.1 0.5 - visible 1 + visible MENU_TRUE decoration } - + itemDef { name "OKCancel" text "OK" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 305 218 34 21 - textalign ITEM_ALIGN_LEFT - textalignx 12.5 - textaligny 18 + rect (W-((2*BORDER)+(2*BUTT_W))) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu1.wav"; + play "sound/misc/menu1.wav"; uiScript JoinTeam; close tremulous_teamselect } } - + itemDef { name "OKCancel" text "Cancel" type ITEM_TYPE_BUTTON style WINDOW_STYLE_EMPTY - rect 344 218 50 21 - textalign ITEM_ALIGN_LEFT - textalignx 3.8 - textaligny 18 + rect (W-(BORDER+BUTT_W)) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H + textalign ITEM_ALIGN_CENTER + textvalign ITEM_VALIGN_CENTER textscale .4 forecolor 1 1 1 1 backcolor .5 0 0 .25 - visible 1 + visible MENU_TRUE action { - play "sound/misc/menu3.wav"; + play "sound/misc/menu3.wav"; close tremulous_teamselect } } |