From d6c3624d1aff9719b0c6dd99a40b6971aa2f2cfe Mon Sep 17 00:00:00 2001 From: Stanislav Pavlov Date: Fri, 16 Feb 2024 09:59:43 +0700 Subject: [PATCH] Add video support --- Source/Game/Runtime.cpp | 16 ++++++++++++++++ Source/UserInterface/ReelManager.cpp | 9 ++++++++- Source/UserInterface/UserSingleProfile.cpp | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Source/Game/Runtime.cpp b/Source/Game/Runtime.cpp index 9ad9991b0..4f8700cc1 100644 --- a/Source/Game/Runtime.cpp +++ b/Source/Game/Runtime.cpp @@ -65,6 +65,7 @@ const char* currentVersion = uint16_t currentVersionNumbers[] = {0, 0, 0}; static int terMissionEdit = 0; +bool isRuntimePaused = false; cLogicGeneric* terLogicGeneric = NULL; cVisGeneric* terVisGeneric = NULL; @@ -917,6 +918,14 @@ char* alloc_exec_arg_string(std::string arg, bool wrap_spaces) { return str; } +void pauseRuntime() { + isRuntimePaused = true; +} + +void resumeRuntime() { + isRuntimePaused = false; +} + int SDL_main(int argc, char *argv[]) { //Show help if requested @@ -999,6 +1008,13 @@ int SDL_main(int argc, char *argv[]) bool run = true; while (run) { + if (isRuntimePaused) { +#ifdef EMSCRIPTEN + emscripten_sleep(0); + continue; +#endif + } + app_event_poll(); //NetworkPause handler diff --git a/Source/UserInterface/ReelManager.cpp b/Source/UserInterface/ReelManager.cpp index a39bb4f27..5ebcd7265 100644 --- a/Source/UserInterface/ReelManager.cpp +++ b/Source/UserInterface/ReelManager.cpp @@ -46,6 +46,12 @@ void ReelManager::showModal(const char* videoFileName, const char* soundFileName } } +#ifdef GPX + while (!player->IsEnd()) { + player->Update(); + } +#else + Vect2i picSize; Vect2i showPos; switch (sizeType) { @@ -122,7 +128,7 @@ void ReelManager::showModal(const char* videoFileName, const char* soundFileName terRenderDevice->BeginScene(); terRenderDevice->EndScene(); terRenderDevice->Flush(); - +#endif delete player; player = NULL; RELEASE(bgTexture); @@ -195,4 +201,5 @@ void ReelManager::showPictureModal(const char* pictureFileName, int stableTime) // RELEASE(bgTexture); hide(); + } diff --git a/Source/UserInterface/UserSingleProfile.cpp b/Source/UserInterface/UserSingleProfile.cpp index 9669df6fd..de6eadfc8 100644 --- a/Source/UserInterface/UserSingleProfile.cpp +++ b/Source/UserInterface/UserSingleProfile.cpp @@ -126,7 +126,7 @@ void UserSingleProfile::addProfile(const std::string& name) { bool UserSingleProfile::removeDir(const std::string& dir) { std::error_code error; std::string allSaves = getAllSavesDirectory(); - std::filesystem::path target_path = std::filesystem::u8path(allSaves + PATH_SEP + dir); + std::filesystem::path target_path = std::filesystem::u8path(allSaves + dir); std::filesystem::remove_all(target_path, error); if( error ) { ErrH.Abort("Can't remove profile directory: ", XERR_USER, error.value(), error.message().c_str());