move replaying into the event loop

This commit is contained in:
2024-07-31 16:44:19 -05:00
committed by Celtic Minstrel
parent d9cf1c8fae
commit 40cec6e861

View File

@@ -339,12 +339,6 @@ void init_boe(int argc, char* argv[]) {
init_mini_map(); init_mini_map();
redraw_screen(REFRESH_NONE); redraw_screen(REFRESH_NONE);
showMenuBar(); showMenuBar();
if(replaying){
while(has_next_action()){
replay_next_action();
}
}
} }
void showWelcome() { void showWelcome() {
@@ -361,32 +355,36 @@ void handle_events() {
cFramerateLimiter fps_limiter; cFramerateLimiter fps_limiter;
while(!All_Done) { while(!All_Done) {
if(replaying && has_next_action()){
replay_next_action();
}else{
#ifdef __APPLE__ #ifdef __APPLE__
if (menuChoiceId>=0) { if (menuChoiceId>=0) {
eMenuChoice aMenuChoice=menuChoice; eMenuChoice aMenuChoice=menuChoice;
menuChoice=eMenuChoice::MENU_CHOICE_NONE; menuChoice=eMenuChoice::MENU_CHOICE_NONE;
switch(aMenuChoice) { switch(aMenuChoice) {
case eMenuChoice::MENU_CHOICE_GENERIC: case eMenuChoice::MENU_CHOICE_GENERIC:
handle_menu_choice(eMenu(menuChoiceId)); handle_menu_choice(eMenu(menuChoiceId));
break; break;
case eMenuChoice::MENU_CHOICE_SPELL: case eMenuChoice::MENU_CHOICE_SPELL:
handle_menu_spell(eSpell(menuChoiceId)); handle_menu_spell(eSpell(menuChoiceId));
break; break;
case eMenuChoice::MENU_CHOICE_MONSTER_INFO: case eMenuChoice::MENU_CHOICE_MONSTER_INFO:
handle_monster_info_menu(menuChoiceId); handle_monster_info_menu(menuChoiceId);
break; break;
case eMenuChoice::MENU_CHOICE_NONE: case eMenuChoice::MENU_CHOICE_NONE:
break; break;
}
menuChoiceId=-1;
} }
menuChoiceId=-1;
}
#endif #endif
while(mainPtr.pollEvent(currentEvent)) handle_one_event(currentEvent); while(mainPtr.pollEvent(currentEvent)) handle_one_event(currentEvent);
// It would be nice to have minimap inside the main game window (we have lots of screen space in fullscreen mode). // It would be nice to have minimap inside the main game window (we have lots of screen space in fullscreen mode).
// Alternatively, minimap could live on its own thread. // Alternatively, minimap could live on its own thread.
// But for now we just handle events from both windows on this thread. // But for now we just handle events from both windows on this thread.
while(map_visible && mini_map.pollEvent(currentEvent)) handle_one_minimap_event(currentEvent); while(map_visible && mini_map.pollEvent(currentEvent)) handle_one_minimap_event(currentEvent);
}
if(changed_display_mode) { if(changed_display_mode) {
changed_display_mode = false; changed_display_mode = false;