mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- the primary Blood menus are working.
Now this was magnitudes easier than the EDuke menu - NBlood's menu is actually clean and usable code but still nothing compared to a unified menu system.
This commit is contained in:
parent
b0a6734915
commit
b372cb5f35
25 changed files with 518 additions and 304 deletions
|
@ -89,7 +89,14 @@ struct GameInterface : ::GameInterface
|
|||
void set_hud_scale(int size) override;
|
||||
FString statFPS() override;
|
||||
FSavegameInfo GetSaveSig() override;
|
||||
|
||||
void MenuOpened() override;
|
||||
void MenuSound(EMenuSounds snd) override;
|
||||
void MenuClosed() override;
|
||||
bool CanSave() override;
|
||||
void StartGame(FGameStartup& gs) override;
|
||||
void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) override;
|
||||
void DrawMenuCaption(const DVector2& origin, const char* text) override;
|
||||
void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position) override;
|
||||
};
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -40,75 +40,134 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "demo.h"
|
||||
#include "network.h"
|
||||
#include "c_bind.h"
|
||||
#include "menu/menu.h"
|
||||
|
||||
bool ShowOptionMenu();
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
CMenuTextMgr gMenuTextMgr;
|
||||
|
||||
CMenuTextMgr::CMenuTextMgr()
|
||||
class CGameMenuItemQAV
|
||||
{
|
||||
at0 = -1;
|
||||
}
|
||||
|
||||
void CMenuTextMgr::DrawText(const char* pString, int nFont, int x, int y, int nShade, int nPalette, bool shadow)
|
||||
{
|
||||
viewDrawText(nFont, pString, x, y, nShade, nPalette, 0, shadow);
|
||||
}
|
||||
|
||||
void CMenuTextMgr::GetFontInfo(int nFont, const char* pString, int* pXSize, int* pYSize)
|
||||
{
|
||||
if (nFont < 0 || nFont >= 5)
|
||||
return;
|
||||
viewGetFontInfo(nFont, pString, pXSize, pYSize);
|
||||
}
|
||||
|
||||
const char* zNetGameTypes[] =
|
||||
{
|
||||
"Cooperative",
|
||||
"Bloodbath",
|
||||
"Teams",
|
||||
public:
|
||||
int m_nX, m_nY;
|
||||
TArray<uint8_t> raw;
|
||||
int at2c;
|
||||
int lastTick;
|
||||
bool bWideScreen;
|
||||
bool bClearBackground;
|
||||
CGameMenuItemQAV(int, int, const char*, bool widescreen = false, bool clearbackground = false);
|
||||
void Draw(void);
|
||||
};
|
||||
|
||||
void drawLoadingScreen(void)
|
||||
CGameMenuItemQAV::CGameMenuItemQAV(int a3, int a4, const char* name, bool widescreen, bool clearbackground)
|
||||
{
|
||||
char buffer[80];
|
||||
if (gGameOptions.nGameType == 0)
|
||||
m_nY = a4;
|
||||
m_nX = a3;
|
||||
bWideScreen = widescreen;
|
||||
bClearBackground = clearbackground;
|
||||
|
||||
if (name)
|
||||
{
|
||||
if (gDemo.at1)
|
||||
sprintf(buffer, "Loading Demo");
|
||||
else
|
||||
sprintf(buffer, "Loading Level");
|
||||
// NBlood read this directly from the file system cache, but let's better store the data locally for robustness.
|
||||
raw = kloadfile(name, 0);
|
||||
if (raw.Size() != 0)
|
||||
{
|
||||
auto data = (QAV*)raw.Data();
|
||||
data->nSprite = -1;
|
||||
data->x = m_nX;
|
||||
data->y = m_nY;
|
||||
data->Preload();
|
||||
at2c = data->at10;
|
||||
lastTick = (int)totalclock;
|
||||
}
|
||||
}
|
||||
else
|
||||
sprintf(buffer, "%s", zNetGameTypes[gGameOptions.nGameType - 1]);
|
||||
viewLoadingScreen(2049, buffer, levelGetTitle(), NULL);
|
||||
}
|
||||
|
||||
void CGameMenuItemQAV::Draw(void)
|
||||
{
|
||||
if (bClearBackground)
|
||||
videoClearScreen(0);
|
||||
|
||||
if (raw.Size() > 0)
|
||||
{
|
||||
auto data = (QAV*)raw.Data();
|
||||
ClockTicks backFC = gFrameClock;
|
||||
gFrameClock = totalclock;
|
||||
int nTicks = (int)totalclock - lastTick;
|
||||
lastTick = (int)totalclock;
|
||||
at2c -= nTicks;
|
||||
if (at2c <= 0 || at2c > data->at10)
|
||||
{
|
||||
at2c = data->at10;
|
||||
}
|
||||
data->Play(data->at10 - at2c - nTicks, data->at10 - at2c, -1, NULL);
|
||||
int wx1, wy1, wx2, wy2;
|
||||
wx1 = windowxy1.x;
|
||||
wy1 = windowxy1.y;
|
||||
wx2 = windowxy2.x;
|
||||
wy2 = windowxy2.y;
|
||||
windowxy1.x = 0;
|
||||
windowxy1.y = 0;
|
||||
windowxy2.x = xdim - 1;
|
||||
windowxy2.y = ydim - 1;
|
||||
if (bWideScreen)
|
||||
{
|
||||
int xdim43 = scale(ydim, 4, 3);
|
||||
int nCount = (xdim + xdim43 - 1) / xdim43;
|
||||
int backX = data->x;
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
data->Draw(data->at10 - at2c, 10 + kQavOrientationLeft, 0, 0);
|
||||
data->x += 320;
|
||||
}
|
||||
data->x = backX;
|
||||
}
|
||||
else
|
||||
data->Draw(data->at10 - at2c, 10, 0, 0);
|
||||
|
||||
windowxy1.x = wx1;
|
||||
windowxy1.y = wy1;
|
||||
windowxy2.x = wx2;
|
||||
windowxy2.y = wy2;
|
||||
gFrameClock = backFC;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static std::unique_ptr<CGameMenuItemQAV> itemBloodQAV; // This must be global to ensure that the animation remains consistent across menus.
|
||||
/*
|
||||
CGameMenuItemQAV itemCreditsQAV("", 3, 160, 100, "CREDITS", false, true);
|
||||
CGameMenuItemQAV itemHelp3QAV("", 3, 160, 100, "HELP3", false, false);
|
||||
CGameMenuItemQAV itemHelp3BQAV("", 3, 160, 100, "HELP3B", false, false);
|
||||
CGameMenuItemQAV itemHelp4QAV("", 3, 160, 100, "HELP4", false, true);
|
||||
CGameMenuItemQAV itemHelp5QAV("", 3, 160, 100, "HELP5", false, true);
|
||||
*/
|
||||
|
||||
|
||||
void UpdateNetworkMenus(void)
|
||||
{
|
||||
// Kept as a reminder to reimplement later.
|
||||
#if 0
|
||||
if (gGameOptions.nGameType > 0)
|
||||
{
|
||||
itemMain1.at24 = &menuNetStart;
|
||||
itemMain1.at28 = 2;
|
||||
itemMain1.resource = &menuNetStart;
|
||||
itemMain1.data = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemMain1.at24 = &menuEpisode;
|
||||
itemMain1.at28 = -1;
|
||||
itemMain1.resource = &menuEpisode;
|
||||
itemMain1.data = -1;
|
||||
}
|
||||
if (gGameOptions.nGameType > 0)
|
||||
{
|
||||
itemMainSave1.at24 = &menuNetStart;
|
||||
itemMainSave1.at28 = 2;
|
||||
itemMainSave1.resource = &menuNetStart;
|
||||
itemMainSave1.data = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemMainSave1.at24 = &menuEpisode;
|
||||
itemMainSave1.at28 = -1;
|
||||
itemMainSave1.resource = &menuEpisode;
|
||||
itemMainSave1.data = -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -128,7 +187,7 @@ void MenuSetupEpisodeInfo(void)
|
|||
{
|
||||
if (j < pEpisode->nLevels)
|
||||
{
|
||||
zLevelNames[i][j] = pEpisode->at28[j].at90;
|
||||
zLevelNames[i][j] = pEpisode->data[j].at90;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -136,11 +195,219 @@ void MenuSetupEpisodeInfo(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Implements the native looking menu used for the main menu
|
||||
// and the episode/skill selection screens, i.e. the parts
|
||||
// that need to look authentic
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class BloodListMenu : public DListMenu
|
||||
{
|
||||
using Super = DListMenu;
|
||||
protected:
|
||||
|
||||
void PostDraw()
|
||||
{
|
||||
itemBloodQAV->Draw();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Menu related game interface functions
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void GameInterface::DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags)
|
||||
{
|
||||
if (!text) return;
|
||||
int shade = (state != NIT_InactiveState) ? 32 : 48;
|
||||
int pal = (state != NIT_InactiveState) ? 5 : 5;
|
||||
if (state == NIT_SelectedState) shade = 32 - ((int)totalclock & 63);
|
||||
int width, height;
|
||||
int gamefont = fontnum == NIT_BigFont ? 1 : fontnum == NIT_SmallFont ? 2 : 3;
|
||||
|
||||
int x = int(xpos);
|
||||
int y = int(ypos);
|
||||
viewGetFontInfo(gamefont, text, &width, &height);
|
||||
|
||||
if (flags & LMF_Centered)
|
||||
{
|
||||
x -= width / 2;
|
||||
}
|
||||
|
||||
viewDrawText(gamefont, text, x, y, shade, pal, 0, true);
|
||||
}
|
||||
|
||||
|
||||
void GameInterface::MenuOpened()
|
||||
{
|
||||
#if 0
|
||||
S_PauseSounds(true);
|
||||
if ((!g_netServer && ud.multimode < 2))
|
||||
{
|
||||
ready2send = 0;
|
||||
totalclock = ototalclock;
|
||||
screenpeek = myconnectindex;
|
||||
}
|
||||
|
||||
auto& gm = g_player[myconnectindex].ps->gm;
|
||||
if (gm & MODE_GAME)
|
||||
{
|
||||
gm |= MODE_MENU;
|
||||
}
|
||||
#endif
|
||||
|
||||
itemBloodQAV.reset(new CGameMenuItemQAV(160, 100, "BDRIP.QAV", true));
|
||||
}
|
||||
|
||||
void GameInterface::MenuSound(EMenuSounds snd)
|
||||
{
|
||||
#if 0
|
||||
switch (snd)
|
||||
{
|
||||
case CursorSound:
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
break;
|
||||
|
||||
case AdvanceSound:
|
||||
S_PlaySound(RR ? 341 : PISTOL_BODYHIT);
|
||||
break;
|
||||
|
||||
case CloseSound:
|
||||
S_PlaySound(EXITMENUSOUND);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GameInterface::MenuClosed()
|
||||
{
|
||||
itemBloodQAV.reset();
|
||||
#if 0
|
||||
auto& gm = g_player[myconnectindex].ps->gm;
|
||||
if (gm & MODE_GAME)
|
||||
{
|
||||
if (gm & MODE_MENU)
|
||||
I_ClearAllInput();
|
||||
|
||||
// The following lines are here so that you cannot close the menu when no game is running.
|
||||
gm &= ~MODE_MENU;
|
||||
|
||||
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
|
||||
{
|
||||
ready2send = 1;
|
||||
totalclock = ototalclock;
|
||||
CAMERACLOCK = (int32_t)totalclock;
|
||||
CAMERADIST = 65536;
|
||||
|
||||
// Reset next-viewscreen-redraw counter.
|
||||
// XXX: are there any other cases like that in need of handling?
|
||||
if (g_curViewscreen >= 0)
|
||||
actor[g_curViewscreen].t_data[0] = (int32_t)totalclock;
|
||||
}
|
||||
|
||||
G_UpdateScreenArea();
|
||||
S_PauseSounds(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool GameInterface::CanSave()
|
||||
{
|
||||
#if 0
|
||||
if (ud.recstat == 2) return false;
|
||||
auto& myplayer = *g_player[myconnectindex].ps;
|
||||
if (sprite[myplayer.i].extra <= 0)
|
||||
{
|
||||
P_DoQuote(QUOTE_SAVE_DEAD, &myplayer);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
void GameInterface::StartGame(FGameStartup& gs)
|
||||
{
|
||||
#if 0
|
||||
int32_t skillsound = PISTOL_BODYHIT;
|
||||
|
||||
switch (gs.Skill)
|
||||
{
|
||||
case 0:
|
||||
skillsound = 427;
|
||||
break;
|
||||
case 1:
|
||||
skillsound = 428;
|
||||
break;
|
||||
case 2:
|
||||
skillsound = 196;
|
||||
break;
|
||||
case 3:
|
||||
skillsound = 195;
|
||||
break;
|
||||
case 4:
|
||||
skillsound = 197;
|
||||
break;
|
||||
}
|
||||
|
||||
ud.m_player_skill = gs.Skill + 1;
|
||||
if (menu_sounds) g_skillSoundVoice = S_PlaySound(skillsound);
|
||||
ud.m_respawn_monsters = (gs.Skill == 3);
|
||||
ud.m_monsters_off = ud.monsters_off = 0;
|
||||
ud.m_respawn_items = 0;
|
||||
ud.m_respawn_inventory = 0;
|
||||
ud.multimode = 1;
|
||||
ud.m_volume_number = gs.Episode;
|
||||
ud.m_level_number = gs.Level;
|
||||
G_NewGame_EnterLevel();
|
||||
#endif
|
||||
}
|
||||
|
||||
FSavegameInfo GameInterface::GetSaveSig()
|
||||
{
|
||||
return { SAVESIG_BLD, MINSAVEVER_BLD, SAVEVER_BLD };
|
||||
}
|
||||
|
||||
void GameInterface::DrawMenuCaption(const DVector2& origin, const char* text)
|
||||
{
|
||||
int height;
|
||||
// font #1, tile #2038.
|
||||
viewGetFontInfo(1, NULL, NULL, &height);
|
||||
rotatesprite(int(origin.X * 65536) + 320 << 15, 20 << 16, 65536, 0, 2038, -128, 0, 78, 0, 0, xdim - 1, ydim - 1);
|
||||
viewDrawText(1, text, 160, 20 - height / 2, -128, 0, 1, false);
|
||||
}
|
||||
|
||||
void GameInterface::DrawCenteredTextScreen(const DVector2& origin, const char* text, int position)
|
||||
{
|
||||
#if 0
|
||||
Menu_DrawBackground(origin);
|
||||
G_ScreenText(MF_Bluefont.tilenum, int((origin.X + 160) * 65536), int((origin.Y + position) * 65536), MF_Bluefont.zoom, 0, 0, text, 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 | TEXT_XCENTER, 0, 0, xdim - 1, ydim - 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
END_BLD_NS
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Class registration
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
static TMenuClassDescriptor<Blood::BloodListMenu> _lm("Blood.ListMenu");
|
||||
|
||||
void RegisterBloodMenus()
|
||||
{
|
||||
menuClasses.Push(&_lm);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ void CEndGameMgr::Draw(void)
|
|||
{
|
||||
viewLoadingScreenWide();
|
||||
int nHeight;
|
||||
gMenuTextMgr.GetFontInfo(1, NULL, NULL, &nHeight);
|
||||
viewGetFontInfo(1, NULL, NULL, &nHeight);
|
||||
rotatesprite(160<<16, 20<<16, 65536, 0, 2038, -128, 0, 6, 0, 0, xdim-1, ydim-1);
|
||||
int nY = 20 - nHeight / 2;
|
||||
if (gGameOptions.nGameType == 0)
|
||||
|
|
|
@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "levels.h"
|
||||
#include "menu.h"
|
||||
#include "qav.h"
|
||||
#include "demo.h"
|
||||
#include "resource.h"
|
||||
#include "view.h"
|
||||
#include "c_bind.h"
|
||||
|
@ -43,6 +44,28 @@ bool ShowOptionMenu();
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
const char* zNetGameTypes[] =
|
||||
{
|
||||
"Cooperative",
|
||||
"Bloodbath",
|
||||
"Teams",
|
||||
};
|
||||
|
||||
void drawLoadingScreen(void)
|
||||
{
|
||||
char buffer[80];
|
||||
if (gGameOptions.nGameType == 0)
|
||||
{
|
||||
if (gDemo.at1)
|
||||
sprintf(buffer, "Loading Demo");
|
||||
else
|
||||
sprintf(buffer, "Loading Level");
|
||||
}
|
||||
else
|
||||
sprintf(buffer, "%s", zNetGameTypes[gGameOptions.nGameType - 1]);
|
||||
viewLoadingScreen(2049, buffer, levelGetTitle(), NULL);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
CMenuTextMgr gMenuTextMgr;
|
||||
|
@ -159,26 +182,6 @@ void CGameMenuMgr::Draw(void)
|
|||
{
|
||||
if (pActiveMenu)
|
||||
{
|
||||
if (GUICapture & 2)
|
||||
{
|
||||
ImGui_Begin_Frame();
|
||||
bool b = true;
|
||||
videoFadeToBlack(1);
|
||||
#if 0
|
||||
ImGui::ShowDemoWindow(&b);
|
||||
if (!b)
|
||||
#else
|
||||
if (!ShowOptionMenu())
|
||||
#endif
|
||||
{
|
||||
GUICapture &= ~2;
|
||||
GUICapture |= 4;
|
||||
Pop();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
pActiveMenu->Draw();
|
||||
viewUpdatePages();
|
||||
}
|
||||
|
@ -2201,32 +2204,6 @@ bool CGameMenuItemQAV::Event(CGameMenuEvent &event)
|
|||
pMenu->FocusNextItem();
|
||||
return false;
|
||||
case kMenuEventInit:
|
||||
if (at20)
|
||||
{
|
||||
if (!at28)
|
||||
{
|
||||
at24 = gSysRes.Lookup(at20, "QAV");
|
||||
if (!at24)
|
||||
ThrowError("Could not load QAV %s\n", at20);
|
||||
at28 = (QAV*)gSysRes.Lock(at24);
|
||||
at28->nSprite = -1;
|
||||
at28->x = m_nX;
|
||||
at28->y = m_nY;
|
||||
at28->Preload();
|
||||
at2c = at28->at10;
|
||||
at30 = (int)totalclock;
|
||||
return false;
|
||||
}
|
||||
gSysRes.Lock(at24);
|
||||
}
|
||||
return false;
|
||||
case kMenuEventDeInit:
|
||||
if (at20 && at28)
|
||||
{
|
||||
gSysRes.Unlock(at24);
|
||||
if (at24->LockCount() == 0)
|
||||
at28 = NULL;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return CGameMenuItem::Event(event);
|
||||
|
|
|
@ -31,17 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
class CMenuTextMgr
|
||||
{
|
||||
public:
|
||||
int at0;
|
||||
CMenuTextMgr();
|
||||
void DrawText(const char *pString, int nFont, int x, int y, int nShade, int nPalette, bool shadow );
|
||||
void GetFontInfo(int nFont, const char *pString, int *pXSize, int *pYSize);
|
||||
};
|
||||
|
||||
extern CMenuTextMgr gMenuTextMgr;
|
||||
|
||||
void drawLoadingScreen(void);
|
||||
void UpdateNetworkMenus(void);
|
||||
|
||||
|
@ -329,22 +318,6 @@ public:
|
|||
virtual bool Event(CGameMenuEvent &);
|
||||
};
|
||||
|
||||
class CGameMenuItemQAV : public CGameMenuItem
|
||||
{
|
||||
public:
|
||||
const char *at20;
|
||||
DICTNODE *at24;
|
||||
QAV *at28;
|
||||
int at2c;
|
||||
int at30;
|
||||
bool bWideScreen;
|
||||
bool bClearBackground;
|
||||
CGameMenuItemQAV();
|
||||
CGameMenuItemQAV(const char *, int, int, int, const char *, bool widescreen = false, bool clearbackground = false);
|
||||
virtual void Draw(void);
|
||||
virtual bool Event(CGameMenuEvent &);
|
||||
void Reset(void);
|
||||
};
|
||||
|
||||
class CGameMenuItemZCycleSelect : public CGameMenuItem
|
||||
{
|
||||
|
|
|
@ -187,12 +187,6 @@ CGameMenu menuNetwork;
|
|||
CGameMenu menuNetworkHost;
|
||||
CGameMenu menuNetworkJoin;
|
||||
|
||||
CGameMenuItemQAV itemBloodQAV("", 3, 160, 100, "BDRIP", true);
|
||||
CGameMenuItemQAV itemCreditsQAV("", 3, 160, 100, "CREDITS", false, true);
|
||||
CGameMenuItemQAV itemHelp3QAV("", 3, 160, 100, "HELP3", false, false);
|
||||
CGameMenuItemQAV itemHelp3BQAV("", 3, 160, 100, "HELP3B", false, false);
|
||||
CGameMenuItemQAV itemHelp4QAV("", 3, 160, 100, "HELP4", false, true);
|
||||
CGameMenuItemQAV itemHelp5QAV("", 3, 160, 100, "HELP5", false, true);
|
||||
|
||||
CGameMenuItemTitle itemMainTitle("BLOOD", 1, 160, 20, 2038);
|
||||
CGameMenuItemChain itemMain1("NEW GAME", 1, 0, 45, 320, 1, &menuEpisode, -1, NULL, 0);
|
||||
|
|
|
@ -383,7 +383,7 @@ void CGameMessageMgr::Display(void)
|
|||
if (gViewMode == 3)
|
||||
{
|
||||
int height;
|
||||
gMenuTextMgr.GetFontInfo(nFont, pMessage->text, &height, NULL);
|
||||
viewGetFontInfo(nFont, pMessage->text, &height, NULL);
|
||||
if (x+height > gViewX1S)
|
||||
viewUpdatePages();
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ void CGameMessageMgr::Display(void)
|
|||
if (gViewMode == 3)
|
||||
{
|
||||
int height;
|
||||
gMenuTextMgr.GetFontInfo(nFont, pMessage->text, &height, NULL);
|
||||
viewGetFontInfo(nFont, pMessage->text, &height, NULL);
|
||||
if (x+height > gViewX1S)
|
||||
viewUpdatePages();
|
||||
}
|
||||
|
|
|
@ -1004,39 +1004,6 @@ void viewDrawText(int nFont, const char *pString, int x, int y, int nShade, int
|
|||
if (shadow)
|
||||
G_ScreenText(pFont->tile, x + 1, y + 1, 65536, 0, 0, pString, 127, nPalette, 2|8|16|nStat, alpha, 0, 0, pFont->space, 0, nFlags, 0, 0, xdim-1, ydim-1);
|
||||
G_ScreenText(pFont->tile, x, y, 65536, 0, 0, pString, nShade, nPalette, 2|8|16|nStat, alpha, 0, 0, pFont->space, 0, nFlags, 0, 0, xdim-1, ydim-1);
|
||||
//if (nFont < 0 || nFont >= 5 || !pString) return;
|
||||
//FONT *pFont = &gFont[nFont];
|
||||
//
|
||||
//if (position)
|
||||
//{
|
||||
// const char *s = pString;
|
||||
// int width = -pFont->space;
|
||||
// while (*s)
|
||||
// {
|
||||
// int nTile = ((*s-' ')&127)+pFont->tile;
|
||||
// if (tilesiz[nTile].x && tilesiz[nTile].y)
|
||||
// width += tilesiz[nTile].x+pFont->space;
|
||||
// s++;
|
||||
// }
|
||||
// if (position == 1)
|
||||
// width >>= 1;
|
||||
// x -= width;
|
||||
//}
|
||||
//const char *s = pString;
|
||||
//while (*s)
|
||||
//{
|
||||
// int nTile = ((*s-' ')&127) + pFont->tile;
|
||||
// if (tilesiz[nTile].x && tilesiz[nTile].y)
|
||||
// {
|
||||
// if (shadow)
|
||||
// {
|
||||
// rotatesprite_fs_alpha((x+1)<<16, (y+1)<<16, 65536, 0, nTile, 127, nPalette, 26|nStat, alpha);
|
||||
// }
|
||||
// rotatesprite_fs_alpha(x<<16, y<<16, 65536, 0, nTile, nShade, nPalette, 26|nStat, alpha);
|
||||
// x += tilesiz[nTile].x+pFont->space;
|
||||
// }
|
||||
// s++;
|
||||
//}
|
||||
}
|
||||
|
||||
void viewTileSprite(int nTile, int nShade, int nPalette, int x1, int y1, int x2, int y2)
|
||||
|
@ -3632,7 +3599,7 @@ void viewLoadingScreenWide(void)
|
|||
void viewLoadingScreenUpdate(const char *pzText4, int nPercent)
|
||||
{
|
||||
int vc;
|
||||
gMenuTextMgr.GetFontInfo(1, NULL, NULL, &vc);
|
||||
viewGetFontInfo(1, NULL, NULL, &vc);
|
||||
if (nLoadingScreenTile == kLoadScreen)
|
||||
viewLoadingScreenWide();
|
||||
else if (nLoadingScreenTile)
|
||||
|
|
|
@ -213,7 +213,7 @@ struct GameInterface
|
|||
virtual void set_hud_scale(int size) = 0;
|
||||
virtual FString statFPS() { return "FPS display not available"; }
|
||||
virtual GameStats getStats() { return {}; }
|
||||
virtual void DrawNativeMenuText(int fontnum, int state, int xpos, int ypos, float fontscale, const char* text, int flags) {}
|
||||
virtual void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) {}
|
||||
virtual void MainMenuOpened() {}
|
||||
virtual void MenuOpened() {}
|
||||
virtual void MenuClosed() {}
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "v_draw.h"
|
||||
#include "image.h"
|
||||
#include "v_2ddrawer.h"
|
||||
#include "gstrings.h"
|
||||
#include "v_font.h"
|
||||
|
||||
class FFont;
|
||||
|
@ -225,7 +226,7 @@ void DrawText(F2DDrawer* drawer, FFont *font, int normalcolor, double x, double
|
|||
{
|
||||
return;
|
||||
}
|
||||
DrawTextCommon(drawer, font, normalcolor, x, y, (const uint8_t*)string, parms);
|
||||
DrawTextCommon(drawer, font, normalcolor, x, y, (const uint8_t*)GStrings.localize(string), parms);
|
||||
}
|
||||
|
||||
void DrawText(F2DDrawer* drawer, FFont *font, int normalcolor, double x, double y, const char32_t *string, int tag_first, ...)
|
||||
|
|
|
@ -270,7 +270,7 @@ void DListMenu::PreDraw()
|
|||
{
|
||||
if (mDesc->mCaption.IsNotEmpty())
|
||||
{
|
||||
gi->DrawMenuCaption(origin, mDesc->mCaption);
|
||||
gi->DrawMenuCaption(origin, GStrings.localize(mDesc->mCaption));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,7 +447,6 @@ void FListMenuItemStaticText::Drawer(DListMenu* menu, const DVector2& origin, bo
|
|||
const char *text = mText;
|
||||
if (text != NULL)
|
||||
{
|
||||
if (*text == '$') text = GStrings(text+1);
|
||||
if (mYpos >= 0)
|
||||
{
|
||||
int x = mXpos;
|
||||
|
@ -550,7 +549,6 @@ void FListMenuItemText::Drawer(DListMenu* menu, const DVector2& origin, bool sel
|
|||
const char *text = mText;
|
||||
if (mText.Len())
|
||||
{
|
||||
if (*text == '$') text = GStrings(text+1);
|
||||
DrawText(&twod, mFont, selected ? mColorSelected : mColor, mXpos, mYpos, text, DTA_Clean, true, TAG_DONE);
|
||||
}
|
||||
}
|
||||
|
@ -560,8 +558,7 @@ int FListMenuItemText::GetWidth()
|
|||
const char *text = mText;
|
||||
if (mText.Len())
|
||||
{
|
||||
if (*text == '$') text = GStrings(text+1);
|
||||
return mFont->StringWidth(text);
|
||||
return mFont->StringWidth(GStrings.localize(text));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -592,9 +589,8 @@ void FListMenuItemNativeText::Drawer(DListMenu* menu, const DVector2& origin, bo
|
|||
const char* text = mText;
|
||||
if (mText.Len() && !mHidden)
|
||||
{
|
||||
if (*text == '$') text = GStrings(text + 1);
|
||||
auto state = selected ? NIT_SelectedState : mEnabled ? NIT_ActiveState : NIT_InactiveState;
|
||||
gi->DrawNativeMenuText(mFontnum, state, int((origin.X + mXpos) * 65536) , int((origin.Y + mYpos) * 65536), 1.f, text, menu->Descriptor()->mFlags);
|
||||
gi->DrawNativeMenuText(mFontnum, state, origin.X + mXpos, origin.Y + mYpos, 1.f, GStrings.localize(text), menu->Descriptor()->mFlags);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
|
||||
void RegisterDukeMenus();
|
||||
void RegisterRedneckMenus();
|
||||
void RegisterBloodMenus();
|
||||
void RegisterLoadsaveMenus();
|
||||
extern bool rotatesprite_2doverride;
|
||||
bool help_disabled, credits_disabled;
|
||||
|
@ -897,6 +898,7 @@ void M_Init (void)
|
|||
{
|
||||
RegisterDukeMenus();
|
||||
RegisterRedneckMenus();
|
||||
RegisterBloodMenus();
|
||||
RegisterLoadsaveMenus();
|
||||
timerSetCallback(M_Ticker);
|
||||
M_ParseMenuDefs();
|
||||
|
|
|
@ -415,7 +415,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
|||
|
||||
auto it = new FListMenuItemNativeText(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, text, desc->mNativeFontNum, desc->mNativePalNum, desc->mNativeFontScale, action, param);
|
||||
desc->mItems.Push(it);
|
||||
//desc->mYpos += desc->mLinespacing;
|
||||
desc->mYpos += desc->mLinespacing;
|
||||
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size() - 1;
|
||||
|
||||
}
|
||||
|
@ -1142,13 +1142,15 @@ static void BuildEpisodeMenu()
|
|||
{
|
||||
FListMenuDescriptor *ld = static_cast<FListMenuDescriptor*>(*desc);
|
||||
ld->mSelectedItem = gDefaultVolume;
|
||||
int y = ld->mYpos;
|
||||
|
||||
for (int i = 0; i < MAXVOLUMES; i++)
|
||||
{
|
||||
if (gVolumeNames[i].IsNotEmpty() && !(gVolumeFlags[i] & EF_HIDEFROMSP))
|
||||
|
||||
{
|
||||
auto it = new FListMenuItemNativeText(ld->mXpos, 0, 0, gVolumeNames[i][0], gVolumeNames[i], NIT_BigFont, NIT_ActiveState, 1, NAME_SkillMenu, i);
|
||||
auto it = new FListMenuItemNativeText(ld->mXpos, y, 0, gVolumeNames[i][0], gVolumeNames[i], NIT_BigFont, NIT_ActiveState, 1, NAME_SkillMenu, i);
|
||||
y += ld->mLinespacing;
|
||||
ld->mItems.Push(it);
|
||||
addedVolumes++;
|
||||
if (gVolumeSubtitles[i].IsNotEmpty())
|
||||
|
@ -1163,7 +1165,8 @@ static void BuildEpisodeMenu()
|
|||
//auto it = new FListMenuItemNativeStaticText(ld->mXpos, "", NIT_SmallFont); // empty entry as spacer.
|
||||
//ld->mItems.Push(it);
|
||||
|
||||
auto it = new FListMenuItemNativeText(ld->mXpos, 0, 0, 0, "$MNU_USERMAP", NIT_BigFont, NIT_ActiveState, 1, NAME_UsermapMenu);
|
||||
y += ld->mLinespacing / 3;
|
||||
auto it = new FListMenuItemNativeText(ld->mXpos, y, 0, 0, "$MNU_USERMAP", NIT_BigFont, NIT_ActiveState, 1, NAME_UsermapMenu);
|
||||
ld->mItems.Push(it);
|
||||
addedVolumes++;
|
||||
if (g_gameType & GAMEFLAG_SW) // fixme: make this game independent.
|
||||
|
@ -1185,12 +1188,14 @@ static void BuildEpisodeMenu()
|
|||
{
|
||||
FListMenuDescriptor* ld = static_cast<FListMenuDescriptor*>(*desc);
|
||||
ld->mSelectedItem = gDefaultSkill;
|
||||
int y = ld->mYpos;
|
||||
|
||||
for (int i = 0; i < MAXSKILLS; i++)
|
||||
{
|
||||
if (gSkillNames[i].IsNotEmpty())
|
||||
{
|
||||
auto it = new FListMenuItemNativeText(ld->mXpos, 0, 0, gSkillNames[i][0], gSkillNames[i], NIT_BigFont, NIT_ActiveState, 1, NAME_StartGame, i);
|
||||
auto it = new FListMenuItemNativeText(ld->mXpos, y, 0, gSkillNames[i][0], gSkillNames[i], NIT_BigFont, NIT_ActiveState, 1, NAME_StartGame, i);
|
||||
y += ld->mLinespacing;
|
||||
ld->mItems.Push(it);
|
||||
addedSkills++;
|
||||
}
|
||||
|
|
|
@ -99,8 +99,7 @@ void DMessageBoxMenu::Init(DMenu *parent, const char *message, int messagemode,
|
|||
mParentMenu = parent;
|
||||
if (message != NULL)
|
||||
{
|
||||
if (*message == '$') message = GStrings(message+1);
|
||||
mMessage = V_BreakLines(SmallFont, 300, message);
|
||||
mMessage = V_BreakLines(SmallFont, 300, GStrings.localize(message));
|
||||
}
|
||||
mMessageMode = messagemode;
|
||||
if (playsound)
|
||||
|
|
|
@ -70,7 +70,6 @@ int OptionWidth(const char * s)
|
|||
|
||||
void DrawOptionText(int x, int y, int color, const char *text, bool grayed)
|
||||
{
|
||||
text = *text == '$'? GStrings(text+1) : text;
|
||||
PalEntry overlay = grayed? PalEntry(96,48,0,0) : PalEntry(0,0,0);
|
||||
DrawText (&twod, OptionFont(), color, x, y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay);
|
||||
}
|
||||
|
@ -405,7 +404,7 @@ void DOptionMenu::Drawer ()
|
|||
|
||||
if (mDesc->mTitle.IsNotEmpty())
|
||||
{
|
||||
gi->DrawMenuCaption(origin, mDesc->mTitle);
|
||||
gi->DrawMenuCaption(origin, GStrings.localize(mDesc->mTitle));
|
||||
}
|
||||
mDesc->mDrawTop = y;
|
||||
int fontheight = OptionSettings.mLinespacing * CleanYfac_1;
|
||||
|
@ -503,9 +502,7 @@ int FOptionMenuItem::GetIndent()
|
|||
{
|
||||
if (mCentered) return 0;
|
||||
if (screen->GetWidth() < 640) return screen->GetWidth() / 2;
|
||||
const char *label = mLabel;
|
||||
if (*label == '$') label = GStrings(label+1);
|
||||
return OptionWidth(label);
|
||||
return OptionWidth(GStrings.localize(mLabel));
|
||||
}
|
||||
|
||||
void FOptionMenuItem::drawText(int x, int y, int color, const char * text, bool grayed)
|
||||
|
@ -515,9 +512,7 @@ void FOptionMenuItem::drawText(int x, int y, int color, const char * text, bool
|
|||
|
||||
int FOptionMenuItem::drawLabel(int indent, int y, EColorRange color, bool grayed)
|
||||
{
|
||||
const char *label = mLabel;
|
||||
if (*label == '$') label = GStrings(label+1);
|
||||
|
||||
const char *label = GStrings.localize(mLabel);
|
||||
int x;
|
||||
int w = OptionWidth(label) * CleanXfac_1;
|
||||
if (!mCentered) x = indent - w;
|
||||
|
|
|
@ -154,10 +154,8 @@ public:
|
|||
|
||||
bool Activate(FName caller) override
|
||||
{
|
||||
auto msg = mPrompt.IsNotEmpty()? mPrompt.GetChars() : "$SAFEMESSAGE";
|
||||
if (*msg == '$') msg = GStrings(msg+1);
|
||||
auto actionLabel = mLabel.GetChars();
|
||||
if (*actionLabel == '$') actionLabel = GStrings(actionLabel+1);
|
||||
auto msg = GStrings.localize(mPrompt.IsNotEmpty()? mPrompt.GetChars() : "$SAFEMESSAGE");
|
||||
auto actionLabel = GStrings.localize(mLabel.GetChars());
|
||||
|
||||
FStringf FullString("%s%s%s\n\n%s", TEXTCOLOR_WHITE, actionLabel, TEXTCOLOR_NORMAL, msg);
|
||||
M_StartMessage(FullString, 0, mScriptId);
|
||||
|
@ -536,8 +534,7 @@ public:
|
|||
|
||||
int Draw(FOptionMenuDescriptor *desc, int y, int indent, bool selected) override
|
||||
{
|
||||
const char *txt = mCurrent? mAltText.GetChars() : mLabel.GetChars();
|
||||
if (*txt == '$') txt = GStrings(txt + 1);
|
||||
const char *txt = GStrings.localize(mCurrent? mAltText.GetChars() : mLabel.GetChars());
|
||||
int w = OptionWidth(txt) * CleanXfac_1;
|
||||
int x = (screen->GetWidth() - w) / 2;
|
||||
drawText(x, y, mColor, txt);
|
||||
|
|
|
@ -123,6 +123,11 @@ public:
|
|||
//return FStringf("${%.*s}", len, str);
|
||||
return FString(str, len);
|
||||
}
|
||||
|
||||
const char* localize(const char* str)
|
||||
{
|
||||
return *str == '$' ? GetString(str + 1, nullptr) : str;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //__STRINGTABLE_H__
|
||||
|
|
|
@ -148,7 +148,6 @@ static void Menu_DrawTopBar(const DVector2 &origin)
|
|||
static void Menu_DrawTopBarCaption(const char *caption, const DVector2 &origin)
|
||||
{
|
||||
static char t[64];
|
||||
if (*caption == '$') caption = GStrings(caption + 1);
|
||||
size_t const srclen = strlen(caption);
|
||||
size_t const dstlen = min(srclen, ARRAY_SIZE(t)-1);
|
||||
memcpy(t, caption, dstlen);
|
||||
|
@ -240,47 +239,6 @@ static int Menu_GetFontHeight(int fontnum)
|
|||
return font.get_yline();
|
||||
}
|
||||
|
||||
void GameInterface::DrawNativeMenuText(int fontnum, int state, int xpos, int ypos, float fontscale, const char* text, int flags)
|
||||
{
|
||||
int ydim_upper = 0;
|
||||
int ydim_lower = ydim - 1;
|
||||
//int32_t const indent = 0; // not set for any relevant menu
|
||||
int32_t x = xpos;
|
||||
|
||||
uint8_t status = 0;
|
||||
if (state == NIT_SelectedState)
|
||||
status |= MT_Selected;
|
||||
if (state == NIT_InactiveState)
|
||||
status |= MT_Disabled;
|
||||
if (flags & LMF_Centered)
|
||||
status |= MT_XCenter;
|
||||
|
||||
bool const dodraw = true;
|
||||
MenuFont_t& font = fontnum == NIT_BigFont ? MF_Redfont : fontnum == NIT_SmallFont ? MF_Bluefont : MF_Minifont;
|
||||
|
||||
int32_t const height = font.get_yline();
|
||||
status |= MT_YCenter;
|
||||
int32_t const y_internal = ypos + ((height >> 17) << 16);// -menu->scrollPos;
|
||||
|
||||
vec2_t textsize;
|
||||
if (dodraw)
|
||||
textsize = Menu_Text(x, y_internal, &font, text, status, ydim_upper, ydim_lower);
|
||||
|
||||
if (dodraw && (status & MT_Selected) && state != 1)
|
||||
{
|
||||
if (status & MT_XCenter)
|
||||
{
|
||||
Menu_DrawCursorLeft(x + font.cursorCenterPosition, y_internal, font.cursorScale);
|
||||
Menu_DrawCursorRight(x - font.cursorCenterPosition, y_internal, font.cursorScale);
|
||||
}
|
||||
else
|
||||
Menu_DrawCursorLeft(x /*+ indent*/ - font.cursorLeftPosition, y_internal, font.cursorScale);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Implements the native looking menu used for the main menu
|
||||
|
@ -330,7 +288,6 @@ protected:
|
|||
int32_t calculatedentryspacing = 0;
|
||||
int32_t const height = Menu_GetFontHeight(mDesc->mNativeFontNum) >> 16;
|
||||
|
||||
// None of the menus still being supported will hide entries - only decactivate them if not applicable.
|
||||
int32_t totalheight = 0, numvalidentries = mDesc->mItems.Size();
|
||||
|
||||
for (unsigned e = 0; e < mDesc->mItems.Size(); ++e)
|
||||
|
@ -393,7 +350,7 @@ class DukeNewGameCustomSubMenu : public DukeListMenu
|
|||
}
|
||||
};
|
||||
|
||||
class MainMenu : public DukeListMenu
|
||||
class DukeMainMenu : public DukeListMenu
|
||||
{
|
||||
void PreDraw() override
|
||||
{
|
||||
|
@ -413,6 +370,44 @@ class MainMenu : public DukeListMenu
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void GameInterface::DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags)
|
||||
{
|
||||
int ydim_upper = 0;
|
||||
int ydim_lower = ydim - 1;
|
||||
//int32_t const indent = 0; // not set for any relevant menu
|
||||
int x = int(xpos * 65536);
|
||||
|
||||
uint8_t status = 0;
|
||||
if (state == NIT_SelectedState)
|
||||
status |= MT_Selected;
|
||||
if (state == NIT_InactiveState)
|
||||
status |= MT_Disabled;
|
||||
if (flags & LMF_Centered)
|
||||
status |= MT_XCenter;
|
||||
|
||||
bool const dodraw = true;
|
||||
MenuFont_t& font = fontnum == NIT_BigFont ? MF_Redfont : fontnum == NIT_SmallFont ? MF_Bluefont : MF_Minifont;
|
||||
|
||||
int32_t const height = font.get_yline();
|
||||
status |= MT_YCenter;
|
||||
int32_t const y_internal = ypos + ((height >> 17) << 16);// -menu->scrollPos;
|
||||
|
||||
vec2_t textsize;
|
||||
if (dodraw)
|
||||
textsize = Menu_Text(x, y_internal, &font, text, status, ydim_upper, ydim_lower);
|
||||
|
||||
if (dodraw && (status & MT_Selected) && state != 1)
|
||||
{
|
||||
if (status & MT_XCenter)
|
||||
{
|
||||
Menu_DrawCursorLeft(x + font.cursorCenterPosition, y_internal, font.cursorScale);
|
||||
Menu_DrawCursorRight(x - font.cursorCenterPosition, y_internal, font.cursorScale);
|
||||
}
|
||||
else
|
||||
Menu_DrawCursorLeft(x /*+ indent*/ - font.cursorLeftPosition, y_internal, font.cursorScale);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GameInterface::MenuOpened()
|
||||
{
|
||||
|
@ -722,7 +717,7 @@ END_DUKE_NS
|
|||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
static TMenuClassDescriptor<Duke::MainMenu> _mm("Duke.MainMenu");
|
||||
static TMenuClassDescriptor<Duke::DukeMainMenu> _mm("Duke.MainMenu");
|
||||
static TMenuClassDescriptor<Duke::DukeListMenu> _lm("Duke.ListMenu");
|
||||
static TMenuClassDescriptor<Duke::DukeNewGameCustomSubMenu> _ngcsm("Duke.NewGameCustomSubMenu");
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ struct GameInterface : ::GameInterface
|
|||
GameStats getStats() override;
|
||||
// Access to the front end specific menu code. Use is restricted to the main menu, the ingame menu and the skill/episode selection.
|
||||
// Everything else is either custom screens or will use the generic option menu style.
|
||||
void DrawNativeMenuText(int fontnum, int state, int xpos, int ypos, float fontscale, const char* text, int orientation) override;
|
||||
void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int orientation) override;
|
||||
void MenuOpened() override;
|
||||
void MenuClosed() override;
|
||||
void MenuSound(EMenuSounds snd) override;
|
||||
|
|
|
@ -469,7 +469,6 @@ vec2_t G_ScreenText(const int32_t font,
|
|||
int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f,
|
||||
const int32_t x1, const int32_t y1, const int32_t x2, const int32_t y2)
|
||||
{
|
||||
if (*str == '$') str = GStrings(str + 1);
|
||||
vec2_t size = { 0, 0, }; // eventually the return value
|
||||
vec2_t origin = { 0, 0, }; // where to start, depending on the alignment
|
||||
vec2_t pos = { 0, 0, }; // holds the coordinate position as we draw each character tile of the string
|
||||
|
|
|
@ -151,7 +151,6 @@ static void Menu_DrawTopBar(const DVector2 &origin)
|
|||
static void Menu_DrawTopBarCaption(const char* caption, const DVector2& origin)
|
||||
{
|
||||
static char t[64];
|
||||
if (*caption == '$') caption = GStrings(caption + 1);
|
||||
size_t const srclen = strlen(caption);
|
||||
size_t const dstlen = min(srclen, ARRAY_SIZE(t) - 1);
|
||||
memcpy(t, caption, dstlen);
|
||||
|
@ -231,47 +230,6 @@ static int Menu_GetFontHeight(int fontnum)
|
|||
return font.get_yline();
|
||||
}
|
||||
|
||||
void GameInterface::DrawNativeMenuText(int fontnum, int state, int xpos, int ypos, float fontscale, const char* text, int flags)
|
||||
{
|
||||
int ydim_upper = 0;
|
||||
int ydim_lower = ydim - 1;
|
||||
//int32_t const indent = 0; // not set for any relevant menu
|
||||
int32_t x = xpos;
|
||||
|
||||
uint8_t status = 0;
|
||||
if (state == NIT_SelectedState)
|
||||
status |= MT_Selected;
|
||||
if (state == NIT_InactiveState)
|
||||
status |= MT_Disabled;
|
||||
if (flags & LMF_Centered)
|
||||
status |= MT_XCenter;
|
||||
|
||||
bool const dodraw = true;
|
||||
MenuFont_t& font = fontnum == NIT_BigFont ? MF_Redfont : fontnum == NIT_SmallFont ? MF_Bluefont : MF_Minifont;
|
||||
|
||||
int32_t const height = font.get_yline();
|
||||
status |= MT_YCenter;
|
||||
int32_t const y_internal = ypos + ((height >> 17) << 16);// -menu->scrollPos;
|
||||
|
||||
vec2_t textsize;
|
||||
if (dodraw)
|
||||
textsize = Menu_Text(x, y_internal, &font, text, status, ydim_upper, ydim_lower);
|
||||
|
||||
if (dodraw && (status & MT_Selected) && state != 1)
|
||||
{
|
||||
if (status & MT_XCenter)
|
||||
{
|
||||
Menu_DrawCursorLeft(x + font.cursorCenterPosition, y_internal, font.cursorScale);
|
||||
Menu_DrawCursorRight(x - font.cursorCenterPosition, y_internal, font.cursorScale);
|
||||
}
|
||||
else
|
||||
Menu_DrawCursorLeft(x /*+ indent*/ - font.cursorLeftPosition, y_internal, font.cursorScale);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Implements the native looking menu used for the main menu
|
||||
|
@ -323,7 +281,7 @@ protected:
|
|||
}
|
||||
};
|
||||
|
||||
class MainMenu : public RedneckListMenu
|
||||
class RedneckMainMenu : public RedneckListMenu
|
||||
{
|
||||
void PreDraw() override
|
||||
{
|
||||
|
@ -341,6 +299,45 @@ class MainMenu : public RedneckListMenu
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void GameInterface::DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags)
|
||||
{
|
||||
int ydim_upper = 0;
|
||||
int ydim_lower = ydim - 1;
|
||||
//int32_t const indent = 0; // not set for any relevant menu
|
||||
int x = int(xpos * 65536 * 6);
|
||||
|
||||
uint8_t status = 0;
|
||||
if (state == NIT_SelectedState)
|
||||
status |= MT_Selected;
|
||||
if (state == NIT_InactiveState)
|
||||
status |= MT_Disabled;
|
||||
if (flags & LMF_Centered)
|
||||
status |= MT_XCenter;
|
||||
|
||||
bool const dodraw = true;
|
||||
MenuFont_t& font = fontnum == NIT_BigFont ? MF_Redfont : fontnum == NIT_SmallFont ? MF_Bluefont : MF_Minifont;
|
||||
|
||||
int32_t const height = font.get_yline();
|
||||
status |= MT_YCenter;
|
||||
int32_t const y_internal = int(ypos * 65536) + ((height >> 17) << 16);// -menu->scrollPos;
|
||||
|
||||
vec2_t textsize;
|
||||
if (dodraw)
|
||||
textsize = Menu_Text(x, y_internal, &font, text, status, ydim_upper, ydim_lower);
|
||||
|
||||
if (dodraw && (status & MT_Selected) && state != 1)
|
||||
{
|
||||
if (status & MT_XCenter)
|
||||
{
|
||||
Menu_DrawCursorLeft(x + font.cursorCenterPosition, y_internal, font.cursorScale);
|
||||
Menu_DrawCursorRight(x - font.cursorCenterPosition, y_internal, font.cursorScale);
|
||||
}
|
||||
else
|
||||
Menu_DrawCursorLeft(x /*+ indent*/ - font.cursorLeftPosition, y_internal, font.cursorScale);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GameInterface::MenuOpened()
|
||||
{
|
||||
|
@ -487,7 +484,7 @@ END_RR_NS
|
|||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
static TMenuClassDescriptor<Redneck::MainMenu> _mm("Redneck.MainMenu");
|
||||
static TMenuClassDescriptor<Redneck::RedneckMainMenu> _mm("Redneck.MainMenu");
|
||||
static TMenuClassDescriptor<Redneck::RedneckListMenu> _lm("Redneck.ListMenu");
|
||||
|
||||
void RegisterRedneckMenus()
|
||||
|
|
|
@ -157,7 +157,7 @@ struct GameInterface : ::GameInterface
|
|||
void set_hud_scale(int size) override;
|
||||
FString statFPS() override;
|
||||
GameStats getStats() override;
|
||||
void DrawNativeMenuText(int fontnum, int state, int xpos, int ypos, float fontscale, const char* text, int flags);
|
||||
void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags);
|
||||
void MenuOpened() override;
|
||||
void MenuSound(EMenuSounds snd) override;
|
||||
void MenuClosed() override;
|
||||
|
|
|
@ -468,7 +468,6 @@ vec2_t G_ScreenText(const int32_t font,
|
|||
int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f,
|
||||
const int32_t x1, const int32_t y1, const int32_t x2, const int32_t y2)
|
||||
{
|
||||
if (*str == '$') str = GStrings(str + 1);
|
||||
vec2_t size = { 0, 0, }; // eventually the return value
|
||||
vec2_t origin = { 0, 0, }; // where to start, depending on the alignment
|
||||
vec2_t pos = { 0, 0, }; // holds the coordinate position as we draw each character tile of the string
|
||||
|
|
|
@ -8,32 +8,18 @@ Save Game,MNU_SAVEGAME,,,,Uložit hru,Spiel sichern,,Konservi Ludon,Guardar Part
|
|||
Help,MNU_HELP,,,,,Hilfe,,,,,,Aide,,,,,,,,,,,
|
||||
Continue,MNU_CONTINUE,,,,,Fortfahren,,,,,,,,,,,,,,,,,
|
||||
Credits,MNU_CREDITS,,,,,,,,,,,,,,,,,,,,,,
|
||||
Cool Stuff,MNU_COOLSTUFF,,,,,Cooles Zeug,,,,,,,,,,,,,,,,,
|
||||
Cool Stuff,MNU_COOLSTUFF,Was removed,,,,Cooles Zeug,,,,,,,,,,,,,,,,,
|
||||
Multiplayer,MNU_MULTIPLAYER,,,,,Mehrspieler,,,,,,,,,,,,,,,,,
|
||||
End Game,MNU_ENDGAME,,,,,Spiel beenden,,,,,,,,,,,,,,,,,
|
||||
User Map,MNU_USERMAP,,,,,Benutzerlevel,,,,,,,,,,,,,,,,,
|
||||
Select a user map to play,MNU_SELECTUSERMAP,,,,,"Wähle ein Level zum Spielen
|
||||
",,,,,,,,,,,,,,,,,
|
||||
Select an Episode,MNU_SELECTEPISODE,,,,,"Welche Episode?
|
||||
Select an Episode,MNU_SELECTEPISODE,DN3D et.al.,,,,"Welche Episode?
|
||||
",,,,,,,,,,,,,,,,,
|
||||
Select Skill,MNU_SELECTSKILL,,,,,Schwierigkeitsgrad,,,,,,,,,,,,,,,,,
|
||||
Episodes,MNU_EPISODES,Blood,,,,Episoden,,,,,,,,,,,,,,,,,
|
||||
Select Skill,MNU_SELECTSKILL,DN3D et.al.,,,,Schwierigkeitsgrad,,,,,,,,,,,,,,,,,
|
||||
Difficulty,MBU_DIFFICULTY,Blood,,,,Schwierigkeitsgrad,,,,,,,,,,,,,,,,,
|
||||
About Demolition,MNU_ENGINECREDITS,,,,,Über Demolition,,,,,,,,,,,,,,,,,
|
||||
No Picture,MNU_NOPICTURE,,,,Bez obrázku,Kein Bild,,Neniu Bildo,Sin Imagen,,Ei kuvaa,Pas d'image,,Nessuna immagine,画像無し,사진 없음,Geen beeld,Brak obrazka,Sem imagem,,,"Нет
|
||||
изображения",Нема слике
|
||||
"Different
|
||||
Version",MNU_DIFFVERSION,,,,Jiná verze,Falsche Version,,Malsama Versio,Versión Diferente,,Eri versio,"Version
|
||||
Différente",,Versione differente,"別バージョンの
|
||||
データ",다른 버젼,Anders Versie,"Inna
|
||||
Wersja","Versão
|
||||
Diferente",,,"Другая
|
||||
версия",Другачија верзија
|
||||
No files,MNU_NOFILES,,,,Žádné soubory,Keine Dateien,,Neniuj dosieroj,Sin archivos,,Ei tiedostoja,Pas de fichiers,,Nessun file,ファイル無し,파일 없음,Geen bestanden,Brak plików,Vazio,,,Нет файлов,Нема фајлова
|
||||
"Do you really want to delete the savegame
|
||||
",MNU_DELETESG,,,,Opravdu chceš smazat tuto uloženou hru?,Willst du diesen Spielstand wirklich löschen?,,Ĉu vi vere volas forviŝi la konservan ludon?,"¿Realmente deseas eliminar la partida?
|
||||
",,Haluatko varmasti poistaa tallennetun pelin ,"Voulez vous vraiment effacer cette sauvegarde?
|
||||
",Biztos ki akarod törölni a mentést?,Vuoi veramente rimuovere il salvataggio,本当にこのセーブを消すのか?,저장된 게임을 정말로 삭제하시겠습니까?,Wil je echt de opgeslagen spel verwijderen?,Czy naprawdę chcesz usunąć zapis gry,"Deseja mesmo deletar o jogo salvo
|
||||
",Deseja mesmo apagar o jogo,,"Вы действительно хотите удалить сохранение
|
||||
",Да ли стварно желите да избришете сачувану игру
|
||||
Press Y or N.,PRESSYN,,,,Stiskni Y nebo N.,Drücke Y oder N.,"Πάτα Y ή N
|
||||
",Premu Y aŭ N.,Presiona Y ó N.,,Paina Y tai N.,Appuyez sur Y ou N.,Nyomj Y-t vagy N-t.,Premi Y oppure N.,YかNで答えろ,Y키 또는 N키를 누르시오.,Druk op Y of N.,Wciśnij Y lub N.,Aperte Y ou N.,Carrega Y ou N.,,Нажмите Y или N.,Притисните Y или N.
|
||||
"You can't save if you aren't playing!
|
||||
|
@ -210,4 +196,22 @@ Empty slot,EMPTYSTRING,,,,Prázdný slot,nicht belegt,,Malplena Ingo,Ranura Vac
|
|||
<New Save Game>,NEWSAVE,,,,<Nová uložená hra>,<Neuer Spielstand>,,<Novan Konservita Ludo>,<Nueva Partida Guardada>,,<Uusi tallennettu peli>,<Nouveau Fichier de Sauvegarde>,<Új mentés>,<Nuovo Salvataggio>,<新規セーブ>,<새로운 게임 저장>,<Nieuw sparen spel>,<Nowy zapis gry>,<Novo jogo salvo>,<Novo jogo gravado>,,<Новое сохранение>,<Нова сачувана игра>
|
||||
Game saved.,GGSAVED,,,,Hra uložena.,Spielstand gespeichert.,,Ludo konservita.,Partida guardada.,,Peli tallennettu.,Partie sauvegardée.,Játék mentve.,Gioco salvato.,セーブ完了。,게임이 저장됨.,Spel opgeslagen.,Gra zapisana.,Jogo salvo.,Jogo gravado.,,Игра сохранена.,Игра сачувана.
|
||||
Time,SAVECOMMENT_TIME,,,,Čas,Zeit,,Tempo,Tiempo,,Aika,Temps,Idő,Tempo,"時間
|
||||
",시간,Tijd,Czas,Tempo,,,Время,Време
|
||||
",시간,Tijd,Czas,Tempo,,,Время,Време
|
||||
Load Game,MNU_LOADGAME,,,,Načíst hru,Spiel laden,,Ŝarĝi Ludon,Cargar Partida,,Lataa peli,Chargement,,Carica gioco,ロード,게임 불러오기,Laden spel,Wczytaj Grę,Carregar,,,Загрузка,Учитај игру
|
||||
Save Game,MNU_SAVEGAME,,,,Uložit hru,Spiel sichern,,Konservi Ludon,Guardar Partida,,Tallenna peli,Sauvegarde,,Salva gioco,セーブ,게임 저장하기,Opslaan spel,Zapisz Grę,Salvar,Gravar,,Сохранение,Сачувај игру
|
||||
No Picture,MNU_NOPICTURE,,,,Bez obrázku,Kein Bild,,Neniu Bildo,Sin Imagen,,Ei kuvaa,Pas d'image,,Nessuna immagine,画像無し,사진 없음,Geen beeld,Brak obrazka,Sem imagem,,,"Нет
|
||||
изображения",Нема слике
|
||||
"Different
|
||||
Version",MNU_DIFFVERSION,,,,Jiná verze,Falsche Version,,Malsama Versio,Versión Diferente,,Eri versio,"Version
|
||||
Différente",,Versione differente,"別バージョンの
|
||||
データ",다른 버젼,Anders Versie,"Inna
|
||||
Wersja","Versão
|
||||
Diferente",,,"Другая
|
||||
версия",Другачија верзија
|
||||
No files,MNU_NOFILES,,,,Žádné soubory,Keine Dateien,,Neniuj dosieroj,Sin archivos,,Ei tiedostoja,Pas de fichiers,,Nessun file,ファイル無し,파일 없음,Geen bestanden,Brak plików,Vazio,,,Нет файлов,Нема фајлова
|
||||
"Do you really want to delete the savegame
|
||||
",MNU_DELETESG,,,,Opravdu chceš smazat tuto uloženou hru?,Willst du diesen Spielstand wirklich löschen?,,Ĉu vi vere volas forviŝi la konservan ludon?,"¿Realmente deseas eliminar la partida?
|
||||
",,Haluatko varmasti poistaa tallennetun pelin ,"Voulez vous vraiment effacer cette sauvegarde?
|
||||
",Biztos ki akarod törölni a mentést?,Vuoi veramente rimuovere il salvataggio,本当にこのセーブを消すのか?,저장된 게임을 정말로 삭제하시겠습니까?,Wil je echt de opgeslagen spel verwijderen?,Czy naprawdę chcesz usunąć zapis gry,"Deseja mesmo deletar o jogo salvo
|
||||
",Deseja mesmo apagar o jogo,,"Вы действительно хотите удалить сохранение
|
||||
",Да ли стварно желите да избришете сачувану игру
|
|
|
@ -29,7 +29,7 @@ LISTMENU "MainMenu"
|
|||
class "Redneck.MainMenu"
|
||||
}
|
||||
NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
|
||||
//NativeTextItem "$MNU_NEWGAME", "m", "MultiMenu" // In EDuke this replaces "New Game" when in networking mode. Kept here as a reminder (I'm not going to support EDuke's C/S implementation)
|
||||
//NativeTextItem "$MNU_NEWGAME", "m", "MultiMenu" // In EDuke this replaces "New Game" when in networking mode. Kept here as a reminder.
|
||||
ifgame(fury)
|
||||
{
|
||||
NativeTextItem "$MNU_CONTINUE", "l", "LoadGameMenu"
|
||||
|
@ -45,6 +45,11 @@ LISTMENU "MainMenu"
|
|||
}
|
||||
ifgame(Blood)
|
||||
{
|
||||
position 160, 45, 150
|
||||
caption "Blood"
|
||||
class "Blood.ListMenu"
|
||||
centermenu
|
||||
Linespacing 20
|
||||
NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
|
||||
NativeTextItem "$MNU_MULTIPLAYER", "m", "MultiMenu"
|
||||
NativeTextItem "$MNU_OPTIONS", "o", "OptionsMenu"
|
||||
|
@ -105,7 +110,11 @@ LISTMENU "IngameMenu"
|
|||
}
|
||||
ifgame(Blood)
|
||||
{
|
||||
linespacing 15
|
||||
position 160, 45, 150
|
||||
caption "Blood"
|
||||
class "Blood.ListMenu"
|
||||
centermenu
|
||||
Linespacing 17
|
||||
NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
|
||||
NativeTextItem "$MNU_MULTIPLAYER", "m", "MultiMenu"
|
||||
NativeTextItem "$MNU_OPTIONS", "o", "OptionsMenu"
|
||||
|
@ -150,6 +159,14 @@ LISTMENU "EpisodeMenu"
|
|||
class "Redneck.ListMenu"
|
||||
}
|
||||
}
|
||||
ifgame(blood)
|
||||
{
|
||||
caption "$MNU_EPISODES"
|
||||
position 160, 45, 150
|
||||
class "Blood.ListMenu"
|
||||
centermenu
|
||||
Linespacing 20
|
||||
}
|
||||
ScriptId 100
|
||||
}
|
||||
|
||||
|
@ -180,6 +197,14 @@ LISTMENU "SkillMenu"
|
|||
}
|
||||
animatedtransition
|
||||
}
|
||||
ifgame(blood)
|
||||
{
|
||||
caption "$MNU_DIFFICULTY"
|
||||
position 160, 60, 150
|
||||
class "Blood.ListMenu"
|
||||
centermenu
|
||||
Linespacing 20
|
||||
}
|
||||
ScriptId 110
|
||||
}
|
||||
|
||||
|
@ -349,10 +374,17 @@ LISTMENU "MultiMenu"
|
|||
class "Redneck.ListMenu"
|
||||
}
|
||||
animatedtransition
|
||||
NativeTextItem "$MNU_PLAYERSETUP", "p", "PlayerSetupMenu"
|
||||
}
|
||||
ifgame(blood)
|
||||
{
|
||||
position 160, 80, 150
|
||||
class "Blood.ListMenu"
|
||||
centermenu
|
||||
Linespacing 20
|
||||
}
|
||||
|
||||
Caption "$MNU_NETWORKGAME"
|
||||
NativeTextItem "$MNU_PLAYERSETUP", "p", "PlayerSetupMenu"
|
||||
NativeTextItem "$MNU_JOINGAME", "j", "JoinGameMenu"
|
||||
NativeTextItem "$MNU_HOSTGAME", "h", "HostGameMenu"
|
||||
}
|
||||
|
@ -382,9 +414,12 @@ ImageScroller "HelpMenu"
|
|||
}
|
||||
ifgame(blood)
|
||||
{
|
||||
// The duplication here is to integrate the alternating versions of HELP3
|
||||
QAVAnimationItem "Help4"
|
||||
QAVAnimationItem "Help5"
|
||||
QAVAnimationItem "Help3"
|
||||
QAVAnimationItem "Help4"
|
||||
QAVAnimationItem "Help5"
|
||||
QAVAnimationItem "Help3b"
|
||||
}
|
||||
ifgame(ShadowWarrior)
|
||||
|
|
Loading…
Reference in a new issue