From 5144e8c355b1a0a83b2ec5ac418a2474cc2aeffe Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 3 Jul 2020 09:59:24 +0200 Subject: [PATCH] - ported the 'entering level' screen. --- source/core/screenjob.cpp | 3 + source/core/screenjob.h | 4 + source/games/duke/src/2d_d.cpp | 41 ++++- source/games/duke/src/2d_r.cpp | 44 +++++ source/games/duke/src/d_menu.cpp | 1 - source/games/duke/src/game_main.cpp | 10 ++ source/games/duke/src/menus.h | 62 ------- source/games/duke/src/zz_demo.cpp | 1 - source/games/duke/src/zz_game.cpp | 10 +- source/games/duke/src/zz_osdcmds.cpp | 1 - source/games/duke/src/zz_premap.cpp | 237 +++++++++----------------- source/games/duke/src/zz_savegame.cpp | 10 -- source/games/duke/src/zz_screens.cpp | 10 -- source/games/duke/src/zz_text.cpp | 26 ++- source/games/duke/src/zz_text.h | 8 - 15 files changed, 217 insertions(+), 251 deletions(-) delete mode 100644 source/games/duke/src/menus.h diff --git a/source/core/screenjob.cpp b/source/core/screenjob.cpp index 9d57fabb8..b0ce84dd6 100644 --- a/source/core/screenjob.cpp +++ b/source/core/screenjob.cpp @@ -112,7 +112,9 @@ void RunScreenJob(JobDesc *jobs, int count, CompletionFunc completion, bool clea float ms = (clock / 1'000'000) / job.job->fadetime; screenfade = clamp(ms, 0.f, 1.f); twod->SetScreenFade(screenfade); + job.job->fadestate = DScreenJob::fadein; } + else job.job->fadestate = DScreenJob::visible; job.job->SetClock(clock); int state = job.job->Frame(clock, skiprequest); startTime -= job.job->GetClock() - clock; @@ -125,6 +127,7 @@ void RunScreenJob(JobDesc *jobs, int count, CompletionFunc completion, bool clea { if (job.job->fadestyle & DScreenJob::fadeout) { + job.job->fadestate = DScreenJob::fadeout; startTime = now; float screenfade2; do diff --git a/source/core/screenjob.h b/source/core/screenjob.h index 680183c63..d587d73ed 100644 --- a/source/core/screenjob.h +++ b/source/core/screenjob.h @@ -11,12 +11,14 @@ class DScreenJob : public DObject int64_t now; const int fadestyle; const float fadetime; // in milliseconds + int fadestate = fadein; friend void RunScreenJob(JobDesc* jobs, int count, CompletionFunc completion, bool clearbefore); public: enum { + visible = 0, fadein = 1, fadeout = 2, }; @@ -34,6 +36,8 @@ public: } virtual int Frame(uint64_t clock, bool skiprequest) { return 0; } + int GetFadeState() const { return fadestate; } + }; //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/2d_d.cpp b/source/games/duke/src/2d_d.cpp index c3607b4d9..ab29f73a9 100644 --- a/source/games/duke/src/2d_d.cpp +++ b/source/games/duke/src/2d_d.cpp @@ -1034,6 +1034,46 @@ void e4intro(CompletionFunc completion) RunScreenJob(jobs, job, completion); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +class DDukeLoadScreen : public DScreenJob +{ + std::function callback; + +public: + DDukeLoadScreen(const char *mapname_, std::function callback_) : DScreenJob(fadein|fadeout), callback(callback_) {} + + int Frame(uint64_t clock, bool skiprequest) + { + DrawTexture(twod, tileGetTexture(LOADSCREEN), 0, 0, DTA_FullscreenEx, 3, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE); + + // fixme: The level management needs a total overhaul! + if (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0) + { + BigText(160, 90, GStrings("TXT_LOADUM")); + GameText(160, 100, boardfilename, 14, 0); + } + else + { + BigText(160, 90, GStrings("TXT_LOADING")); + BigText(160, 114, mapList[(ud.volume_number * MAXLEVELS) + ud.level_number].DisplayName()); + } + + // Initiate the level load once the page has been faded in completely. + if (callback && GetFadeState() == visible) + { + callback(); + callback = nullptr; + } + if (clock > 5'000'000'000) return 0; // make sure the screen stays long enough to be seen. + return skiprequest? -1 : 1; + } +}; + // Utility for testing the above screens CCMD(testscreen) @@ -1090,5 +1130,4 @@ CCMD(testscreen) } } - END_DUKE_NS diff --git a/source/games/duke/src/2d_r.cpp b/source/games/duke/src/2d_r.cpp index f99605903..263b006ef 100644 --- a/source/games/duke/src/2d_r.cpp +++ b/source/games/duke/src/2d_r.cpp @@ -601,6 +601,49 @@ void dobonus_r(bool bonusonly, CompletionFunc completion) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +class DRRLoadScreen : public DScreenJob +{ + std::function callback; + +public: + DRRLoadScreen(const char *mapname_, std::function callback_) : DScreenJob(fadein|fadeout), callback(callback_) {} + + int Frame(uint64_t clock, bool skiprequest) + { + DrawTexture(twod, tileGetTexture(LOADSCREEN), 0, 0, DTA_FullscreenEx, 3, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE); + + int y = isRRRA()? 140 : 90; + // fixme: The level management needs a total overhaul! + if (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0) + { + BigText(160, y, GStrings("TXT_ENTRUM"), 0); + BigText(160, y+20, boardfilename, 0); + } + else + { + BigText(160, y, GStrings("TXT_ENTERIN"), 0); + // Fixme: This last level hack needs to go away!!! + BigText(160, y+24, mapList[g_lastLevel? 127 : (ud.volume_number * MAXLEVELS) + ud.level_number].DisplayName(), 0); + } + + // Initiate the level load once the page has been faded in completely. + if (callback && GetFadeState() == visible) + { + callback(); + callback = nullptr; + } + if (clock > 5'000'000'000) return 0; // make sure the screen stays long enough to be seen. + return skiprequest? -1 : 1; + } +}; + + // Utility for testing the above screens CCMD(testrscreen) { @@ -644,4 +687,5 @@ CCMD(testrscreen) } } + END_DUKE_NS diff --git a/source/games/duke/src/d_menu.cpp b/source/games/duke/src/d_menu.cpp index 2d6d691a8..430866385 100644 --- a/source/games/duke/src/d_menu.cpp +++ b/source/games/duke/src/d_menu.cpp @@ -30,7 +30,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "duke3d.h" -#include "menus.h" #include "osdcmds.h" #include "savegame.h" #include "game.h" diff --git a/source/games/duke/src/game_main.cpp b/source/games/duke/src/game_main.cpp index 8b4d7929c..d5813eaea 100644 --- a/source/games/duke/src/game_main.cpp +++ b/source/games/duke/src/game_main.cpp @@ -546,6 +546,16 @@ void drawoverheadmap(int cposx, int cposy, int czoom, int cang) DTA_Color, pe, DTA_ScaleX, j / 65536., DTA_ScaleY, j/65536., TAG_DONE); } } + + if (/*textret == 0 &&*/ ud.overhead_on == 2) + { + const int32_t a = RR ? 0 : ((ud.screen_size > 0) ? 147 : 179); + + if (!G_HaveUserMap()) // && !(G_GetLogoFlags() & LOGO_HIDEEPISODE)) + minitext(5, a + 6, GStrings.localize(gVolumeNames[ud.volume_number]), 0, 2 + 8 + 16 + 256); + minitext(5, a + 6 + 6, currentLevel->DisplayName(), 0, 2 + 8 + 16 + 256); + } + } END_DUKE_NS diff --git a/source/games/duke/src/menus.h b/source/games/duke/src/menus.h deleted file mode 100644 index c6b622c61..000000000 --- a/source/games/duke/src/menus.h +++ /dev/null @@ -1,62 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2016 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef menus_h_ -#define menus_h_ - -#include "compat.h" - -BEGIN_DUKE_NS - -// a subset of screentext parameters, restricted because menus require accessibility -typedef struct MenuFont_t -{ - // int32_t xspace, yline; - vec2_t emptychar, between; - int32_t zoom; - int32_t cursorLeftPosition, cursorCenterPosition, cursorScale, cursorScale2, cursorScale3; - int32_t textflags; - int16_t tilenum; - // selected shade glows, deselected shade is used by Blood, disabled shade is used by SW - int8_t shade_deselected, shade_disabled; - uint8_t pal; - uint8_t pal_selected, pal_deselected, pal_disabled; - uint8_t pal_selected_right, pal_deselected_right, pal_disabled_right; - - int32_t get_yline() const { return mulscale16(emptychar.y, zoom); } -} MenuFont_t; - -extern MenuFont_t MF_Redfont, MF_Bluefont, MF_Minifont; - -void Menu_Init(void); -inline int G_CheckPlayerColor(int color) -{ - static int32_t player_pals[] = { 0, 9, 10, 11, 12, 13, 14, 15, 16, 21, 23, }; - if (color >= 0 && color < 10) return player_pals[color]; - return 0; -} - - - -END_DUKE_NS - -#endif diff --git a/source/games/duke/src/zz_demo.cpp b/source/games/duke/src/zz_demo.cpp index ab589785c..900ce5a49 100644 --- a/source/games/duke/src/zz_demo.cpp +++ b/source/games/duke/src/zz_demo.cpp @@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "demo.h" #include "duke3d.h" -#include "menus.h" #include "savegame.h" #include "screens.h" diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index ef773b0e5..b92675cda 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -29,7 +29,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "baselayer.h" #include "osdcmds.h" #include "net.h" -#include "menus.h" #include "savegame.h" #include "demo.h" @@ -1492,6 +1491,14 @@ void G_PostCreateGameState(void) Net_SendClientInfo(); } +inline int G_CheckPlayerColor(int color) +{ + static int32_t player_pals[] = { 0, 9, 10, 11, 12, 13, 14, 15, 16, 21, 23, }; + if (color >= 0 && color < 10) return player_pals[color]; + return 0; +} + + static void G_Startup(void) { int32_t i; @@ -1768,6 +1775,7 @@ int32_t SetDefaults(void) return 0; } +void Menu_Init(void); int GameInterface::app_main() { diff --git a/source/games/duke/src/zz_osdcmds.cpp b/source/games/duke/src/zz_osdcmds.cpp index 2a9be4de0..fa115c9ee 100644 --- a/source/games/duke/src/zz_osdcmds.cpp +++ b/source/games/duke/src/zz_osdcmds.cpp @@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "cheats.h" #include "demo.h" // g_firstDemoFile[] #include "duke3d.h" -#include "menus.h" #include "osdcmds.h" #include "savegame.h" #include "sbar.h" diff --git a/source/games/duke/src/zz_premap.cpp b/source/games/duke/src/zz_premap.cpp index 65a637fd7..f9798f78a 100644 --- a/source/games/duke/src/zz_premap.cpp +++ b/source/games/duke/src/zz_premap.cpp @@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "ns.h" // Must come before everything else! #include "duke3d.h" -#include "menus.h" #include "demo.h" #include "savegame.h" #include "statistics.h" @@ -50,90 +49,6 @@ int32_t g_skillSoundVoice = -1; -static void G_DoLoadScreen(const char *statustext, int32_t percent) -{ - if (ud.recstat != 2) - { - int32_t i = 0; - - //g_player[myconnectindex].ps->palette = palette; - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 - - if (!statustext) - { - i = ud.screen_size; - ud.screen_size = 0; - G_UpdateScreenArea(); - videoClearScreen(0L); - } - - videoClearScreen(0); - - int const loadScreenTile = VM_OnEventWithReturn(EVENT_GETLOADTILE, g_player[screenpeek].ps->i, screenpeek, DEER ? 7040 : TILE_LOADSCREEN); - - rotatesprite_fs(320<<15,200<<15,65536L,0,loadScreenTile,0,0,2+8+64+BGSTRETCH); - - int const textY = RRRA ? 140 : 90; - - if (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0) - { - menutext_center(textY, RR ? GStrings("TXT_ENTRUM") : GStrings("TXT_LOADUM")); - if (RR) - menutext_center(textY+20, boardfilename); - else - gametext_center_shade_pal(textY+10, boardfilename, 14, 2); - } - else if (RR && g_lastLevel) - { - menutext_center(textY,GStrings("TXT_ENTERIN")); - menutext_center(textY+16+8,GStrings("TXT_CLOSEENCOUNTERS")); - } - else - { - menutext_center(textY, RR ? GStrings("TXT_ENTERIN") : GStrings("TXT_LOADING")); - menutext_center(textY+16+8,mapList[(ud.volume_number*MAXLEVELS) + ud.level_number].DisplayName()); - } - -#ifndef EDUKE32_TOUCH_DEVICES - if (statustext) gametext_center_number(180, statustext); -#endif - - if (percent != -1) - { - int32_t ii = scale(scale(xdim-1,288,320),percent,100); - rotatesprite(31<<16,145<<16,65536,0,929,15,0,2+8+16,0,0,ii,ydim-1); - rotatesprite(159<<16,145<<16,65536,0,929,15,0,2+8+16,0,0,ii,ydim-1); - rotatesprite(30<<16,144<<16,65536,0,929,0,0,2+8+16,0,0,ii,ydim-1); - rotatesprite(158<<16,144<<16,65536,0,929,0,0,2+8+16,0,0,ii,ydim-1); - } - - videoNextPage(); - - if (!statustext) - { - inputState.keyFlushChars(); - ud.screen_size = i; - } - } - else - { - if (!statustext) - { - videoClearScreen(0L); - //g_player[myconnectindex].ps->palette = palette; - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 - } - /*Gv_SetVar(g_iReturnVarID,TILE_LOADSCREEN, -1, -1);*/ - - rotatesprite_fs(320<<15,200<<15,65536L, 0,TILE_LOADSCREEN,0,0,2+8+64+BGSTRETCH); - - menutext_center(RRRA?155:105,RR? GStrings("TXT_LOADIN") : GStrings("TXT_Loading...")); - if (statustext) gametext_center_number(180, statustext); - videoNextPage(); - } -} - - extern int32_t fragbarheight(void) @@ -166,7 +81,7 @@ void G_UpdateScreenArea(void) renderFlushPerms(); { - const int32_t ss = max(ud.screen_size-8,0); + const int32_t ss = std::max(ud.screen_size-8,0); int32_t x1 = scale(ss,xdim,160); int32_t x2 = xdim-x1; @@ -392,77 +307,10 @@ static void G_LoadMapHack(char *outbuf, const char *filename) void cacheit_d(); void cacheit_r(); -int G_EnterLevel(int gameMode) + +static int LoadTheMap(MapRecord &mi, DukePlayer_t *pPlayer, int gameMode) { - int32_t i, mii; char levelName[BMAX_PATH]; - -// flushpackets(); -// waitforeverybody(); - vote_map = vote_episode = voting = -1; - - ud.respawn_monsters = ud.m_respawn_monsters; - ud.respawn_items = ud.m_respawn_items; - ud.respawn_inventory = ud.m_respawn_inventory; - ud.monsters_off = ud.m_monsters_off; - ud.coop = m_coop; - ud.marker = m_marker; - ud.ffire = m_ffire; - ud.noexits = m_noexits; - - if ((gameMode & MODE_DEMO) != MODE_DEMO) - ud.recstat = m_recstat; - if ((gameMode & MODE_DEMO) == 0 && ud.recstat == 2) - ud.recstat = 0; - - VM_OnEvent(EVENT_ENTERLEVEL); - - //if (g_networkMode != NET_DEDICATED_SERVER) - { - S_PauseSounds(false); - FX_StopAllSounds(); - S_ClearSoundLocks(); - FX_SetReverb(0); - } - - if (Menu_HaveUserMap()) - { - int levelNum = G_FindLevelByFile(boardfilename); - - if (levelNum != MAXLEVELS*MAXVOLUMES) - { - int volumeNum = levelNum; - - levelNum &= MAXLEVELS-1; - volumeNum = (volumeNum - levelNum) / MAXLEVELS; - - ud.level_number = m_level_number = levelNum; - ud.volume_number = ud.m_volume_number = volumeNum; - - boardfilename[0] = 0; - } - } - - // Redirect the final RR level to a valid map record so that currentLevel can point to something. - mii = (RR && g_lastLevel)? 127 : (ud.volume_number*MAXLEVELS)+ud.level_number; - auto &mi = mapList[mii]; - - if (mi.fileName.IsEmpty() && !Menu_HaveUserMap()) - { - Printf(TEXTCOLOR_RED "Map E%dL%d not defined!\n", ud.volume_number+1, ud.level_number+1); - return 1; - } - - i = ud.screen_size; - ud.screen_size = 0; - - FStringf msg("%s . . .", GStrings("TXT_LOADMAP")); - G_DoLoadScreen(msg, -1); - G_UpdateScreenArea(); - - ud.screen_size = i; - - DukePlayer_t *const pPlayer = g_player[0].ps; int16_t lbang; if (!VOLUMEONE && Menu_HaveUserMap()) @@ -530,6 +378,85 @@ int G_EnterLevel(int gameMode) if (isRR()) cacheit_r(); else cacheit_d(); //G_CacheMapData(); // G_FadeLoad(0,0,0, 0,252, 28, 4, -2); + return 0; +} + +int G_EnterLevel(int gameMode) +{ + int32_t i, mii; + +// flushpackets(); +// waitforeverybody(); + vote_map = vote_episode = voting = -1; + + ud.respawn_monsters = ud.m_respawn_monsters; + ud.respawn_items = ud.m_respawn_items; + ud.respawn_inventory = ud.m_respawn_inventory; + ud.monsters_off = ud.m_monsters_off; + ud.coop = m_coop; + ud.marker = m_marker; + ud.ffire = m_ffire; + ud.noexits = m_noexits; + + if ((gameMode & MODE_DEMO) != MODE_DEMO) + ud.recstat = m_recstat; + if ((gameMode & MODE_DEMO) == 0 && ud.recstat == 2) + ud.recstat = 0; + + VM_OnEvent(EVENT_ENTERLEVEL); + + //if (g_networkMode != NET_DEDICATED_SERVER) + { + S_PauseSounds(false); + FX_StopAllSounds(); + S_ClearSoundLocks(); + FX_SetReverb(0); + } + + if (Menu_HaveUserMap()) + { + int levelNum = G_FindLevelByFile(boardfilename); + + if (levelNum != MAXLEVELS*MAXVOLUMES) + { + int volumeNum = levelNum; + + levelNum &= MAXLEVELS-1; + volumeNum = (volumeNum - levelNum) / MAXLEVELS; + + ud.level_number = m_level_number = levelNum; + ud.volume_number = ud.m_volume_number = volumeNum; + + boardfilename[0] = 0; + } + } + + // Redirect the final RR level to a valid map record so that currentLevel can point to something. + mii = (RR && g_lastLevel)? 127 : (ud.volume_number*MAXLEVELS)+ud.level_number; + auto& mi = mapList[mii]; + + if (mi.fileName.IsEmpty() && !Menu_HaveUserMap()) + { + Printf(TEXTCOLOR_RED "Map E%dL%d not defined!\n", ud.volume_number+1, ud.level_number+1); + return 1; + } + + i = ud.screen_size; + ud.screen_size = 0; + + FStringf msg("%s . . .", GStrings("TXT_LOADMAP")); + + ud.screen_size = i; + + DukePlayer_t *const pPlayer = g_player[0].ps; + + + /* + G_DoLoadScreen(msg, -1); + G_UpdateScreenArea(); + */ + int res = LoadTheMap(mi, pPlayer, gameMode); + if (res != 0) return res; // Try this first so that it can disable the CD player if no tracks are found. if (RR && !(gameMode & MODE_DEMO)) diff --git a/source/games/duke/src/zz_savegame.cpp b/source/games/duke/src/zz_savegame.cpp index 3b8c1abe6..93e87f689 100644 --- a/source/games/duke/src/zz_savegame.cpp +++ b/source/games/duke/src/zz_savegame.cpp @@ -158,16 +158,6 @@ int32_t G_LoadPlayer(const char *path) ud.multimode = h.numplayers; S_PauseSounds(true); - if (numplayers > 1) - { - pub = NUMPAGES; - pus = NUMPAGES; - G_UpdateScreenArea(); - drawbackground(); - menutext_center(100, "Loading..."); - videoNextPage(); - } - Net_WaitForEverybody(); FX_StopAllSounds(); diff --git a/source/games/duke/src/zz_screens.cpp b/source/games/duke/src/zz_screens.cpp index e9118ebc7..fb0d0c846 100644 --- a/source/games/duke/src/zz_screens.cpp +++ b/source/games/duke/src/zz_screens.cpp @@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "screens.h" #include "sbar.h" -#include "menus.h" #include "demo.h" #include "mdsprite.h" #include "gamecvars.h" @@ -429,15 +428,6 @@ void G_DisplayRest(int32_t smoothratio) drawoverheadmap(cposx, cposy, pp->zoom, cang); restoreinterpolations(); - - if (/*textret == 0 &&*/ ud.overhead_on == 2) - { - const int32_t a = RR ? 0 : ((ud.screen_size > 0) ? 147 : 179); - - if (!G_HaveUserMap()) // && !(G_GetLogoFlags() & LOGO_HIDEEPISODE)) - minitext(5, a+6, GStrings.localize(gVolumeNames[ud.volume_number]), 0, 2+8+16+256); - minitext(5, a+6+6, currentLevel->DisplayName(), 0, 2+8+16+256); - } } } diff --git a/source/games/duke/src/zz_text.cpp b/source/games/duke/src/zz_text.cpp index e2d7c9de4..fff44fb5e 100644 --- a/source/games/duke/src/zz_text.cpp +++ b/source/games/duke/src/zz_text.cpp @@ -24,12 +24,30 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "duke3d.h" #include "compat.h" #include "sbar.h" -#include "menus.h" #include "gstrings.h" BEGIN_DUKE_NS +// a subset of screentext parameters, restricted because menus require accessibility +typedef struct MenuFont_t +{ + // int32_t xspace, yline; + vec2_t emptychar, between; + int32_t zoom; + int32_t cursorLeftPosition, cursorCenterPosition, cursorScale, cursorScale2, cursorScale3; + int32_t textflags; + int16_t tilenum; + // selected shade glows, deselected shade is used by Blood, disabled shade is used by SW + int8_t shade_deselected, shade_disabled; + uint8_t pal; + uint8_t pal_selected, pal_deselected, pal_disabled; + uint8_t pal_selected_right, pal_deselected_right, pal_disabled_right; + + int32_t get_yline() const { return mulscale16(emptychar.y, zoom); } +} MenuFont_t; + + // common font types // tilenums are set after namesdyn runs. // These are also modifiable by scripts. @@ -164,6 +182,12 @@ vec2_t gametext_(int32_t x, int32_t y, const char *t, int32_t s, int32_t p, int3 { return G_ScreenText(MF_Bluefont.tilenum, x, y, MF_Bluefont.zoom, 0, 0, t, s, p, o|2|8|16|ROTATESPRITE_FULL16, a, MF_Bluefont.emptychar.x, MF_Bluefont.emptychar.y, MF_Bluefont.between.x, MF_Bluefont.between.y, MF_Bluefont.textflags|f, 0, 0, xdim-1, ydim-1); } + +static FORCE_INLINE int32_t sbarsc(int32_t sc) +{ + return scale(sc, ud.statusbarscale, 100); +} + static int32_t sbarx16(int32_t x) { if (ud.screen_size == 4) return sbarsc(x); diff --git a/source/games/duke/src/zz_text.h b/source/games/duke/src/zz_text.h index b3c25a7b7..12d29970b 100644 --- a/source/games/duke/src/zz_text.h +++ b/source/games/duke/src/zz_text.h @@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #pragma once -#include "menus.h" #include "screentext.h" BEGIN_DUKE_NS @@ -40,14 +39,7 @@ inline int minitext(int x, int y, const char* t, int p, int sb) return minitext_(x, y, t, 0, p, sb); } -static FORCE_INLINE int32_t sbarsc(int32_t sc) -{ - return scale(sc, ud.statusbarscale, 100); -} - - #define menutext_center(y, t) menutext_(160<<16, (y)<<16, 0, (t), 10|16, TEXT_XCENTER) -#define gametext_center(y, t) gametext_(160<<16, (y)<<16, (t), 0, MF_Bluefont.pal, 0, 0, TEXT_XCENTER) #define gametext_center_number(y, t) gametext_(160<<16, (y)<<16, (t), 0, MF_Bluefont.pal, 0, 0, TEXT_XCENTER|TEXT_GAMETEXTNUMHACK) #define gametext_center_shade_pal(y, t, s, p) gametext_(160<<16, (y)<<16, (t), (s), (p), 0, 0, TEXT_XCENTER)