mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-18 09:41:06 +00:00
- implemented the WH2 menu.
This is a rather liberal reinterpretation because the original assets are unusable (text as graphics with baked-in highlights) and the highlight graphics used by GDX are too ugly for serious consideration. As a result this highlights the font like the first Witchaven, i.e. coloring it green.
This commit is contained in:
parent
0a03331400
commit
453e273d0c
8 changed files with 142 additions and 14 deletions
|
@ -0,0 +1 @@
|
|||
Kerning 1
|
Binary file not shown.
Before Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 20 KiB |
|
@ -78,11 +78,10 @@ LISTMENU "MainMenu"
|
|||
WH1TextItem "$MNU_Help", "l", "HelpMenu"
|
||||
WH1TextItem "$MNU_QUITGAME", "q", "QuitMenu"
|
||||
}
|
||||
/*
|
||||
ifgame(Witchaven2)
|
||||
{
|
||||
position 160, 50
|
||||
Linespacing 14
|
||||
position 160, 35
|
||||
Linespacing 22
|
||||
WH2TextItem "$MNU_NEWGAME", "n", "SkillMenu"
|
||||
//WH2TextItem "$MNU_MULTIPLAYER", "m", "MultiMenu"
|
||||
WH2TextItem "$MNU_OPTIONS", "o", "OptionsMenu"
|
||||
|
@ -90,7 +89,6 @@ LISTMENU "MainMenu"
|
|||
WH2TextItem "$MNU_Help", "l", "HelpMenu"
|
||||
WH2TextItem "$MNU_QUITGAME", "q", "QuitMenu"
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
@ -172,19 +170,17 @@ LISTMENU "IngameMenu"
|
|||
WH1TextItem "$MNU_ENDGAME", "e", "EndgameMenu"
|
||||
WH1TextItem "$MNU_QUITGAME", "q", "QuitMenu"
|
||||
}
|
||||
/*
|
||||
ifgame(Witchaven2)
|
||||
{
|
||||
position 160, 50
|
||||
Linespacing 15
|
||||
position 160, 40
|
||||
Linespacing 22
|
||||
WH2TextItem "$MNU_NEWGAME", "n", "SkillMenu"
|
||||
WH2TextItem "$MNU_OPTIONS", "o", "OptionsMenu"
|
||||
WH2TextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
|
||||
WH2TextItem "$MNU_SAVEGAME", "s", "SaveGameMenu"
|
||||
WH2TextItem "$MNU_ENDGAME", "e", ""EndgameMenu"
|
||||
WH2TextItem "$MNU_ENDGAME", "e", "EndgameMenu"
|
||||
WH2TextItem "$MNU_QUITGAME", "q", "QuitMenu"
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
@ -250,14 +246,16 @@ LISTMENU "SkillMenu"
|
|||
WH1SkillItem "#00512", "$SKILL_HARD", "h", "StartGame 2"
|
||||
WH1SkillItem "#00513", "$SKILL_VERY_HARD", "v", "StartGame 3"
|
||||
}
|
||||
/*
|
||||
ifgame(Witchaven2)
|
||||
{
|
||||
CaptionItem "$MNU_DIFFICULTY"
|
||||
Position 35, 32
|
||||
Linespacing 17
|
||||
Position 120, 40
|
||||
Linespacing 22
|
||||
WH2SkillItem "#00510", "$SKILL_EASY", "e", "StartGame 0"
|
||||
WH2SkillItem "#00511", "$SKILL_NORMAL", "m", "StartGame 1"
|
||||
WH2SkillItem "#00512", "$SKILL_HARD", "h", "StartGame 2"
|
||||
WH2SkillItem "#00513", "$SKILL_VERY_HARD", "v", "StartGame 3"
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
@ -317,9 +315,21 @@ ImageScroller "HelpMenu"
|
|||
ImageItem "#01787" // CREDIT4"
|
||||
ImageItem "#02691" // BETAPAGE"
|
||||
}
|
||||
ifgame(Witchaven2)
|
||||
{
|
||||
ImageItem "#01064" //WEAPONS"
|
||||
ImageItem "#01063" // SPELLS"
|
||||
ImageItem "#01060" // POTIONS"
|
||||
ImageItem "#01059" // WALKING"
|
||||
ImageItem "#01061" // FLYING"
|
||||
ImageItem "#01055" // CREDIT1"
|
||||
ImageItem "#01057" // CREDIT2"
|
||||
ImageItem "#01062" // CREDIT3"
|
||||
ImageItem "#01056" // CREDIT4"
|
||||
ImageItem "#01058" // BETAPAGE"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Credits menu. This is logically highly game specific.
|
||||
|
|
|
@ -33,3 +33,4 @@ version "4.3"
|
|||
#include "zscript/games/sw/ui/menu.zs"
|
||||
#include "zscript/games/exhumed/ui/menu.zs"
|
||||
#include "zscript/games/wh/ui/menu_wh1.zs"
|
||||
#include "zscript/games/wh/ui/menu_wh2.zs"
|
||||
|
|
116
wadsrc/static/zscript/games/wh/ui/menu_wh2.zs
Normal file
116
wadsrc/static/zscript/games/wh/ui/menu_wh2.zs
Normal file
|
@ -0,0 +1,116 @@
|
|||
|
||||
class WH2MenuDelegate : RazeMenuDelegate
|
||||
{
|
||||
override int DrawCaption(String title, Font fnt, int y, bool drawit)
|
||||
{
|
||||
let font = generic_ui? NewConsoleFont : BigFont; // this ignores the passed font intentionally.
|
||||
let fonth = font.GetGlyphHeight("A");
|
||||
let fontscale = 1.0;
|
||||
double squash = 1.0;
|
||||
if (drawit)
|
||||
{
|
||||
int width = font.StringWidth(title) * fontscale;
|
||||
if (width > 315)
|
||||
{
|
||||
squash = 315. / width;
|
||||
width = 315;
|
||||
}
|
||||
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;
|
||||
[fx, fy, fw, fh] = Screen.GetFullscreenRect(320, 200, FSMode_ScaleToFit43Top);
|
||||
int h = fonth * 0.8;
|
||||
return int((y+h) * fh / 200); // This must be the covered height of the header in true pixels.
|
||||
return y;
|
||||
}
|
||||
|
||||
override bool DrawSelector(ListMenuDescriptor desc)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// text item
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
class ListMenuItemWH2TextItem : ListMenuItemTextItem
|
||||
{
|
||||
void Init(ListMenuDescriptor desc, String text, String hotkey, Name child, int param = 0)
|
||||
{
|
||||
Super.Init(desc, text, hotkey, child, param);
|
||||
if (child == 'none') mEnabled = -1;
|
||||
}
|
||||
|
||||
void InitDirect(double x, double y, int height, String hotkey, String text, Font font, int color, int color2, Name child, int param = 0)
|
||||
{
|
||||
Super.InitDirect(x, y, height, hotkey, text, font, color, color2, child, param);
|
||||
}
|
||||
|
||||
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 = 1.0;
|
||||
|
||||
double length = gamefont.StringWidth(mText) * fontscale;
|
||||
double xpos = mXpos - length / 2;
|
||||
if (xpos + length > 315)
|
||||
{
|
||||
xpos = 315 - length;
|
||||
}
|
||||
if (!selectable()) cr = Font.CR_BLACK;
|
||||
else if (selected)
|
||||
{
|
||||
int mclock = MSTime() * 120 / 1000;
|
||||
int light = 223 + (Build.calcSinTableValue(mclock<<4) / 512.);
|
||||
colr = Color(255, light, light, light);
|
||||
cr = Font.CR_GREEN;
|
||||
}
|
||||
Screen.DrawText(BigFont, cr, xpos, mYpos, mText, DTA_FullscreenScale, FSMode_Fit320x200, DTA_Color, colr, DTA_ScaleX, scalex * fontscale, DTA_ScaleY, fontscale);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// text item
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
class ListMenuItemWH2SkillItem : 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 = 1;
|
||||
|
||||
if (!selectable()) cr = Font.CR_BLACK;
|
||||
else if (selected)
|
||||
{
|
||||
int mclock = MSTime() * 120 / 1000;
|
||||
int light = 223 + (Build.calcSinTableValue(mclock<<4) / 512.);
|
||||
colr = Color(255, light, light, light);
|
||||
cr = Font.CR_GREEN;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue