From 564a26633fd01657e1dd2c793fa3233253b90515 Mon Sep 17 00:00:00 2001 From: Nutzzz Date: Thu, 13 Oct 2022 09:55:38 -0700 Subject: [PATCH] Clang format updates for background darkening option --- src/engine/map_renderer.cpp | 6 +++--- src/engine/sprite_rendering_system.cpp | 12 ++++-------- src/engine/sprite_rendering_system.hpp | 12 +++++++++--- src/frontend/user_profile.cpp | 21 ++++++++++++++------- src/game_logic/game_world.cpp | 8 ++------ src/ui/options_menu.cpp | 16 ++++++++-------- 6 files changed, 40 insertions(+), 35 deletions(-) diff --git a/src/engine/map_renderer.cpp b/src/engine/map_renderer.cpp index 7af28b6d6..e3fa6a21f 100644 --- a/src/engine/map_renderer.cpp +++ b/src/engine/map_renderer.cpp @@ -292,7 +292,7 @@ void MapRenderer::renderBackground( { if (backColorMod < 1.0f) { - //const auto saved = renderer::saveState(mpRenderer); + // const auto saved = renderer::saveState(mpRenderer); mpRenderer->setColorModulation(base::Color{ base::roundTo(255 * backColorMod), base::roundTo(255 * backColorMod), @@ -311,7 +311,7 @@ void MapRenderer::renderForeground( { if (foreColorMod < 1.0f) { - //const auto saved = renderer::saveState(mpRenderer); + // const auto saved = renderer::saveState(mpRenderer); mpRenderer->setColorModulation(base::Color{ base::roundTo(255 * foreColorMod), base::roundTo(255 * foreColorMod), @@ -424,7 +424,7 @@ void MapRenderer::renderBackdrop( { if (dropColorMod < 1.0f) { - //const auto saved = renderer::saveState(mpRenderer); + // const auto saved = renderer::saveState(mpRenderer); mpRenderer->setColorModulation(base::Color{ base::roundTo(255 * dropColorMod), base::roundTo(255 * dropColorMod), diff --git a/src/engine/sprite_rendering_system.cpp b/src/engine/sprite_rendering_system.cpp index c9c11b016..1538c83af 100644 --- a/src/engine/sprite_rendering_system.cpp +++ b/src/engine/sprite_rendering_system.cpp @@ -117,8 +117,8 @@ void collectVisibleSprites( engine::interpolatedPixelPosition( previousTopLeft, topLeft, interpolationFactor), data::tilesToPixels(frame.mDimensions)}; - const auto drawSpec = - SpriteDrawSpec{destRect, frame.mImageId, flashingWhite, useCloakEffect, background}; + const auto drawSpec = SpriteDrawSpec{ + destRect, frame.mImageId, flashingWhite, useCloakEffect, background}; output.push_back({drawSpec, drawOrder, drawTopmost}); }; @@ -216,11 +216,7 @@ void collectVisibleSprites( const auto useCloakEffect = sprite.mUseCloakEffect; const auto drawSpec = SpriteDrawSpec{ - destRect, - frame.mImageId, - false, - useCloakEffect, - background}; + destRect, frame.mImageId, false, useCloakEffect, background}; output.push_back({drawSpec, drawOrder, drawTopmost}); } }); @@ -420,7 +416,7 @@ void SpriteRenderingSystem::renderSprite( { if (colorMod < 1.0f) { - //const auto saved = renderer::saveState(mpRenderer); + // const auto saved = renderer::saveState(mpRenderer); mpRenderer->setColorModulation(base::Color{ base::roundTo(255 * colorMod), base::roundTo(255 * colorMod), diff --git a/src/engine/sprite_rendering_system.hpp b/src/engine/sprite_rendering_system.hpp index f4e4f5c84..75b4fa208 100644 --- a/src/engine/sprite_rendering_system.hpp +++ b/src/engine/sprite_rendering_system.hpp @@ -91,9 +91,15 @@ class SpriteRenderingSystem bool cloakEffectSpritesVisible() const { return mCloakEffectSpritesVisible; } - void renderBackgroundSprites(const SpecialEffectsRenderer& fx, const float backColorMod) const; - void renderRegularSprites(const SpecialEffectsRenderer& fx, const float regColorMod) const; - void renderForegroundSprites(const SpecialEffectsRenderer& fx, const float foreColorMod) const; + void renderBackgroundSprites( + const SpecialEffectsRenderer& fx, + const float backColorMod) const; + void renderRegularSprites( + const SpecialEffectsRenderer& fx, + const float regColorMod) const; + void renderForegroundSprites( + const SpecialEffectsRenderer& fx, + const float foreColorMod) const; private: void renderSprite( diff --git a/src/frontend/user_profile.cpp b/src/frontend/user_profile.cpp index 3694a9318..beba401eb 100644 --- a/src/frontend/user_profile.cpp +++ b/src/frontend/user_profile.cpp @@ -668,13 +668,20 @@ data::GameOptions deserialize(const nlohmann::json& json) extractValueIfExists("quickSavingEnabled", result.mQuickSavingEnabled, json); extractValueIfExists("skipIntro", result.mSkipIntro, json); extractValueIfExists("motionSmoothing", result.mMotionSmoothing, json); - extractValueIfExists("foregroundSpriteBrightness", result.mForeSpriteBrightness, json); - extractValueIfExists("regularSpriteBrightness", result.mRegSpriteBrightness, json); - extractValueIfExists("backgroundSpriteBrightness", result.mBackSpriteBrightness, json); - extractValueIfExists("prisonerIsBackground", result.mPrisonerIsBackground, json); - extractValueIfExists("foregroundTileBrightness", result.mForeTileBrightness, json); - extractValueIfExists("backgroundTileBrightness", result.mBackTileBrightness, json); - extractValueIfExists("parallaxTileBrightness", result.mDropTileBrightness, json); + extractValueIfExists( + "foregroundSpriteBrightness", result.mForeSpriteBrightness, json); + extractValueIfExists( + "regularSpriteBrightness", result.mRegSpriteBrightness, json); + extractValueIfExists( + "backgroundSpriteBrightness", result.mBackSpriteBrightness, json); + extractValueIfExists( + "prisonerIsBackground", result.mPrisonerIsBackground, json); + extractValueIfExists( + "foregroundTileBrightness", result.mForeTileBrightness, json); + extractValueIfExists( + "backgroundTileBrightness", result.mBackTileBrightness, json); + extractValueIfExists( + "parallaxTileBrightness", result.mDropTileBrightness, json); removeInvalidKeybindings(result); diff --git a/src/game_logic/game_world.cpp b/src/game_logic/game_world.cpp index 0f8c81914..6809647a6 100644 --- a/src/game_logic/game_world.cpp +++ b/src/game_logic/game_world.cpp @@ -1015,9 +1015,7 @@ void GameWorld::drawMapAndSprites( params.mViewportSize, mpOptions->mBackTileBrightness); state.mDynamicGeometrySystem.renderDynamicBackgroundSections( - params.mRenderStartPosition, - params.mViewportSize, - interpolationFactor); + params.mRenderStartPosition, params.mViewportSize, interpolationFactor); state.mSpriteRenderingSystem.renderBackgroundSprites( mSpecialEffects, mpOptions->mBackSpriteBrightness); state.mSpriteRenderingSystem.renderRegularSprites( @@ -1030,9 +1028,7 @@ void GameWorld::drawMapAndSprites( params.mViewportSize, mpOptions->mForeTileBrightness); state.mDynamicGeometrySystem.renderDynamicForegroundSections( - params.mRenderStartPosition, - params.mViewportSize, - interpolationFactor); + params.mRenderStartPosition, params.mViewportSize, interpolationFactor); state.mSpriteRenderingSystem.renderForegroundSprites( mSpecialEffects, mpOptions->mForeSpriteBrightness); renderTileDebris(); diff --git a/src/ui/options_menu.cpp b/src/ui/options_menu.cpp index 80168433b..e8bdcb080 100644 --- a/src/ui/options_menu.cpp +++ b/src/ui/options_menu.cpp @@ -484,11 +484,13 @@ void OptionsMenu::updateAndRender(engine::TimeDelta dt) ImGui::NewLine(); } ImGui::Checkbox( - "Prisoner monster is background sprite", &mpOptions->mPrisonerIsBackground); - if ((!mpOptions->mPrisonerIsBackground && - mpOptions->mRegSpriteBrightness != mpOptions->mBackTileBrightness) || + "Prisoner monster is background sprite", + &mpOptions->mPrisonerIsBackground); + if ( + (!mpOptions->mPrisonerIsBackground && + mpOptions->mRegSpriteBrightness != mpOptions->mBackTileBrightness) || (mpOptions->mPrisonerIsBackground && - mpOptions->mBackSpriteBrightness != mpOptions->mBackTileBrightness)) + mpOptions->mBackSpriteBrightness != mpOptions->mBackTileBrightness)) { ImGui::Spacing(); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f)); @@ -909,10 +911,8 @@ void OptionsMenu::updateAndRender(engine::TimeDelta dt) ImGui::EndDisabled(); } - ImGui::Checkbox( - "Quick saving", &mpOptions->mQuickSavingEnabled); - ImGui::Checkbox( - "Skip intro sequence", &mpOptions->mSkipIntro); + ImGui::Checkbox("Quick saving", &mpOptions->mQuickSavingEnabled); + ImGui::Checkbox("Skip intro sequence", &mpOptions->mSkipIntro); ImGui::Checkbox( "Smooth scrolling & movement", &mpOptions->mMotionSmoothing); ImGui::EndTabItem();