From f34ae53f8fc01f4dcb4824c803321ca041e4076e Mon Sep 17 00:00:00 2001 From: Death Killer <884052+deathkiller@users.noreply.github.com> Date: Sun, 14 Jan 2024 21:02:33 +0100 Subject: [PATCH] Minor changes --- Content/Translations/cs.mo | Bin 25217 -> 25215 bytes Content/Translations/cs.po | 4 ++-- Sources/Jazz2/Actors/Player.cpp | 13 ++++++++----- Sources/Jazz2/LevelHandler.cpp | 11 ++++++++++- Sources/Jazz2/PreferencesCache.cpp | 3 +++ Sources/Jazz2/UI/Menu/FirstRunSection.cpp | 22 ++-------------------- Sources/Jazz2/UI/Menu/FirstRunSection.h | 1 - Sources/Jazz2/UI/Menu/MainMenu.cpp | 3 ++- 8 files changed, 27 insertions(+), 30 deletions(-) diff --git a/Content/Translations/cs.mo b/Content/Translations/cs.mo index 5897ab0a75c2819e8ca79b24b93e3a40387359dd..8d6156b817a2a61a6813fbc721ac5818f9702d85 100644 GIT binary patch delta 1083 zcmXZbPe@cz6vy$O5EK)oSY}$IW;FfL86D@3rBjR<)ih3xWtLfKg_~%if?Bj_D9w%F zF4_cE)FudOhD!I^A2o9{g_^FW3p{-XQm)4*k!7n>XfJvWN-dbgdK^JJ$T-?YzM~Z^J|rE* zF0?CnjE(pTtyAfFf(-gleGL)>7Z(-bff)A1W9NJ&@5P4Oz*iL;#PdWvLu#9{Ht@Up)f^%4fO?}ce?8Gzp z4mp&9{Z30q@qZ`L-pir=MYX4#-!*~T$Oq6mGKOxui_ZieoJafEs!ux$#j~;H1KvfU RmOwb0X??jYdo{MW;vdo#n1KKQ delta 1087 zcmXZbOGs2<6u|K_&`Pv)Lep|`>^Wu5IFFosBtD{=rg3Vl$ui3a(Iy(9pjKT3orDO4 z7SSfKqBcR{2&HbzsN7gt%W#ncF)i9;Nm>8XcUQl2zI*R?&Ufy;e_uETUpk(K@~n9g z89yk}gd-7=3VelSn8iYL91?P3GyXufmhcgg zeK?G|-y7V4Ig4ODLCH~(z39gvrqF};u?lC=hd)st^dvYPCU6(tL_Nq9Y9rrJ3l?>V zbYc?q6+FQje2qFOYnfmxLHL+R19sy8-a%c@J8mARK`(hPa!E!}8~B1c0e4b_*DQ6Y zjSis}n85w`9kua2Cqy=3A68Reh6#c!WH5wT)I#O7?ZznT`UTWNW9Y{zyn#7fgI7E!3AQ1WqnYVl&R7j;^4~{@73(NMQ>;K>Y?5k=o)t zZT_C?7$%=V9r232?(62%cN diff --git a/Content/Translations/cs.po b/Content/Translations/cs.po index c9866391..52b1afcc 100644 --- a/Content/Translations/cs.po +++ b/Content/Translations/cs.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: jazz2-resurrection\n" "POT-Creation-Date: 2024-01-14 14:14+0100\n" -"PO-Revision-Date: 2024-01-14 14:23+0100\n" +"PO-Revision-Date: 2024-01-14 15:36+0100\n" "Last-Translator: \n" "Language-Team: Překlad do češtiny: Dan R. (https://deat.tk/jazz2/)\n" "Language: cs\n" @@ -1635,7 +1635,7 @@ msgstr "" "Můžete si zvolit preferovaný styl hraní.\n" "Tuto možnost můžete kdykoliv změnit v \f[c:0x707070]%s\f[c] > " "\f[c:0x707070]%s\f[c] > \f[c:0x707070]%s\f[c].\n" -"Pro více informací můžete navštívit %s and  Discord!" +"Pro více informací můžete navštívit %s a  Discord!" #. TRANSLATORS: Menu item in Options > Gameplay > Enhancements section #: Sources/Jazz2/UI/Menu/GameplayEnhancementsSection.cpp:16 diff --git a/Sources/Jazz2/Actors/Player.cpp b/Sources/Jazz2/Actors/Player.cpp index bdce3581..6f0329cd 100644 --- a/Sources/Jazz2/Actors/Player.cpp +++ b/Sources/Jazz2/Actors/Player.cpp @@ -187,7 +187,7 @@ namespace Jazz2::Actors bool isFrozen = ((_lastExitType & ExitType::Frozen) == ExitType::Frozen); _isFreefall = (isFrozen || CanFreefall()); - SetPlayerTransition(_isFreefall ? AnimState::TransitionWarpOutFreefall : AnimState::TransitionWarpOut, false, true, SpecialMoveType::None, [this, isFrozen]() { + SetPlayerTransition(_isFreefall ? AnimState::TransitionWarpOutFreefall : AnimState::TransitionWarpOut, false, true, SpecialMoveType::None, [this, isFrozen, timeMult]() { SetState(ActorState::ApplyGravitation, true); if (isFrozen) { SetAnimation(AnimState::Freefall); @@ -197,6 +197,8 @@ namespace Jazz2::Actors _frozenTimeLeft = 100.0f; } else { _controllable = true; + // UpdateAnimation() was probably skipped in this step, because _controllable was false, so call it here + UpdateAnimation(timeMult); } }); @@ -1023,20 +1025,21 @@ namespace Jazz2::Actors case PlayerType::Lori: scaleY *= 1.3f; break; } + bool facingLeft = IsFacingLeft(); bool lookUp = (_currentAnimation->State & AnimState::Lookup) == AnimState::Lookup; std::int32_t gunspotOffsetX = (_currentAnimation->Base->Hotspot.X - _currentAnimation->Base->Gunspot.X); std::int32_t gunspotOffsetY = (_currentAnimation->Base->Hotspot.Y - _currentAnimation->Base->Gunspot.Y); float gunspotPosX, gunspotPosY; if (lookUp) { - gunspotPosX = _pos.X + (gunspotOffsetX) * (IsFacingLeft() ? 1 : -1); + gunspotPosX = _pos.X + (gunspotOffsetX) * (facingLeft ? 1 : -1); gunspotPosY = _pos.Y - (gunspotOffsetY - 3) - res->Base->FrameDimensions.Y; } else { - gunspotPosX = _pos.X + (gunspotOffsetX - 7) * (IsFacingLeft() ? 1 : -1); + gunspotPosX = _pos.X + (gunspotOffsetX - 7) * (facingLeft ? 1 : -1); gunspotPosY = _pos.Y - gunspotOffsetY; - if (IsFacingLeft()) { + if (facingLeft) { + texBiasX += texScaleX; texScaleX *= -1.0f; - texBiasX += 1.0f; } } diff --git a/Sources/Jazz2/LevelHandler.cpp b/Sources/Jazz2/LevelHandler.cpp index 5ba52c18..b7a52836 100644 --- a/Sources/Jazz2/LevelHandler.cpp +++ b/Sources/Jazz2/LevelHandler.cpp @@ -1555,7 +1555,7 @@ namespace Jazz2 auto* targetObj = _players[0]; - // View Bounds Animation + // Viewport bounds animation if (_viewBounds != _viewBoundsTarget) { if (std::abs(_viewBounds.X - _viewBoundsTarget.X) < 2.0f) { _viewBounds = _viewBoundsTarget; @@ -1570,7 +1570,16 @@ namespace Jazz2 // The position to focus on Vector2i halfView = _view->size() / 2; Vector2f focusPos = targetObj->_pos; + + // If player doesn't move but has some speed, it's probably stuck, so reset the speed Vector2f focusSpeed = targetObj->_speed; + if (std::abs(_cameraLastPos.X - focusPos.X) < 1.0f) { + focusSpeed.X = 0.0f; + } + if (std::abs(_cameraLastPos.Y - focusPos.Y) < 1.0f) { + focusSpeed.Y = 0.0f; + } + Vector2f focusVelocity = Vector2f(std::abs(focusSpeed.X), std::abs(focusSpeed.Y)); // Camera responsiveness (smoothing unexpected movements) diff --git a/Sources/Jazz2/PreferencesCache.cpp b/Sources/Jazz2/PreferencesCache.cpp index 3c0a6cd3..f80fe09a 100644 --- a/Sources/Jazz2/PreferencesCache.cpp +++ b/Sources/Jazz2/PreferencesCache.cpp @@ -323,6 +323,9 @@ namespace Jazz2 void PreferencesCache::Save() { + // `FirstRun` is true only if config file doesn't exist yet + FirstRun = false; + fs::CreateDirectories(fs::GetDirectoryName(_configPath)); auto so = fs::Open(_configPath, FileAccessMode::Write); diff --git a/Sources/Jazz2/UI/Menu/FirstRunSection.cpp b/Sources/Jazz2/UI/Menu/FirstRunSection.cpp index 9978e764..9bdcb726 100644 --- a/Sources/Jazz2/UI/Menu/FirstRunSection.cpp +++ b/Sources/Jazz2/UI/Menu/FirstRunSection.cpp @@ -18,25 +18,6 @@ namespace Jazz2::UI::Menu _items.emplace_back(FirstRunItem { FirstRunItemType::ReforgedPreset, _("Reforged"), _("I want to play the game with something new.") }); } - FirstRunSection::~FirstRunSection() - { - if (!_committed) { - // If no option has been selected, set everything to default - PreferencesCache::EnableReforgedGameplay = true; - PreferencesCache::EnableReforgedHUD = true; - PreferencesCache::EnableReforgedMainMenu = true; - PreferencesCache::EnableLedgeClimb = true; - - bool isReforged = (_items[_selectedIndex].Item.Type == FirstRunItemType::ReforgedPreset); - if (!isReforged) { - // Reload default main menu music if needed - _root->ApplyPreferencesChanges(ChangedPreferencesType::MainMenu); - } - } - - PreferencesCache::Save(); - } - Recti FirstRunSection::GetClipRectangle(const Vector2i& viewSize) { float topLine = TopLine + 66.0f; @@ -88,7 +69,7 @@ namespace Jazz2::UI::Menu float centerX = canvas->ViewSize.X * 0.5f; if (isSelected) { - float size = 0.8f + IMenuContainer::EaseOutElastic(_animation) * 0.6f; + float size = 0.7f + IMenuContainer::EaseOutElastic(_animation) * 0.6f; _root->DrawElement(MenuGlow, 0, centerX, item.Y + 10.0f, IMenuContainer::MainLayer, Alignment::Center, Colorf(1.0f, 1.0f, 1.0f, 0.2f), 22.0f, 12.0f, true); @@ -124,6 +105,7 @@ namespace Jazz2::UI::Menu PreferencesCache::EnableReforgedGameplay = isReforged; PreferencesCache::EnableReforgedHUD = isReforged; PreferencesCache::EnableLedgeClimb = isReforged; + PreferencesCache::Save(); _committed = true; _animation = 0.0f; diff --git a/Sources/Jazz2/UI/Menu/FirstRunSection.h b/Sources/Jazz2/UI/Menu/FirstRunSection.h index b7638277..b0a6aa05 100644 --- a/Sources/Jazz2/UI/Menu/FirstRunSection.h +++ b/Sources/Jazz2/UI/Menu/FirstRunSection.h @@ -19,7 +19,6 @@ namespace Jazz2::UI::Menu { public: FirstRunSection(); - ~FirstRunSection(); Recti GetClipRectangle(const Vector2i& viewSize) override; diff --git a/Sources/Jazz2/UI/Menu/MainMenu.cpp b/Sources/Jazz2/UI/Menu/MainMenu.cpp index a9d7ab27..e6751e6d 100644 --- a/Sources/Jazz2/UI/Menu/MainMenu.cpp +++ b/Sources/Jazz2/UI/Menu/MainMenu.cpp @@ -52,7 +52,8 @@ namespace Jazz2::UI::Menu SwitchToSection(); - if (PreferencesCache::FirstRun) { + bool isPlayable = ((_root->GetFlags() & IRootController::Flags::IsPlayable) == IRootController::Flags::IsPlayable); + if (PreferencesCache::FirstRun && isPlayable) { SwitchToSection(); }