Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
deathkiller committed Jan 14, 2024
1 parent b382536 commit f34ae53
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 30 deletions.
Binary file modified Content/Translations/cs.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions Content/Translations/cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions Sources/Jazz2/Actors/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
});

Expand Down Expand Up @@ -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;
}
}

Expand Down
11 changes: 10 additions & 1 deletion Sources/Jazz2/LevelHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions Sources/Jazz2/PreferencesCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
22 changes: 2 additions & 20 deletions Sources/Jazz2/UI/Menu/FirstRunSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -124,6 +105,7 @@ namespace Jazz2::UI::Menu
PreferencesCache::EnableReforgedGameplay = isReforged;
PreferencesCache::EnableReforgedHUD = isReforged;
PreferencesCache::EnableLedgeClimb = isReforged;
PreferencesCache::Save();

_committed = true;
_animation = 0.0f;
Expand Down
1 change: 0 additions & 1 deletion Sources/Jazz2/UI/Menu/FirstRunSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ namespace Jazz2::UI::Menu
{
public:
FirstRunSection();
~FirstRunSection();

Recti GetClipRectangle(const Vector2i& viewSize) override;

Expand Down
3 changes: 2 additions & 1 deletion Sources/Jazz2/UI/Menu/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ namespace Jazz2::UI::Menu

SwitchToSection<BeginSection>();

if (PreferencesCache::FirstRun) {
bool isPlayable = ((_root->GetFlags() & IRootController::Flags::IsPlayable) == IRootController::Flags::IsPlayable);
if (PreferencesCache::FirstRun && isPlayable) {
SwitchToSection<FirstRunSection>();
}

Expand Down

0 comments on commit f34ae53

Please sign in to comment.