From 838fa92175f8972db7f46e573b1ab064fb306a03 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 9 Jun 2018 04:26:02 +0000 Subject: [PATCH] * Options now correctly save when exitting the menu in html5 * Debug builds no longer quick save ever 5 seconds git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1623 353e56fe-9613-0410-8469-b96ad8e6f29c --- html5/build_release.bat | 9 +++--- source/App.cpp | 7 ++++- source/App.h | 1 + source/GUI/DMODInstallMenu.cpp | 2 +- source/GUI/GameMenu.cpp | 6 ---- source/GUI/OptionsMenu.cpp | 1 + source/dink/dink.cpp | 43 +++++++++++++-------------- windows_vs2017/winRTDink.vcxproj.user | 3 +- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/html5/build_release.bat b/html5/build_release.bat index fe76d5a..22f1bb1 100644 --- a/html5/build_release.bat +++ b/html5/build_release.bat @@ -113,9 +113,9 @@ set APP_SRC=%APP%\App.cpp %APP%\Component\ActionButtonComponent.cpp %APP%\Compon %APP%\GUI\PauseMenu.cpp %APP%\GUI\PopUpMenu.cpp %APP%\GUI\QuickTipMenu.cpp %APP%\GUI\ReadTextMenu.cpp %APP%\GUI\ExpiredMenu.cpp REM **************************************** END SOURCE -:unused so far: -s USE_GLFW=3 -s NO_EXIT_RUNTIME=1 -s FORCE_ALIGNED_MEMORY=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -DRT_EMTERPRETER_ENABLED +:unused so far: -s USE_GLFW=3 -s NO_EXIT_RUNTIME=1 -s FORCE_ALIGNED_MEMORY=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -DRT_EMTERPRETER_ENABLED -s TOTAL_MEMORY=16MB :To skip font loading so it needs no resource files or zlib, add -DC_NO_ZLIB -SET CUSTOM_FLAGS= -DHAS_SOCKLEN_T -DBOOST_ALL_NO_LIB -DPLATFORM_HTML5 -DRT_USE_SDL_AUDIO -DRT_JPG_SUPPORT -DC_GL_MODE -s LEGACY_GL_EMULATION=1 -DPLATFORM_HTML5 -s TOTAL_MEMORY=16MB -s ALLOW_MEMORY_GROWTH=1 -Wno-c++11-compat-deprecated-writable-strings --ignore-dynamic-linking --memory-init-file 0 -Wno-switch -s PRECISE_F32=2 +SET CUSTOM_FLAGS= -DHAS_SOCKLEN_T -DBOOST_ALL_NO_LIB -DPLATFORM_HTML5 -DRT_USE_SDL_AUDIO -DRT_JPG_SUPPORT -DC_GL_MODE -s LEGACY_GL_EMULATION=1 -DPLATFORM_HTML5 -s ALLOW_MEMORY_GROWTH=1 -Wno-c++11-compat-deprecated-writable-strings --ignore-dynamic-linking --memory-init-file 0 -Wno-switch -s PRECISE_F32=2 -Wno-writable-strings -Wno-shift-negative-value :unused: -s FULL_ES2=1 --emrun @@ -127,13 +127,14 @@ SET FINAL_EXTENSION=js SET FINAL_EXTENSION=html ) +:-s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -DRT_EMTERPRETER_ENABLED -s WASM=1 IF %DEBUG% EQU 0 ( echo Compiling in release mode -SET CUSTOM_FLAGS=%CUSTOM_FLAGS% -O2 -DNDEBUG +SET CUSTOM_FLAGS=%CUSTOM_FLAGS% -O2 -DNDEBUG ) else ( echo Compiling in debug mode :removed -s SAFE_HEAP=1 , causes alignment error with FMOD -SET CUSTOM_FLAGS=%CUSTOM_FLAGS% -D_DEBUG -s GL_UNSAFE_OPTS=0 -s WARN_ON_UNDEFINED_SYMBOLS=1 -s EXCEPTION_DEBUG=1 -s DEMANGLE_SUPPORT=1 -s ALIASING_FUNCTION_POINTERS=0 --emrun +SET CUSTOM_FLAGS=%CUSTOM_FLAGS% -D_DEBUG -s GL_UNSAFE_OPTS=0 -s WARN_ON_UNDEFINED_SYMBOLS=1 -s EXCEPTION_DEBUG=1 -s ASSERTIONS=2 -s DEMANGLE_SUPPORT=1 -s ALIASING_FUNCTION_POINTERS=0 --emrun ) SET INCLUDE_DIRS=-I%SHARED% -I%APP% -I../../shared/util/boost -I../../shared/ClanLib-2.0/Sources -I../../shared/Network/enet/include ^ diff --git a/source/App.cpp b/source/App.cpp index cadc1d3..3faf77c 100644 --- a/source/App.cpp +++ b/source/App.cpp @@ -913,6 +913,11 @@ void App::UpdateVideoSettings() //SetFPSLimit(v); }; +void App::SaveSettings() +{ + m_varDB.Save("save.dat"); +} + void App::SaveAllData() { @@ -924,7 +929,7 @@ void App::SaveAllData() } //GetAudioManager()->StopMusic(); - m_varDB.Save("save.dat"); + SaveSettings(); } void App::OnEnterBackground() diff --git a/source/App.h b/source/App.h index 4f1ae74..c6bd9a7 100644 --- a/source/App.h +++ b/source/App.h @@ -72,6 +72,7 @@ public: Variant * GetVarWithDefault(const string &varName, const Variant &var) {return m_varDB.GetVarWithDefault(varName, var);} int GetSpecial(); void UpdateVideoSettings(); + void SaveSettings(); void SetUsingTouchScreen(bool bNew) { m_bUsingTouchScreen = bNew; } bool GetUsingTouchScreen() {return m_bUsingTouchScreen;} bool CanDownloadDMODS() {return m_bHasDMODSupport;} diff --git a/source/GUI/DMODInstallMenu.cpp b/source/GUI/DMODInstallMenu.cpp index 7ffcd0b..d6a1874 100644 --- a/source/GUI/DMODInstallMenu.cpp +++ b/source/GUI/DMODInstallMenu.cpp @@ -252,7 +252,7 @@ void OnDMODInstallHTTPFinish(VariantList *pVList) Entity *pMenu = pVList->m_variant[0].GetComponent()->GetParent(); #ifdef _DEBUG - LogMsg("Finish signal received"); + LogMsg("Download finished..."); #endif DMODSetTitleLabel(pMenu, string("Installing ")+pMenu->GetVar("originalFileName")->GetString()+"..."); diff --git a/source/GUI/GameMenu.cpp b/source/GUI/GameMenu.cpp index 23a5d55..1c1704f 100644 --- a/source/GUI/GameMenu.cpp +++ b/source/GUI/GameMenu.cpp @@ -15,14 +15,8 @@ #include "Entity/ArcadeInputComponent.h" #include "Renderer/SoftSurface.h" -#ifdef _DEBUG -#define AUTO_SAVE_MS (1000*8) - -#else #define AUTO_SAVE_MS (1000*60*5) -#endif - void UpdatePauseMenuPosition(Entity *pBG); void ShowQuickMessage(string msg) diff --git a/source/GUI/OptionsMenu.cpp b/source/GUI/OptionsMenu.cpp index dd52101..986eedf 100644 --- a/source/GUI/OptionsMenu.cpp +++ b/source/GUI/OptionsMenu.cpp @@ -255,6 +255,7 @@ void OptionsMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity ZoomToPositionEntity(pMenu, CL_Vec2f(GetScreenSizeXf(),0), 500); //slide up KillEntity(pMenu, 500); AddFocusIfNeeded(pMenu->GetParent(), true, 500); + GetApp()->SaveSettings(); SyncPersistentData(); } diff --git a/source/dink/dink.cpp b/source/dink/dink.cpp index 09cfca4..cbb655c 100644 --- a/source/dink/dink.cpp +++ b/source/dink/dink.cpp @@ -12863,25 +12863,19 @@ void StartScreenScrollTransition(int direction) CheckTransitionSurface(); //remember this for later - if (GetApp()->GetVar("disable_glread")->GetUINT32() == 1) { //no_transition = true; - return; - } //remove the aspect ratio hack glMatrixMode(GL_MODELVIEW); glPopMatrix(); - //g_transitionSurf.InitBlankSurface(GetPrimaryGLX(), GetPrimaryGLY()); - UpdateFrameWithoutTransitionAndThinking(); - if (GetApp()->GetVar("disable_glread")->GetUINT32() == 1) { g_transitionSurf.FillColor(glColorBytes(0, 0, 0, 255)); @@ -12890,6 +12884,7 @@ void StartScreenScrollTransition(int direction) { g_transitionSurf.CopyFromScreen(); } + ApplyAspectRatioGLMatrix(); if (g_dglo.GetActiveView() != DinkGlobals::VIEW_ZOOMED) { @@ -12946,8 +12941,6 @@ void ProcessTransition(void) float inverseProg = 1.0f - g_dglo.m_transitionProgress; - - if (g_dglo.m_transitionProgress >= 1) { g_bTransitionActive = false; @@ -12961,7 +12954,6 @@ void ProcessTransition(void) float fTemp = inverseProg; //fTemp = 1.0f; glTranslatef((g_dglo.m_transitionOffset.x*fTemp),(g_dglo.m_transitionOffset.y*fTemp), 0); - //LogMsg("Trans: %.2f", g_dglo.m_transitionProgress); //glScalef(G_TRANSITION_SCALE_TRICK,G_TRANSITION_SCALE_TRICK,1); @@ -12982,15 +12974,16 @@ void BlitSecondTransitionScreen() if (g_bTransitionActive) { + CheckTransitionSurface(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); - + float offsetX = g_dglo.m_centeringOffset.x*(1.0f - ((float)GetFakePrimaryScreenSizeX() / (float)C_DINK_SCREENSIZE_X)); float offsetY = g_dglo.m_centeringOffset.y*(1.0f - ((float)GetFakePrimaryScreenSizeY() / (float)C_DINK_SCREENSIZE_Y)); - + glTranslatef(-offsetX, -offsetY, 0); - + rtRectf dstRect = g_dglo.m_nativeGameArea; static rtRectf dstOffset; @@ -13001,7 +12994,6 @@ void BlitSecondTransitionScreen() //fix black lines due to antialiasing dstOffset = rtRectf(-1, -1, 1, 1); srcOffset = rtRectf(1, 1, -1, -1); - } else { @@ -13009,13 +13001,16 @@ void BlitSecondTransitionScreen() dstOffset = rtRectf(-0.05, -0.05f, 0.05f, 0.05); srcOffset = rtRectf(0.4, 0.4, -0.4, -0.4); } - - dstRect.AdjustPosition( ( -g_dglo.m_transitionOffsetNative.x*g_dglo.m_transitionProgress), - ( -g_dglo.m_transitionOffsetNative.y*g_dglo.m_transitionProgress)); - - + + dstRect.AdjustPosition((-g_dglo.m_transitionOffsetNative.x*g_dglo.m_transitionProgress), + (-g_dglo.m_transitionOffsetNative.y*g_dglo.m_transitionProgress)); + rtRectf srcRect = ConvertFakeScreenRectToReal(g_dglo.m_nativeGameArea); - // LogMsg("Dest rect: %s",PrintRect(dstRect)); +#ifdef _DEBUG + //LogMsg("Final Trans Src rect: %s", PrintRect(srcRect).c_str()); + //LogMsg("Trans Dest rect: %s", PrintRect(dstRect).c_str()); + //LogMsg("Trans surf size: %s", PrintRect(g_transitionSurf.GetRectf()).c_str()); +#endif g_transitionSurf.BlitEx(dstRect+dstOffset, srcRect+ srcOffset); @@ -17097,7 +17092,7 @@ void DinkGlobals::SetView( eView view ) RecomputeAspectRatio(); #ifdef _DEBUG - LogMsg("Rect %s AspectX: %.4f, Aspect Y: %.4f", PrintRect(g_dglo.m_nativeGameArea).c_str(), aspect, aspectY); + LogMsg("DinkGlobals::SetView>VIEW_FULL Rect %s AspectX: %.4f, Aspect Y: %.4f", PrintRect(g_dglo.m_nativeGameArea).c_str(), aspect, aspectY); #endif } @@ -17921,7 +17916,6 @@ void RecomputeAspectRatio() else { float aspect_r = (float)GetPrimaryGLX() / (float)GetPrimaryGLY(); // aspect ratio - const float correctAspectRatio = (float)C_DINK_SCREENSIZE_X / (float)C_DINK_SCREENSIZE_Y; /* @@ -17958,7 +17952,6 @@ void DinkReInitSurfacesAfterVideoChange() { g_transitionSurf.HardKill(); //CheckTransitionSurface(); - bool bHighColor = false; if (lpDDSBackGround && lpDDSBackGround->m_pSurf && lpDDSBackGround->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_RGBA) bHighColor = true; @@ -17971,6 +17964,8 @@ void DinkReInitSurfacesAfterVideoChange() lpDDSBackGround->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); g_onePixelSurf.HardKill(); + + } RecomputeAspectRatio(); @@ -17987,7 +17982,9 @@ void DinkOnForeground() //force reinit on windows even if using iphone or android mode bForceReinit = true; #endif - +#ifdef PLATFORM_HTML5 + //bForceReinit = true; +#endif if (IsDesktop() || GetEmulatedPlatformID() == PLATFORM_ID_ANDROID || bForceReinit) //xoom needs this too after a suspend/resume from hitting the power button { diff --git a/windows_vs2017/winRTDink.vcxproj.user b/windows_vs2017/winRTDink.vcxproj.user index 38677ef..3b7ea2f 100644 --- a/windows_vs2017/winRTDink.vcxproj.user +++ b/windows_vs2017/winRTDink.vcxproj.user @@ -7,7 +7,8 @@ $(OutDir) WindowsLocalDebugger - ../test_bad_dmoddir_changes.dmod + +