- WH: start the menu music.

This commit is contained in:
Christoph Oelckers 2021-11-27 00:18:22 +01:00
parent 3fa9e7894b
commit c171ba38e7
7 changed files with 29 additions and 1 deletions

View file

@ -924,4 +924,11 @@ DEFINE_ACTION_FUNCTION(_Witchaven, GetViewPlayer)
{
ACTION_RETURN_POINTER(&player[myconnectindex]);
}
DEFINE_ACTION_FUNCTION_NATIVE(_Witchaven, PlayMenuMusic, SND_MenuMusic)
{
SND_MenuMusic();
return 0;
}
END_WH_NS

View file

@ -45,7 +45,7 @@ void startsong(int which) // 0, 1, 2 or 3
void startmusic(int level)
{
// allow music override from MAPINFO.
if (currentLevel->music.IsNotEmpty())
if (currentLevel && currentLevel->music.IsNotEmpty())
{
Mus_Play(currentLevel->music, true);
oldsong = -1;

View file

@ -491,6 +491,7 @@ inline int spritesound(int sn, DWHActor* s, int loop = 0, int channel = CHAN_AUT
void startmusic(int);
void startsong(int);
void setupmidi();
void SND_MenuMusic();
extern int attacktheme;
@ -517,6 +518,7 @@ struct GameInterface : public ::GameInterface
bool GenerateSavePic() override;
GameStats getStats() override;
void MenuOpened() override;
//void MenuClosed() override;
void MenuSound(EMenuSounds snd) override;
bool CanSave() override;
void LoadGameTextures() override;

View file

@ -89,6 +89,7 @@ LISTMENU "MainMenu"
}
ifgame(Witchaven2)
{
class "WH2MainMenu"
position 160, 35
Linespacing 22
WH2TextItem "$MNU_NEWGAME", "n", "SkillMenu"

View file

@ -33,6 +33,12 @@ class WHMenuDelegate : RazeMenuDelegate
class WHMainMenu : ListMenu
{
override void Init(Menu parent, ListMenuDescriptor desc)
{
Super.Init(parent, desc);
Witchaven.PlayMenuMusic();
}
}
//=============================================================================

View file

@ -31,6 +31,17 @@ class WH2MenuDelegate : RazeMenuDelegate
}
class WH2MainMenu : ListMenu
{
override void Init(Menu parent, ListMenuDescriptor desc)
{
Super.Init(parent, desc);
Witchaven.PlayMenuMusic();
}
}
//=============================================================================
//
// text item

View file

@ -208,6 +208,7 @@ struct Witchaven native
native static void PlaySound(int s);
native static WhPlayer GetViewPlayer();
native static void PlayMenuMusic();
}
struct WhWeaponInf native {