I found that weird that you couldn't replicate the issue, so I tried shuffling things into a fresh project. Narrowing down potential subject files, I got down to config.enter_transition. If there is no transition, there seems to be... no problem. wh.
The transition occurs in _enter_game_menu, which plays before the check for the label enter_game_menu, meaning something like
Code: Select all
label enter_game_menu:
$ renpy.music.stop(channel="text")
return
... doesn't work, because it seems like when returning from the menu Ren'py restores whatever was playing - and the sound was not stopped before storing that information.
Following the chain of calls leads to _invoke_game_menu, which is called by... the game_menu key. I had already replaced this code with the monstrosity that follows.
Code: Select all
def new_game_menu():
print "Called new game menu."
if not renpy.context()._menu:
renpy.music.stop(channel="text")
renpy.call_in_new_context('_game_menu')
km = renpy.Keymap(
screenshot = _screenshot,
developer = _developer,
toggle_fullscreen = renpy.toggle_fullscreen,
toggle_skip = _keymap_toggle_skipping,
game_menu = new_game_menu,
hide_windows = renpy.curried_call_in_new_context("_hide_windows"),
quit = renpy.quit_event,
)
config.underlay = [ km ]
del km
Putting the stop line in there works! ... but as I said, it's a monstrosity. The large Keymap array (er, hash?) there is copied from the internal keymap script, because if I use anything else*, there is a slight chance the original code (_invoke_game_menu) executes instead.
*For example, this would be much better, but it isn't always acknowledged.
Code: Select all
def game_menu_replace():
ui.keymap(game_menu = new_game_menu)
config.overlay_functions.append(game_menu_replace)
Using this code instead, and adding
print "Original game_menu." to def _invoke_game_menu(): in 00gamemenu.rpy, I am able to see that in certain instances (during a transition, when a say has just started? i don't really know), the original is used instead.
I've been messing with control over opening/closing the menu for other purposes too, so it appears. Fun. x -x