diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index a62b78f6a..10e8aeecd 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -69,10 +69,15 @@ static FORCE_INLINE void WithSDL2_StopTextInput() #endif } -static int32_t mgametext_xbetween = -(1<<16); +static void mgametext(int32_t x, int32_t y, char const * t) +{ + G_ScreenText(MF_Bluefont.tilenum, x, y, MF_Bluefont.zoom, 0, 0, t, 0, MF_Bluefont.pal, 2|8|16|ROTATESPRITE_FULL16, 0, MF_Bluefont.emptychar.x, MF_Bluefont.emptychar.y, MF_Bluefont.between.x, MF_Bluefont.between.y, MF_Bluefont.textflags, 0, 0, xdim-1, ydim-1); +} +static vec2_t mgametextcenter(int32_t x, int32_t y, char const * t, int32_t f = 0) +{ + return G_ScreenText(MF_Bluefont.tilenum, (MENU_MARGIN_CENTER<<16) + x, y, MF_Bluefont.zoom, 0, 0, t, 0, MF_Bluefont.pal, 2|8|16|ROTATESPRITE_FULL16, 0, MF_Bluefont.emptychar.x, MF_Bluefont.emptychar.y, MF_Bluefont.between.x, MF_Bluefont.between.y, MF_Bluefont.textflags|f|TEXT_XCENTER, 0, 0, xdim-1, ydim-1); +} -#define mgametext(x,y,t) G_ScreenText(STARTALPHANUM, x, y, 65536, 0, 0, t, 0, 0, 2|8|16|ROTATESPRITE_FULL16, 0, 5<<16, 8<<16, mgametext_xbetween, 0, 0, 0, 0, xdim-1, ydim-1) -#define mgametextcenter(x,y,t) G_ScreenText(STARTALPHANUM, (MENU_MARGIN_CENTER<<16) + (x), y, 65536, 0, 0, t, 0, 0, 2|8|16|ROTATESPRITE_FULL16, 0, 5<<16, 8<<16, mgametext_xbetween, 1<<16, TEXT_XCENTER, 0, 0, xdim-1, ydim-1) #define mminitext(x,y,t,p) minitext_(x, y, t, 0, p, 2|8|16|ROTATESPRITE_FULL16) #define mmenutext menutext #define mmenutextcenter(x,y,t) menutext_((MENU_MARGIN_CENTER<<16) + (x), (y), 0, (t), 10|16, TEXT_XCENTER) @@ -149,8 +154,9 @@ they effectively stand in for curly braces as struct initializers. // common font types // tilenums are set after namesdyn runs MenuFont_t MF_Redfont = { { 5<<16, 15<<16 }, { 0, 0 }, 65536, 20<<16, 110<<16, 65536, TEXT_BIGALPHANUM | TEXT_UPPERCASE, -1, 10, 0, 1 }; -static MenuFont_t MF_Bluefont = { { 5<<16, 7<<16 }, { -(1<<16), 0 }, 65536, 10<<16, 110<<16, 32768, 0, -1, 10, 0, 16 }; -static MenuFont_t MF_BluefontRed = { { 5<<16, 7<<16 }, { -(1<<16), 0 }, 65536, 10<<16, 110<<16, 32768, 0, -1, 10, 10, 16 }; +MenuFont_t MF_Bluefont = { { 5<<16, 7<<16 }, { -(1<<16), 1<<16 }, 65536, 10<<16, 110<<16, 32768, 0, -1, 10, 0, 16 }; +MenuFont_t MF_BluefontRed = { { 5<<16, 7<<16 }, { -(1<<16), 1<<16 }, 65536, 10<<16, 110<<16, 32768, 0, -1, 10, 10, 16 }; +MenuFont_t MF_BluefontGame = { { 5<<16, 7<<16 }, { 0, 0 }, 65536, 10<<16, 110<<16, 32768, 0, -1, 10, 0, 16 }; static MenuFont_t MF_Minifont = { { 4<<16, 5<<16 }, { 1<<16, 1<<16 }, 65536, 10<<16, 110<<16, 32768, 0, -1, 10, 0, 16 }; static MenuFont_t MF_MinifontRed = { { 4<<16, 5<<16 }, { 1<<16, 1<<16 }, 65536, 10<<16, 110<<16, 32768, 0, -1, 16, 21, 16 }; static MenuFont_t MF_MinifontDarkGray = { { 4<<16, 5<<16 }, { 1<<16, 1<<16 }, 65536, 10<<16, 110<<16, 32768, 0, -1, 10, 13, 16 }; @@ -1400,9 +1406,9 @@ void Menu_Init(void) // prepare menu fonts MF_Redfont.tilenum = BIGALPHANUM; - MF_Bluefont.tilenum = MF_BluefontRed.tilenum = STARTALPHANUM; + MF_Bluefont.tilenum = MF_BluefontRed.tilenum = MF_BluefontGame.tilenum = STARTALPHANUM; if (NAM_WW2GI) - mgametext_xbetween = MF_Bluefont.between.x = MF_BluefontRed.between.x = 0; + MF_Bluefont.between.x = MF_BluefontRed.between.x = 0; MF_Minifont.tilenum = MF_MinifontRed.tilenum = MF_MinifontDarkGray.tilenum = MINIFONT; if (!minitext_lowercase) { @@ -4822,7 +4828,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin) Menu_BlackRectangle(origin.x + (60<<16), origin.y + (86<<16), 200<<16, 28<<16, 0); - G_ScreenText(STARTALPHANUM, origin.x + (160<<16), origin.y + (98<<16), 65536, 0, 0, object->instructions, 0, 0, 2|8|16|ROTATESPRITE_FULL16, 0, 5<<16, 8<<16, mgametext_xbetween, 1<<16, TEXT_XCENTER|TEXT_YBOTTOM, 0, 0, xdim-1, ydim-1); + mgametextcenter(origin.x, origin.y + (98<<16), object->instructions, TEXT_YBOTTOM); const char *displaytext = object->input; @@ -4836,7 +4842,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin) displaytext = tempbuf; } - const vec2_t textreturn = G_ScreenText(STARTALPHANUM, origin.x + (160<<16), origin.y + (102<<16), 65536, 0, 0, displaytext, 0, 0, 2|8|16|ROTATESPRITE_FULL16, 0, 5<<16, 8<<16, mgametext_xbetween, 1<<16, TEXT_XCENTER, 0, 0, xdim-1, ydim-1); + const vec2_t textreturn = mgametextcenter(origin.x, origin.y + (102<<16), displaytext); Menu_PreDraw(cm->menuID, NULL, origin); diff --git a/source/duke3d/src/menus.h b/source/duke3d/src/menus.h index 05ca53650..91ef4ba32 100644 --- a/source/duke3d/src/menus.h +++ b/source/duke3d/src/menus.h @@ -456,6 +456,7 @@ void Menu_Close(size_t playerID); void M_DisplayMenus(void); extern MenuFont_t MF_Redfont; +extern MenuFont_t MF_Bluefont, MF_BluefontRed, MF_BluefontGame; #define M_MOUSETIMEOUT 210 extern int32_t m_mouselastactivity; diff --git a/source/duke3d/src/net.cpp b/source/duke3d/src/net.cpp index 922f6efcc..d6eeb2ad5 100644 --- a/source/duke3d/src/net.cpp +++ b/source/duke3d/src/net.cpp @@ -1829,7 +1829,7 @@ void Net_SendMessage(void) i = textsc(5<<16); { - const vec2_t dim = G_ScreenTextSize(STARTALPHANUM, i, 0, textsc(65536), 0, typebuf, 8|16|ROTATESPRITE_FULL16, 5<<16, 7<<16, 0, 0, TEXT_LITERALESCAPE, 0, 0, xdim-1, ydim-1); + const vec2_t dim = G_ScreenTextSize(MF_BluefontGame.tilenum, i, 0, textsc(MF_BluefontGame.zoom), 0, typebuf, 8|16|ROTATESPRITE_FULL16, MF_BluefontGame.emptychar.x, MF_BluefontGame.emptychar.y, MF_BluefontGame.between.x, MF_BluefontGame.between.y, MF_BluefontGame.textflags|TEXT_LITERALESCAPE, 0, 0, xdim-1, ydim-1); l = i + dim.x + scale(textsc((tilesiz[SPINNINGNUKEICON].x+2)<<13), ydim, 200); } @@ -1838,7 +1838,7 @@ void Net_SendMessage(void) i -= (l - (xdim<<16)); { - const vec2_t dim = G_ScreenText(STARTALPHANUM, i, j, textsc(65536), 0, 0, typebuf, 1, 0, 8|16|ROTATESPRITE_FULL16, 0, 5<<16, 7<<16, 0, 0, TEXT_YCENTER|TEXT_LITERALESCAPE, 0, 0, xdim-1, ydim-1); + const vec2_t dim = G_ScreenText(MF_BluefontGame.tilenum, i, j, textsc(MF_BluefontGame.zoom), 0, 0, typebuf, 1, MF_BluefontGame.pal, 8|16|ROTATESPRITE_FULL16, 0, MF_BluefontGame.emptychar.x, MF_BluefontGame.emptychar.y, MF_BluefontGame.between.x, MF_BluefontGame.between.y, MF_BluefontGame.textflags|TEXT_YCENTER|TEXT_LITERALESCAPE, 0, 0, xdim-1, ydim-1); i += dim.x + scale(textsc((tilesiz[SPINNINGNUKEICON].x+1)<<12), ydim, 200); } diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index e04374012..6b8f46edc 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -1202,7 +1202,7 @@ void G_DisplayRest(int32_t smoothratio) (myps->player_par/REALGAMETICSPERSEC)%60, ((myps->player_par%REALGAMETICSPERSEC)*33)/10 ); - G_ScreenText(STARTALPHANUM, 2<<16, i-gtextsc(21<<16), gtextsc(65536), 0, 0, tempbuf, 0, 10, 2|8|16|256|ROTATESPRITE_FULL16, 0, 5<<16, 8<<16, 8<<16, 0, TEXT_XOFFSETZERO|TEXT_GAMETEXTNUMHACK, 0, 0, xdim-1, ydim-1); + G_ScreenText(MF_BluefontGame.tilenum, 2<<16, i-gtextsc(21<<16), gtextsc(MF_BluefontGame.zoom), 0, 0, tempbuf, 0, 10, 2|8|16|256|ROTATESPRITE_FULL16, 0, MF_BluefontGame.emptychar.x, MF_BluefontGame.emptychar.y, 8<<16, MF_BluefontGame.between.y, MF_BluefontGame.textflags|TEXT_XOFFSETZERO|TEXT_GAMETEXTNUMHACK, 0, 0, xdim-1, ydim-1); if (ud.player_skill > 3 || ((g_netServer || ud.multimode > 1) && !GTFLAGS(GAMETYPE_PLAYERSFRIENDLY))) Bsprintf(tempbuf, "K:^15%d", (ud.multimode>1 &&!GTFLAGS(GAMETYPE_PLAYERSFRIENDLY)) ? @@ -1218,12 +1218,12 @@ void G_DisplayRest(int32_t smoothratio) myps->max_actors_killed>myps->actors_killed ? myps->max_actors_killed : myps->actors_killed); } - G_ScreenText(STARTALPHANUM, 2<<16, i-gtextsc(14<<16), gtextsc(65536), 0, 0, tempbuf, 0, 10, 2|8|16|256|ROTATESPRITE_FULL16, 0, 5<<16, 8<<16, 8<<16, 0, TEXT_XOFFSETZERO|TEXT_GAMETEXTNUMHACK, 0, 0, xdim-1, ydim-1); + G_ScreenText(MF_BluefontGame.tilenum, 2<<16, i-gtextsc(14<<16), gtextsc(MF_BluefontGame.zoom), 0, 0, tempbuf, 0, 10, 2|8|16|256|ROTATESPRITE_FULL16, 0, MF_BluefontGame.emptychar.x, MF_BluefontGame.emptychar.y, 8<<16, MF_BluefontGame.between.y, MF_BluefontGame.textflags|TEXT_XOFFSETZERO|TEXT_GAMETEXTNUMHACK, 0, 0, xdim-1, ydim-1); if (myps->secret_rooms == myps->max_secret_rooms) Bsprintf(tempbuf, "S:%d/%d", myps->secret_rooms, myps->max_secret_rooms); else Bsprintf(tempbuf, "S:^15%d/%d", myps->secret_rooms, myps->max_secret_rooms); - G_ScreenText(STARTALPHANUM, 2<<16, i-gtextsc(7<<16), gtextsc(65536), 0, 0, tempbuf, 0, 10, 2|8|16|256|ROTATESPRITE_FULL16, 0, 5<<16, 8<<16, 8<<16, 0, TEXT_XOFFSETZERO|TEXT_GAMETEXTNUMHACK, 0, 0, xdim-1, ydim-1); + G_ScreenText(MF_BluefontGame.tilenum, 2<<16, i-gtextsc(7<<16), gtextsc(MF_BluefontGame.zoom), 0, 0, tempbuf, 0, 10, 2|8|16|256|ROTATESPRITE_FULL16, 0, MF_BluefontGame.emptychar.x, MF_BluefontGame.emptychar.y, 8<<16, MF_BluefontGame.between.y, MF_BluefontGame.textflags|TEXT_XOFFSETZERO|TEXT_GAMETEXTNUMHACK, 0, 0, xdim-1, ydim-1); } if (g_player[myconnectindex].gotvote == 0 && voting != -1 && voting != myconnectindex) diff --git a/source/duke3d/src/screentext.cpp b/source/duke3d/src/screentext.cpp index 326b24423..d0c8ed83a 100644 --- a/source/duke3d/src/screentext.cpp +++ b/source/duke3d/src/screentext.cpp @@ -919,16 +919,16 @@ void G_PrintGameText(int32_t tile, int32_t x, int32_t y, const char *t, if (x == (160<<16)) f |= TEXT_XCENTER; - G_ScreenText(tile, x, y, z, 0, 0, t, s, p, 2|o|ROTATESPRITE_FULL16, a, 5<<16, 8<<16, 0, 0, f, x1, y1, x2, y2); + G_ScreenText(tile, x, y, z, 0, 0, t, s, p, 2|o|ROTATESPRITE_FULL16, a, MF_BluefontGame.emptychar.x, MF_BluefontGame.emptychar.y, MF_BluefontGame.between.x, MF_BluefontGame.between.y, MF_BluefontGame.textflags|f, x1, y1, x2, y2); } void gametext_(int32_t x, int32_t y, int32_t z, const char *t, int32_t s, int32_t p, int32_t o, int32_t a, int32_t f) { - G_ScreenText(STARTALPHANUM, x, y, z, 0, 0, t, s, p, o|2|8|16|ROTATESPRITE_FULL16, a, 5<<16, 8<<16, 0, 0, f, 0, 0, xdim-1, ydim-1); + G_ScreenText(MF_BluefontGame.tilenum, x, y, z, 0, 0, t, s, p, o|2|8|16|ROTATESPRITE_FULL16, a, MF_BluefontGame.emptychar.x, MF_BluefontGame.emptychar.y, MF_BluefontGame.between.x, MF_BluefontGame.between.y, MF_BluefontGame.textflags|f, 0, 0, xdim-1, ydim-1); } void gametext_simple(int32_t x, int32_t y, const char *t) { - G_ScreenText(STARTALPHANUM, x, y, 65536, 0, 0, t, 0, 0, 2|8|16|ROTATESPRITE_FULL16, 0, 5<<16, 8<<16, 0, 0, 0, 0, 0, xdim-1, ydim-1); + G_ScreenText(MF_BluefontGame.tilenum, x, y, MF_BluefontGame.zoom, 0, 0, t, 0, MF_BluefontGame.pal, 2|8|16|ROTATESPRITE_FULL16, 0, MF_BluefontGame.emptychar.x, MF_BluefontGame.emptychar.y, MF_BluefontGame.between.x, MF_BluefontGame.between.y, MF_BluefontGame.textflags, 0, 0, xdim-1, ydim-1); } int32_t G_GameTextLen(int32_t x, const char *t) @@ -938,7 +938,7 @@ int32_t G_GameTextLen(int32_t x, const char *t) if (t == NULL) return -1; - dim = G_ScreenTextSize(STARTALPHANUM, x, 0, textsc(65536L), 0, t, 2, 5, 8, 0, 0, 0, 0, 0, xdim-1, ydim-1); + dim = G_ScreenTextSize(MF_BluefontGame.tilenum, x<<16, 0, textsc(MF_BluefontGame.zoom), 0, t, 2|8|16|ROTATESPRITE_FULL16, MF_BluefontGame.emptychar.x, MF_BluefontGame.emptychar.y, MF_BluefontGame.between.x, MF_BluefontGame.between.y, MF_BluefontGame.textflags, 0, 0, xdim-1, ydim-1); x += dim.x; diff --git a/source/duke3d/src/screentext.h b/source/duke3d/src/screentext.h index 2603912b8..50a2fde7b 100644 --- a/source/duke3d/src/screentext.h +++ b/source/duke3d/src/screentext.h @@ -22,6 +22,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #pragma once +#include "menus.h" + #ifdef __cplusplus extern "C" { #endif @@ -69,15 +71,15 @@ extern int32_t textsc(int32_t sc); #define menutext(x, y, t) menutext_((x), (y), 0, (t), 10|16, 0) #define menutext_center(y, t) menutext_(160<<16, (y)<<16, 0, (t), 10|16, TEXT_XCENTER) #define gametext(x, y, t) gametext_simple((x)<<16, (y)<<16, (t)) -#define gametext_widenumber(x, y, t) gametext_((x)<<16, (y)<<16, 65536, (t), 0, 0, 1024, 0, TEXT_GAMETEXTNUMHACK) -#define gametext_number(x, y, t) gametext_((x)<<16, (y)<<16, 65536, (t), 0, 0, 0, 0, TEXT_GAMETEXTNUMHACK) -#define gametext_pal(x, y, t, p) gametext_((x)<<16, (y)<<16, 65536, (t), 0, (p), 0, 0, 0) -#define gametext_center(y, t) gametext_(160<<16, (y)<<16, 65536, (t), 0, 0, 0, 0, TEXT_XCENTER) -#define gametext_center_number(y, t) gametext_(160<<16, (y)<<16, 65536, (t), 0, 0, 0, 0, TEXT_XCENTER|TEXT_GAMETEXTNUMHACK) -#define gametext_center_shade(y, t, s) gametext_(160<<16, (y)<<16, 65536, (t), (s), 0, 0, 0, TEXT_XCENTER) -#define gametext_center_shade_pal(y, t, s, p) gametext_(160<<16, (y)<<16, 65536, (t), (s), (p), 0, 0, TEXT_XCENTER) +#define gametext_widenumber(x, y, t) gametext_((x)<<16, (y)<<16, MF_BluefontGame.zoom, (t), 0, MF_BluefontGame.pal, 1024, 0, TEXT_GAMETEXTNUMHACK) +#define gametext_number(x, y, t) gametext_((x)<<16, (y)<<16, MF_BluefontGame.zoom, (t), 0, MF_BluefontGame.pal, 0, 0, TEXT_GAMETEXTNUMHACK) +#define gametext_pal(x, y, t, p) gametext_((x)<<16, (y)<<16, MF_BluefontGame.zoom, (t), 0, (p), 0, 0, 0) +#define gametext_center(y, t) gametext_(160<<16, (y)<<16, MF_BluefontGame.zoom, (t), 0, MF_BluefontGame.pal, 0, 0, TEXT_XCENTER) +#define gametext_center_number(y, t) gametext_(160<<16, (y)<<16, MF_BluefontGame.zoom, (t), 0, MF_BluefontGame.pal, 0, 0, TEXT_XCENTER|TEXT_GAMETEXTNUMHACK) +#define gametext_center_shade(y, t, s) gametext_(160<<16, (y)<<16, MF_BluefontGame.zoom, (t), (s), MF_BluefontGame.pal, 0, 0, TEXT_XCENTER) +#define gametext_center_shade_pal(y, t, s, p) gametext_(160<<16, (y)<<16, MF_BluefontGame.zoom, (t), (s), (p), 0, 0, TEXT_XCENTER) #define gametext_center_shade_pal_alpha(y, t, s, p, a) gametext_(160<<16, (y)<<16, 65536, (t), (s), (p), 0, (a), TEXT_XCENTER) -#define mpgametext(y, t, s, o) gametext_(textsc(5<<16), (y)<<16, textsc(65536), (t), (s), 0, (o), 0, TEXT_LINEWRAP) +#define mpgametext(y, t, s, o) gametext_(textsc(5<<16), (y)<<16, textsc(MF_BluefontGame.zoom), (t), (s), MF_BluefontGame.pal, (o), 0, TEXT_LINEWRAP) extern int32_t G_GameTextLen(int32_t x, const char *t); extern void G_PrintGameText(int32_t tile, int32_t x, int32_t y, const char *t,