mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- changed menu scale to better fit the screen size and added some coordinate tweaking for the episode menu to shift long names to the left.
This commit is contained in:
parent
8dc7190fb3
commit
f2d1126ff0
2 changed files with 29 additions and 6 deletions
|
@ -47,6 +47,7 @@
|
||||||
#include "i_soundfont.h"
|
#include "i_soundfont.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
|
#include "gstrings.h"
|
||||||
|
|
||||||
|
|
||||||
void ClearSaveGames();
|
void ClearSaveGames();
|
||||||
|
@ -1105,6 +1106,7 @@ void M_StartupEpisodeMenu(FGameStartup *gs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int posx = (int)ld->mXpos;
|
||||||
int posy = (int)ld->mYpos;
|
int posy = (int)ld->mYpos;
|
||||||
int topy = posy;
|
int topy = posy;
|
||||||
|
|
||||||
|
@ -1132,6 +1134,23 @@ void M_StartupEpisodeMenu(FGameStartup *gs)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isOld) ld->mSelectedItem = ld->mItems.Size();
|
if (!isOld) ld->mSelectedItem = ld->mItems.Size();
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < AllEpisodes.Size(); i++)
|
||||||
|
{
|
||||||
|
DMenuItemBase *it = nullptr;
|
||||||
|
if (AllEpisodes[i].mPicName.IsNotEmpty())
|
||||||
|
{
|
||||||
|
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
|
||||||
|
if (AllEpisodes[i].mEpisodeName.IsEmpty() || TexMan.OkForLocalization(tex, AllEpisodes[i].mEpisodeName))
|
||||||
|
continue; // We do not measure patch based entries. They are assumed to fit
|
||||||
|
}
|
||||||
|
const char *c = AllEpisodes[i].mEpisodeName;
|
||||||
|
if (*c == '$') c = GStrings(c + 1);
|
||||||
|
int textwidth = ld->mFont->StringWidth(c);
|
||||||
|
int textright = posx + textwidth;
|
||||||
|
if (posx + textright > 320) posx = std::max(0, 320 - textright);
|
||||||
|
}
|
||||||
|
|
||||||
for(unsigned i = 0; i < AllEpisodes.Size(); i++)
|
for(unsigned i = 0; i < AllEpisodes.Size(); i++)
|
||||||
{
|
{
|
||||||
DMenuItemBase *it = nullptr;
|
DMenuItemBase *it = nullptr;
|
||||||
|
@ -1139,11 +1158,11 @@ void M_StartupEpisodeMenu(FGameStartup *gs)
|
||||||
{
|
{
|
||||||
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
|
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
|
||||||
if (AllEpisodes[i].mEpisodeName.IsEmpty() || TexMan.OkForLocalization(tex, AllEpisodes[i].mEpisodeName))
|
if (AllEpisodes[i].mEpisodeName.IsEmpty() || TexMan.OkForLocalization(tex, AllEpisodes[i].mEpisodeName))
|
||||||
it = CreateListMenuItemPatch(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut, tex, NAME_Skillmenu, i);
|
it = CreateListMenuItemPatch(posx, posy, ld->mLinespacing, AllEpisodes[i].mShortcut, tex, NAME_Skillmenu, i);
|
||||||
}
|
}
|
||||||
if (it == nullptr)
|
if (it == nullptr)
|
||||||
{
|
{
|
||||||
it = CreateListMenuItemText(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
|
it = CreateListMenuItemText(posx, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
|
||||||
AllEpisodes[i].mEpisodeName, ld->mFont, ld->mFontColor, ld->mFontColor2, NAME_Skillmenu, i);
|
AllEpisodes[i].mEpisodeName, ld->mFont, ld->mFontColor, ld->mFontColor2, NAME_Skillmenu, i);
|
||||||
}
|
}
|
||||||
ld->mItems.Push(it);
|
ld->mItems.Push(it);
|
||||||
|
|
|
@ -544,6 +544,14 @@ void V_UpdateModeSize (int width, int height)
|
||||||
// The optimal scale will always be to fit a virtual 640 pixel wide display onto the screen.
|
// The optimal scale will always be to fit a virtual 640 pixel wide display onto the screen.
|
||||||
// Exceptions are made for a few ranges where the available virtual width is > 480.
|
// Exceptions are made for a few ranges where the available virtual width is > 480.
|
||||||
|
|
||||||
|
// This reference size is being used so that on 800x450 (small 16:9) a scale of 2 gets used.
|
||||||
|
|
||||||
|
CleanXfac = std::min(screen->GetWidth() / 400, screen->GetHeight() / 240);
|
||||||
|
if (CleanXfac >= 4) CleanXfac--; // Otherwise we do not have enough space for the episode/skill menus in some languages.
|
||||||
|
CleanYfac = CleanXfac;
|
||||||
|
CleanWidth = screen->GetWidth() / CleanXfac;
|
||||||
|
CleanHeight = screen->GetHeight() / CleanYfac;
|
||||||
|
|
||||||
int w = screen->GetWidth();
|
int w = screen->GetWidth();
|
||||||
int factor;
|
int factor;
|
||||||
if (w < 640) factor = 1;
|
if (w < 640) factor = 1;
|
||||||
|
@ -551,10 +559,6 @@ void V_UpdateModeSize (int width, int height)
|
||||||
else if (w >= 1600 && w < 1920) factor = 3;
|
else if (w >= 1600 && w < 1920) factor = 3;
|
||||||
else factor = w / 640;
|
else factor = w / 640;
|
||||||
|
|
||||||
CleanXfac = CleanYfac = factor;
|
|
||||||
CleanWidth = width / CleanXfac;
|
|
||||||
CleanHeight = height / CleanYfac;
|
|
||||||
|
|
||||||
CleanYfac_1 = CleanXfac_1 = MAX(1, int (CleanXfac * 0.7));
|
CleanYfac_1 = CleanXfac_1 = MAX(1, int (CleanXfac * 0.7));
|
||||||
CleanWidth_1 = width / CleanXfac_1;
|
CleanWidth_1 = width / CleanXfac_1;
|
||||||
CleanHeight_1 = height / CleanYfac_1;
|
CleanHeight_1 = height / CleanYfac_1;
|
||||||
|
|
Loading…
Reference in a new issue