diff options
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/ui_main.c | 139 | ||||
| -rw-r--r-- | src/ui/ui_shared.c | 36 | ||||
| -rw-r--r-- | src/ui/ui_shared.h | 1 | 
3 files changed, 154 insertions, 22 deletions
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index 20e3a25d..d26835d8 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -406,6 +406,63 @@ void Text_Paint(float x, float y, float scale, vec4_t color, const char *text, f            trap_R_SetColor( newColor );            colorBlack[3] = 1.0;          } +        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,                             glyph->imageWidth,                            glyph->imageHeight, @@ -478,6 +535,63 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha            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,                             glyph->imageWidth,                            glyph->imageHeight, @@ -1200,12 +1314,8 @@ void UI_Load() {    String_Init(); -#ifdef PRE_RELEASE_TADEMO -  UI_ParseGameInfo("demogameinfo.txt"); -#else -  UI_ParseGameInfo("gameinfo.txt"); -  UI_LoadArenas(); -#endif +/*  UI_ParseGameInfo("gameinfo.txt"); +  UI_LoadArenas();*/    UI_LoadMenus(menuSet, qtrue);    Menus_CloseAll(); @@ -3974,12 +4084,8 @@ static void UI_RunMenuScript(char **args) {      } else if (Q_stricmp(name, "clearError") == 0) {        trap_Cvar_Set("com_errorMessage", "");      } else if (Q_stricmp(name, "loadGameInfo") == 0) { -#ifdef PRE_RELEASE_TADEMO -      UI_ParseGameInfo("demogameinfo.txt"); -#else -      UI_ParseGameInfo("gameinfo.txt"); -#endif -      UI_LoadBestScores(uiInfo.mapList[ui_currentMap.integer].mapLoadName, uiInfo.gameTypes[ui_gameType.integer].gtEnum); +/*      UI_ParseGameInfo("gameinfo.txt"); +      UI_LoadBestScores(uiInfo.mapList[ui_currentMap.integer].mapLoadName, uiInfo.gameTypes[ui_gameType.integer].gtEnum);*/      } else if (Q_stricmp(name, "resetScores") == 0) {        UI_ClearScores();      } else if (Q_stricmp(name, "RefreshServers") == 0) { @@ -5958,14 +6064,9 @@ void _UI_Init( qboolean inGameLoad ) {    uiInfo.characterCount = 0;    uiInfo.aliasCount = 0; -#ifdef PRE_RELEASE_TADEMO -  UI_ParseTeamInfo("demoteaminfo.txt"); -  UI_ParseGameInfo("demogameinfo.txt"); -#else -  UI_ParseTeamInfo("teaminfo.txt"); +/*  UI_ParseTeamInfo("teaminfo.txt");    UI_LoadTeams(); -  UI_ParseGameInfo("gameinfo.txt"); -#endif +  UI_ParseGameInfo("gameinfo.txt");*/    menuSet = UI_Cvar_VariableString("ui_menuFiles");    if (menuSet == NULL || menuSet[0] == '\0') { diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index 8f0a60f0..c6a8253a 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -3754,7 +3754,32 @@ void Item_ListBox_Paint(itemDef_t *item) {              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);              } else if (text) { -              DC->drawText(x + 4 + listPtr->columnInfo[j].pos, y + listPtr->elementHeight, item->textscale, item->window.foreColor, text, 0, listPtr->columnInfo[j].maxChars, item->textStyle); +              //TA: +              int alignOffset, tw; + +              tw = DC->textWidth( text, item->textscale, 0 ); + +              switch( listPtr->columnInfo[ j ].align ) +              { +                case ITEM_ALIGN_LEFT: +                  alignOffset = 0.0f; +                  break; + +                case ITEM_ALIGN_RIGHT: +                  alignOffset = listPtr->columnInfo[ j ].width - tw; +                  break; + +                case ITEM_ALIGN_CENTER: +                  alignOffset = ( listPtr->columnInfo[ j ].width / 2.0f ) - ( tw / 2.0f ); +                  break; + +                default: +                  alignOffset = 0.0f; +              } + +              DC->drawText( x + 4 + listPtr->columnInfo[j].pos + alignOffset, y + listPtr->elementHeight, +                            item->textscale, item->window.foreColor, text, 0, +                            listPtr->columnInfo[j].maxChars, item->textStyle );              }            }          } else { @@ -4600,12 +4625,17 @@ qboolean ItemParse_columns( itemDef_t *item, int handle ) {      }      listPtr->numColumns = num;      for (i = 0; i < num; i++) { -      int pos, width, maxChars; +      int pos, width, maxChars, align; -      if (PC_Int_Parse(handle, &pos) && PC_Int_Parse(handle, &width) && PC_Int_Parse(handle, &maxChars)) { +      if( PC_Int_Parse( handle, &pos ) && +          PC_Int_Parse( handle, &width ) && +          PC_Int_Parse( handle, &maxChars ) && +          PC_Int_Parse( handle, &align ) ) +      {          listPtr->columnInfo[i].pos = pos;          listPtr->columnInfo[i].width = width;          listPtr->columnInfo[i].maxChars = maxChars; +        listPtr->columnInfo[i].align = align;        } else {          return qfalse;        } diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h index 8d67fce1..f20af2b4 100644 --- a/src/ui/ui_shared.h +++ b/src/ui/ui_shared.h @@ -161,6 +161,7 @@ typedef struct columnInfo_s {  	int pos;  	int width;  	int maxChars; +  int align;  } columnInfo_t;  typedef struct listBoxDef_s {  | 
