| 67 | |
| 68 | return true; |
| 69 | } |
| 70 | |
| 71 | auto Sorcery::Engine::start(const int mode) -> int { |
| 72 | |
| 73 | using namespace std::chrono_literals; |
| 74 | |
| 75 | _ctx.controller->initialise(); |
| 76 | _ctx.controller->set_flag("in_engine"); |
| 77 | _ctx.controller->go_to(Enums::Screen::ENGINE); |
| 78 | if (_ctx.game->state->get_party_size() > 0) |
| 79 | _ctx.controller->set_character( |
| 80 | Enums::CharacterSlot::INSPECT, |
| 81 | _ctx.game->state->get_party_char(1).value()); |
| 82 | |
| 83 | _start_expedition(mode); |
| 84 | |
| 85 | _ctx.audio->set_volume(1.0f); |
| 86 | |
| 87 | fade_in( |
| 88 | [this] { |
| 89 | _ctx.ui->display_engine(); |
| 90 | }, |
| 91 | 500ms); |
| 92 | |
| 93 | // Main loop |
| 94 | auto done{false}; |
| 95 | while (!done) { |
| 96 | |
| 97 | SDL_Event event; |
| 98 | while (SDL_PollEvent(&event)) { |
| 99 | |
| 100 | ImGui_ImplSDL2_ProcessEvent(&event); |
| 101 | |
| 102 | done = _ctx.controller->check_for_abort(event); |
| 103 | if (_ctx.controller->want_to_abort()) |
| 104 | return ABORT_GAME; |
| 105 | |
| 106 | if (_ctx.controller->check_for_quicksave(event)) |
| 107 | _application->save_state_to_binary( |
| 108 | _ctx.get_file(SAVE_STATE_FILENAME)); |
| 109 | else if (_ctx.controller->check_for_quickload(event)) |
| 110 | _application->load_state_from_binary( |
| 111 | _ctx.get_file(SAVE_STATE_FILENAME)); |
| 112 | |
| 113 | _ctx.controller->check_for_resize(event, _ctx.ui); |
| 114 | |
| 115 | // Check for Debug |
| 116 | _ctx.controller->check_for_debug(event); |
| 117 | |
| 118 | // Back closes popup first, otherwise opens camp. |
| 119 | if (_ctx.controller->check_for_back(event)) { |
| 120 | if (_ctx.ui->in_popup()) { |
| 121 | _ctx.ui->close_all_popups(); |
| 122 | _ctx.controller->clear_modal_flags(); |
| 123 | } else { |
| 124 | _ctx.ui->modal_camp->show = true; |
| 125 | _ctx.controller->set_flag("want_camp"); |
| 126 | } |
nothing calls this directly
no test coverage detected