- added all needed parts of Witchaven's native looking menu.

This isn't particularly faithful, though, neither with DOS nor GDX because both menus have UX issues.

Main menu items reflect what a modern engine needs, not what DOS had.
The hi-res menu background is not being used because it forces the entire menu into the upper left corner.
The original game had the difficulty only as a setting on the "gore" page and could not start the game from there. This has been changed to a more traditional skill menu.
The only other part that has been ported over is the help screens.
This commit is contained in:
Christoph Oelckers 2020-10-28 23:11:45 +01:00
parent 45d2fd95a9
commit c77a072628
2 changed files with 76 additions and 42 deletions

View file

@ -72,9 +72,10 @@ LISTMENU "MainMenu"
position 213, 60 position 213, 60
Linespacing 18 Linespacing 18
WH1TextItem "$MNU_NEWGAME", "n", "SkillMenu" WH1TextItem "$MNU_NEWGAME", "n", "SkillMenu"
WH1TextItem "$MNU_MULTIPLAYER", "m", "MultiMenu" //WH1TextItem "$MNU_MULTIPLAYER", "m", "MultiMenu"
WH1TextItem "$MNU_OPTIONS", "o", "OptionsMenu" WH1TextItem "$MNU_OPTIONS", "o", "OptionsMenu"
WH1TextItem "$MNU_LOADGAME", "l", "LoadGameMenu" WH1TextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
WH1TextItem "$MNU_Help", "l", "HelpMenu"
WH1TextItem "$MNU_QUITGAME", "q", "QuitMenu" WH1TextItem "$MNU_QUITGAME", "q", "QuitMenu"
} }
/* /*
@ -83,9 +84,10 @@ LISTMENU "MainMenu"
position 160, 50 position 160, 50
Linespacing 14 Linespacing 14
WH2TextItem "$MNU_NEWGAME", "n", "SkillMenu" WH2TextItem "$MNU_NEWGAME", "n", "SkillMenu"
WH2TextItem "$MNU_MULTIPLAYER", "m", "MultiMenu" //WH2TextItem "$MNU_MULTIPLAYER", "m", "MultiMenu"
WH2TextItem "$MNU_OPTIONS", "o", "OptionsMenu" WH2TextItem "$MNU_OPTIONS", "o", "OptionsMenu"
WH2TextItem "$MNU_LOADGAME", "l", "LoadGameMenu" WH2TextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
WH2TextItem "$MNU_Help", "l", "HelpMenu"
WH2TextItem "$MNU_QUITGAME", "q", "QuitMenu" WH2TextItem "$MNU_QUITGAME", "q", "QuitMenu"
} }
*/ */
@ -237,13 +239,18 @@ LISTMENU "SkillMenu"
Position 35, 32 Position 35, 32
Linespacing 17 Linespacing 17
} }
/*
ifgame(Witchaven) ifgame(Witchaven)
{ {
CaptionItem "$MNU_DIFFICULTY" CaptionItem "$MNU_DIFFICULTY"
Position 35, 32 position 130, 50
Linespacing 17 Linespacing 16
WH1SkillItem "#00510", "$SKILL_EASY", "e", "StartGame 0"
WH1SkillItem "#00511", "$SKILL_NORMAL", "m", "StartGame 1"
WH1SkillItem "#00512", "$SKILL_HARD", "h", "StartGame 2"
WH1SkillItem "#00513", "$SKILL_VERY_HARD", "v", "StartGame 3"
} }
/*
ifgame(Witchaven2) ifgame(Witchaven2)
{ {
CaptionItem "$MNU_DIFFICULTY" CaptionItem "$MNU_DIFFICULTY"
@ -297,8 +304,22 @@ ImageScroller "HelpMenu"
ImageItem "TileBMGLogo" ImageItem "TileBMGLogo"
ImageItem "TilePIELogo" ImageItem "TilePIELogo"
} }
ifgame(Witchaven)
{
ImageItem "#01793" //WEAPONS"
ImageItem "#01791" // SPELLS"
ImageItem "#01790" // POTIONS"
ImageItem "#01792" // WALKING"
ImageItem "#01788" // FLYING"
ImageItem "#01784" // CREDIT1"
ImageItem "#01785" // CREDIT2"
ImageItem "#01786" // CREDIT3"
ImageItem "#01787" // CREDIT4"
ImageItem "#02691" // BETAPAGE"
}
} }
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
// //
// Credits menu. This is logically highly game specific. // Credits menu. This is logically highly game specific.

View file

@ -3,59 +3,29 @@ class WHMenuDelegate : RazeMenuDelegate
{ {
override int DrawCaption(String title, Font fnt, int y, bool drawit) override int DrawCaption(String title, Font fnt, int y, bool drawit)
{ {
/*
let font = generic_ui? NewConsoleFont : BigFont; // this ignores the passed font intentionally. let font = generic_ui? NewConsoleFont : BigFont; // this ignores the passed font intentionally.
let texid = TexMan.CheckForTexture("MENUBAR");
let texsize = TexMan.GetScaledSize(texid);
let fonth = font.GetGlyphHeight("A"); let fonth = font.GetGlyphHeight("A");
let fontscale = 1.; let fontscale = 0.7;
double squash = 1.0;
if (drawit) if (drawit)
{ {
int width = font.StringWidth(title) * fontscale; int width = font.StringWidth(title) * fontscale;
double scalex = 1.; if (width > 315)
if (texid.isValid())
{ {
if (texsize.X - 60 < width) squash = 315. / width;
{ width = 315;
// First start squashing the font down to 0.7x the original width.
fontscale = (texsize.X - 66) / width;
if (fontscale < 0.7)
{
// If that is not enough, extend the box.
fontscale = 0.7;
width *= 0.7;
scalex = width / (texsize.X - 66);
}
else width *= fontscale;
}
screen.DrawTexture(texid, false, 160, 15, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_CenterOffsetRel, true, DTA_ScaleX, scalex);
} }
screen.DrawText(font, Font.CR_UNTRANSLATED, 160 - width / 2, 17 - fonth / 2, title, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_ScaleX, fontscale); screen.DrawText(font, Font.CR_UNTRANSLATED, 160 - width / 2, 17 - fonth / 2, title, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_ScaleX, fontscale * squash, DTA_ScaleY, fontscale);
} }
double fx, fy, fw, fh; double fx, fy, fw, fh;
[fx, fy, fw, fh] = Screen.GetFullscreenRect(320, 200, FSMode_ScaleToFit43Top); [fx, fy, fw, fh] = Screen.GetFullscreenRect(320, 200, FSMode_ScaleToFit43Top);
int h = texid.isValid()? texsize.Y : fonth; int h = fonth * 0.8;
return int((y+h) * fh / 200); // This must be the covered height of the header in true pixels. return int((y+h) * fh / 200); // This must be the covered height of the header in true pixels.
*/
return y; return y;
} }
override bool DrawSelector(ListMenuDescriptor desc) override bool DrawSelector(ListMenuDescriptor desc)
{ {
/*
let item = desc.mItems[desc.mSelectedItem];
let x = item.GetX();
let y = item.GetY();
let tex = TexMan.CheckForTexture("YINYANG");
x -= TexMan.GetSize(tex) / 4 + 2;
y += 4;
Screen.DrawTexture(tex, true, x, y, DTA_FullscreenScale, FSMode_Fit320x200,
DTA_CenterOffset, true, DTA_Color, 0xfff0f0f0, DTA_ScaleX, 0.5, DTA_ScaleY, 0.5);
*/
return true; return true;
} }
} }
@ -139,3 +109,46 @@ class ListMenuItemWH1TextItem : ListMenuItemTextItem
} }
} }
//=============================================================================
//
// text item
//
//=============================================================================
class ListMenuItemWH1SkillItem : ListMenuItemTextItem
{
TextureID skull;
void Init(ListMenuDescriptor desc, String icon, String text, String hotkey, Name child, int param = 0)
{
Super.Init(desc, text, hotkey, child, param);
skull = TexMan.CheckForTexture(icon);
}
override void Draw(bool selected, ListMenuDescriptor desc)
{
let gamefont = generic_ui ? NewSmallFont : BigFont;
int cr = generic_ui? Font.CR_Fire : Font.CR_UNDEFINED;
double scalex = 1.;
int trans = 0;
Color colr = Color(255, 255, 255, 255);
let fontscale = 0.7;
if (gamefont == NewSmallFont)
{
if (selected) cr = Font.CR_GREEN;
}
else
{
if (selected) trans = Translation.MakeID(Translation_Remap, 20);
}
if (selected)
{
int mclock = MSTime() * 120 / 1000;
int light = 223 + (Build.calcSinTableValue(mclock<<4) / 512.);
colr = Color(255, light, light, light);
}
screen.DrawTexture(skull, false, mXpos - 15, mYpos + 10, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_CenterOffsetRel, true, DTA_ScaleX, 0.6, DTA_ScaleY, 0.6, DTA_Alpha, selected? 1.0 : 0.5);
Screen.DrawText(BigFont, cr, mXpos, mYpos, mText, DTA_FullscreenScale, FSMode_Fit320x200, DTA_Color, colr, DTA_TranslationIndex, trans, DTA_ScaleX, scalex * fontscale, DTA_ScaleY, fontscale);
}
}