Added ability to load game from menu
Added ability to load game straight from main menu (after game is launched).
One downside effect of this feature might be that previous menu window will still be visible after game is loaded when Options::KeyQuickLoad is tapped when Options menu is active or other nested menus.
This could be workaround by checking if( menu->name != "MENU_MAIN" ) return;.
I am looking for another solution to close all active menus then load game. I tried something like:
for (int i = zCMenu::activeList.GetNum()-1; i > 0; i--)
{
auto item = zCMenu::activeList[i];
item->HandleEvent(KEY_ESCAPE);
}
or use ForceSelAction with BACK option on first item in menu, but no positive outcome.
zCMenu::GetActive() is also not works it is not updating right after menu is closed.
744f7b4 here is solution for closing all active menus before loading game from main menu.
Loading from nested menus doesn't seem to work right. Also nested menus shouldn't be closed in the span of multiple frames.
@Franisz yes you were right. I tested 744f7b4 only in The Chronicles of Myrtana mod, G1 and G2A was not working as I expected. Actually TCoM behaves differently, but w/e 😄
b6e446d this solution works (tested on G1, G2A, TCoM). Thanks to @UnresolvedExternal who helped me to understand what's going on underneath Run method and provided code sample.
It is using HOOKs right now instead of Game_MenuLoop() to control if menu should be closed or not.
I'm still checking if zCMenu::inGameMenu is false to be able to load to prevent some strange behaviors like trying to load game while saving and typing savegame name.