- 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) 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
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 "v_video.h"
#include "v_draw.h"
#include "vm.h"
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.
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)
{
#if 0
// For now disable the network menu item as it is not yet functional.
// For now disable the network menu item as it is not functional.
for (auto name : { NAME_Mainmenu, NAME_IngameMenu })
{
FMenuDescriptor** desc = MenuDescriptors.CheckKey(name);
if (desc != NULL && (*desc)->mType == MDESC_ListMenu)
DMenuDescriptor** desc = MenuDescriptors.CheckKey(name);
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)
{
if (li->GetAction(nullptr) == NAME_MultiMenu)
if (li->mAction == NAME_MultiMenu)
{
li->mEnabled = false;
}
}
}
}
#endif
}
#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 "gameconfigfile.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(Bool, m_quickexit)
EXTERN_CVAR(Bool, saveloadconfirmation) // [mxd]
EXTERN_CVAR(Bool, quicksaverotation)
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)();
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 (hud_toggled)
D_ToggleHud();
if (menu_sounds) gi->MenuSound(snd);
}
//=============================================================================
//
//
//
//=============================================================================
void M_StartControlPanel(bool makeSound, bool)
{
static bool created = false;
// intro might call this repeatedly
if (CurrentMenu != nullptr)
if (CurrentMenu != NULL)
return;
P_CheckTickerPaused();
if (makeSound)
if (!created) // Cannot do this earlier.
{
S_Sound(CHAN_VOICE, CHANF_UI, "menu/activate", snd_menuvolume, ATTN_NONE);
created = true;
M_CreateMenus();
}
M_DoStartControlPanel(scaleoverride);
#endif
GSnd->SetSfxPaused(true, PAUSESFX_MENU);
gi->MenuOpened();
if (makeSound) M_MenuSound(ActivateSound);
M_DoStartControlPanel(false);
}

View file

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

View file

@ -1,4 +1,10 @@
//-------------------------------------------------------------------------------------------
//
// Caption drawer
//
//-------------------------------------------------------------------------------------------
class MenuCustomizerBlood : MenuCustomize
{
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.
}
}
//-------------------------------------------------------------------------------------------
//
// The dripping blood - partially native.
//
//-------------------------------------------------------------------------------------------
class ListMenuItemBloodDripDrawer : ListMenuItem
{
void Init(ListMenuDescriptor desc)
{
Super.Init(0, 0);
}
native override void Draw(bool selected, ListMenuDescriptor desc);
}