Skip to content

Commit

Permalink
Bugfix: don't play theme if music off (#43)
Browse files Browse the repository at this point in the history
* Bugfix: don't play theme if music off

Otherwise, it causes Access Violation error.

* Fix PR code, update union-api submodule

---------

Co-authored-by: damianut <damianas1999@gmail.com>
  • Loading branch information
piotrmacha and damianut authored Jul 7, 2024
1 parent eb2f161 commit 2da6f23
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dependencies/union-api
Submodule union-api updated from 406e3f to f492eb
2 changes: 1 addition & 1 deletion docs/docs/reference/externals/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## <a href="#bassmusic_play">BassMusic_Play</a>

Triggers an event to start a new music theme.
Triggers an event to start a new music theme. If the player has turned off the music in the menu, the theme will not be played.

```dae
func void BassMusic_Play(var string id)
Expand Down
6 changes: 6 additions & 0 deletions src/Gothic/Externals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ namespace GOTHIC_NAMESPACE
{
zSTRING id;
parser->GetParameter(id);
if (zCMusicSystem::s_musicSystemDisabled)
{
static NH::Logger* log = NH::CreateLogger("zBassMusic::BassMusic_Play");
log->Error("Music system disabled.");
return 0;
}
zCMusicTheme* theme = zmusic->LoadThemeByScript(id);
zmusic->PlayTheme(theme, zMUS_THEME_VOL_DEFAULT, zMUS_TR_DEFAULT, zMUS_TRSUB_DEFAULT);
return 0;
Expand Down

0 comments on commit 2da6f23

Please sign in to comment.