From 7e362819e42df79b9fc9793a169b0d7a44ce7003 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 12 Oct 2010 08:43:15 +0000 Subject: [PATCH] - made the different cursor characters for Raven's and the other small fonts a property of the font instead deciding based on the game. SVN r2935 (trunk) --- src/ct_chat.cpp | 2 +- src/menu/loadsavemenu.cpp | 3 ++- src/menu/playermenu.cpp | 2 +- src/v_font.cpp | 14 ++++++++++++-- src/v_font.h | 3 +++ 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/ct_chat.cpp b/src/ct_chat.cpp index ecc3c4827..d05e44a67 100644 --- a/src/ct_chat.cpp +++ b/src/ct_chat.cpp @@ -252,7 +252,7 @@ void CT_Drawer (void) } // draw the prompt, text, and cursor - ChatQueue[len] = gameinfo.gametype & GAME_DoomChex ? '_' : '['; + ChatQueue[len] = SmallFont->GetCursor(); ChatQueue[len+1] = '\0'; if (con_scaletext < 2) { diff --git a/src/menu/loadsavemenu.cpp b/src/menu/loadsavemenu.cpp index 9b7b0e683..97bda8494 100644 --- a/src/menu/loadsavemenu.cpp +++ b/src/menu/loadsavemenu.cpp @@ -637,10 +637,11 @@ void DLoadSaveMenu::Drawer () listboxLeft+1, listboxTop+rowHeight*i+CleanYfac, savegamestring, DTA_CleanNoMove, true, TAG_DONE); + char curs[2] = { SmallFont->GetCursor(), 0 }; screen->DrawText (SmallFont, CR_WHITE, listboxLeft+1+SmallFont->StringWidth (savegamestring)*CleanXfac, listboxTop+rowHeight*i+CleanYfac, - (gameinfo.gametype & (GAME_DoomStrifeChex)) ? "_" : "[", + curs, DTA_CleanNoMove, true, TAG_DONE); } } diff --git a/src/menu/playermenu.cpp b/src/menu/playermenu.cpp index e41d6094d..c4ad7b86b 100644 --- a/src/menu/playermenu.cpp +++ b/src/menu/playermenu.cpp @@ -161,7 +161,7 @@ void FPlayerNameBox::Drawer(bool selected) else { size_t l = strlen(mEditName); - mEditName[l] = (gameinfo.gametype & (GAME_DoomStrifeChex)) ? '_' : '['; + mEditName[l] = SmallFont->GetCursor(); mEditName[l+1] = 0; screen->DrawText (SmallFont, CR_UNTRANSLATED, x + mFrameSize, mYpos, mEditName, diff --git a/src/v_font.cpp b/src/v_font.cpp index 3815c8ae4..9acd2d4c2 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -345,6 +345,7 @@ FFont::FFont (const char *name, const char *nametemplate, int first, int count, Name = copystring (name); Next = FirstFont; FirstFont = this; + Cursor = '_'; maxyoffs = 0; @@ -1892,6 +1893,7 @@ void V_InitCustomFonts() int start; int first; int count; + char cursor = '_'; while ((llump = Wads.FindLump ("FONTDEFS", &lastlump)) != -1) { @@ -1938,6 +1940,11 @@ void V_InitCustomFonts() count = sc.Number; format = 1; } + else if (sc.Compare ("CURSOR")) + { + sc.MustGetString(); + cursor = sc.String[0]; + } else if (sc.Compare ("NOTRANSLATION")) { if (format == 1) goto wrong; @@ -1981,7 +1988,8 @@ void V_InitCustomFonts() } if (format == 1) { - new FFont (namebuffer, templatebuf, first, count, start); + FFont *fnt = new FFont (namebuffer, templatebuf, first, count, start); + fnt->SetCursor(cursor); } else if (format == 2) { @@ -2003,7 +2011,8 @@ void V_InitCustomFonts() } if (count > 0) { - new FSpecialFont (namebuffer, first, count, &lumplist[first], notranslate); + FFont *fnt = new FSpecialFont (namebuffer, first, count, &lumplist[first], notranslate); + fnt->SetCursor(cursor); } } else goto wrong; @@ -2377,6 +2386,7 @@ void V_InitFonts() else if (Wads.CheckNumForName ("FONTA_S") >= 0) { SmallFont = new FFont ("SmallFont", "FONTA%02u", HU_FONTSTART, HU_FONTSIZE, 1); + SmallFont->SetCursor('['); } else { diff --git a/src/v_font.h b/src/v_font.h index 4cdba31af..5499c58af 100644 --- a/src/v_font.h +++ b/src/v_font.h @@ -95,6 +95,8 @@ public: inline int StringWidth (const char *str) const { return StringWidth ((const BYTE *)str); } int GetCharCode(int code, bool needpic) const; + char GetCursor() const { return Cursor; } + void SetCursor(char c) { Cursor = c; } protected: FFont (); @@ -110,6 +112,7 @@ protected: int SpaceWidth; int FontHeight; int GlobalKerning; + char Cursor; struct CharData { FTexture *Pic;