- added a menu control for Blood's dripping blood.

This commit is contained in:
Christoph Oelckers 2020-10-06 23:49:34 +02:00
parent 3ddc544a85
commit 06b00887f5
4 changed files with 78 additions and 45 deletions

View file

@ -2,8 +2,9 @@
/* /*
Copyright (C) 2010-2019 EDuke32 developers and contributors Copyright (C) 2010-2019 EDuke32 developers and contributors
Copyright (C) 2019 Nuke.YKT Copyright (C) 2019 Nuke.YKT
Copyright (C) 2020 Christoph Oelckers
This file is part of NBlood. This file is part of Raze.
NBlood is free software; you can redistribute it and/or NBlood is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2 modify it under the terms of the GNU General Public License version 2
@ -37,6 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "sound.h" #include "sound.h"
#include "v_video.h" #include "v_video.h"
#include "v_draw.h" #include "v_draw.h"
#include "vm.h"
bool ShowOptionMenu(); bool ShowOptionMenu();
@ -119,56 +121,39 @@ void CGameMenuItemQAV::Draw(void)
} }
static std::unique_ptr<CGameMenuItemQAV> itemBloodQAV; // This must be global to ensure that the animation remains consistent across menus. static std::unique_ptr<CGameMenuItemQAV> itemBloodQAV; // This must be global to ensure that the animation remains consistent across menus.
DEFINE_ACTION_FUNCTION(DListMenuItemBloodDripDrawer, Draw)
{
// For narrow screens this would be mispositioned so skip drawing it there.
double ratio = screen->GetWidth() / double(screen->GetHeight());
if (ratio > 1.32) itemBloodQAV->Draw();
return 0;
}
void UpdateNetworkMenus(void) void UpdateNetworkMenus(void)
{ {
#if 0 // For now disable the network menu item as it is not functional.
// For now disable the network menu item as it is not yet functional.
for (auto name : { NAME_Mainmenu, NAME_IngameMenu }) for (auto name : { NAME_Mainmenu, NAME_IngameMenu })
{ {
FMenuDescriptor** desc = MenuDescriptors.CheckKey(name); DMenuDescriptor** desc = MenuDescriptors.CheckKey(name);
if (desc != NULL && (*desc)->mType == MDESC_ListMenu) if (desc != NULL && (*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
{ {
FListMenuDescriptor* ld = static_cast<FListMenuDescriptor*>(*desc); DListMenuDescriptor* ld = static_cast<DListMenuDescriptor*>(*desc);
for (auto& li : ld->mItems) for (auto& li : ld->mItems)
{ {
if (li->GetAction(nullptr) == NAME_MultiMenu) if (li->mAction == NAME_MultiMenu)
{ {
li->mEnabled = false; li->mEnabled = false;
} }
} }
} }
} }
#endif
} }
#if 0 #if 0
//----------------------------------------------------------------------------
//
// 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()
{
// For narrow screens this would be mispositioned so skip drawing it there.
double ratio = screen->GetWidth() / double(screen->GetHeight());
if (ratio > 1.32) itemBloodQAV->Draw();
}
};
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// //

View file

@ -56,12 +56,27 @@
#include "i_system.h" #include "i_system.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "gamecontrol.h" #include "gamecontrol.h"
#include "raze_sound.h"
#include "gamestruct.h"
enum EMenuSounds : int
{
ActivateSound,
CursorSound,
AdvanceSound,
BackSound,
CloseSound,
PageSound,
ChangeSound,
ChooseSound
};
EXTERN_CVAR(Int, cl_gfxlocalization) EXTERN_CVAR(Int, cl_gfxlocalization)
EXTERN_CVAR(Bool, m_quickexit) EXTERN_CVAR(Bool, m_quickexit)
EXTERN_CVAR(Bool, saveloadconfirmation) // [mxd] EXTERN_CVAR(Bool, saveloadconfirmation) // [mxd]
EXTERN_CVAR(Bool, quicksaverotation) EXTERN_CVAR(Bool, quicksaverotation)
EXTERN_CVAR(Bool, show_messages) EXTERN_CVAR(Bool, show_messages)
CVAR(Bool, menu_sounds, true, CVAR_ARCHIVE) // added mainly because RR's sounds are so supremely annoying.
typedef void(*hfunc)(); typedef void(*hfunc)();
DMenu* CreateMessageBoxMenu(DMenu* parent, const char* message, int messagemode, bool playsound, FName action = NAME_None, hfunc handler = nullptr); DMenu* CreateMessageBoxMenu(DMenu* parent, const char* message, int messagemode, bool playsound, FName action = NAME_None, hfunc handler = nullptr);
@ -158,24 +173,33 @@ bool M_SetSpecialMenu(FName& menu, int param)
// //
//============================================================================= //=============================================================================
void M_StartControlPanel(bool makeSound, bool scaleoverride) void M_MenuSound(EMenuSounds snd)
{ {
#if 0 if (menu_sounds) gi->MenuSound(snd);
if (hud_toggled) }
D_ToggleHud();
//=============================================================================
//
//
//
//=============================================================================
void M_StartControlPanel(bool makeSound, bool)
{
static bool created = false;
// intro might call this repeatedly // intro might call this repeatedly
if (CurrentMenu != nullptr) if (CurrentMenu != NULL)
return; return;
P_CheckTickerPaused(); if (!created) // Cannot do this earlier.
if (makeSound)
{ {
S_Sound(CHAN_VOICE, CHANF_UI, "menu/activate", snd_menuvolume, ATTN_NONE); created = true;
M_CreateMenus();
} }
M_DoStartControlPanel(scaleoverride); GSnd->SetSfxPaused(true, PAUSESFX_MENU);
#endif gi->MenuOpened();
if (makeSound) M_MenuSound(ActivateSound);
M_DoStartControlPanel(false);
} }

View file

@ -6,6 +6,7 @@
LISTMENU "MainMenu" LISTMENU "MainMenu"
{ {
Size 320, 200
//class "$.MainMenu" //class "$.MainMenu"
ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides) ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides)
{ {
@ -25,10 +26,10 @@ LISTMENU "MainMenu"
ifgame(Blood) ifgame(Blood)
{ {
CaptionItem "Blood" CaptionItem "Blood"
/* position 160, 45
position 160, 45, 150
centermenu
Linespacing 20 Linespacing 20
/*
centermenu
NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
NativeTextItem "$MNU_MULTIPLAYER", "m", "MultiMenu" NativeTextItem "$MNU_MULTIPLAYER", "m", "MultiMenu"
NativeTextItem "$MNU_OPTIONS", "o", "OptionsMenu" NativeTextItem "$MNU_OPTIONS", "o", "OptionsMenu"
@ -37,6 +38,7 @@ LISTMENU "MainMenu"
NativeTextItem "$MNU_CREDITS", "c", "CreditsMenu" NativeTextItem "$MNU_CREDITS", "c", "CreditsMenu"
NativeTextItem "$MNU_QUITGAME", "q", "QuitMenu" NativeTextItem "$MNU_QUITGAME", "q", "QuitMenu"
*/ */
BloodDripDrawer
} }
ifgame(ShadowWarrior) ifgame(ShadowWarrior)
{ {

View file

@ -1,4 +1,10 @@
//-------------------------------------------------------------------------------------------
//
// Caption drawer
//
//-------------------------------------------------------------------------------------------
class MenuCustomizerBlood : MenuCustomize class MenuCustomizerBlood : MenuCustomize
{ {
override int DrawCaption(String title, Font fnt, int y, bool drawit) override int DrawCaption(String title, Font fnt, int y, bool drawit)
@ -24,3 +30,19 @@ class MenuCustomizerBlood : MenuCustomize
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.
} }
} }
//-------------------------------------------------------------------------------------------
//
// The dripping blood - partially native.
//
//-------------------------------------------------------------------------------------------
class ListMenuItemBloodDripDrawer : ListMenuItem
{
void Init(ListMenuDescriptor desc)
{
Super.Init(0, 0);
}
native override void Draw(bool selected, ListMenuDescriptor desc);
}