Skip to content

Commit

Permalink
Version 2.7.0, reverted dead zones, improved low-res support, adjuste…
Browse files Browse the repository at this point in the history
…d audio SmoothPanRadius
  • Loading branch information
deathkiller committed May 27, 2024
1 parent 9fb140c commit 59313e8
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set(NCINE_APP_DESCRIPTION "Open-source reimplementation of Jazz Jackrabbit 2")
set(NCINE_APP_DESCRIPTION_FULL "Jazz² Resurrection is reimplementation of the game Jazz Jackrabbit 2 released in 1998. Supports various versions of the game (Shareware Demo, Holiday Hare '98, The Secret Files and Christmas Chronicles). Also, it partially supports some features of JJ2+ extension and MLLE.\n\nFurther information can be found here: https://deat.tk/jazz2/")
set(NCINE_APP_VENDOR "Dan R.")
set(NCINE_REVERSE_DNS "jazz2.resurrection")
set(NCINE_VERSION "2.6.0")
set(NCINE_VERSION "2.7.0")

project(Jazz2
VERSION "${NCINE_VERSION}"
Expand Down
2 changes: 1 addition & 1 deletion Sources/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# define NCINE_APP_NAME "Jazz² Resurrection"
#endif
#if !defined(NCINE_VERSION)
# define NCINE_VERSION "2.6.0"
# define NCINE_VERSION "2.7.0"
#endif
#if !defined(NCINE_BUILD_YEAR)
# define NCINE_BUILD_YEAR "2024"
Expand Down
3 changes: 2 additions & 1 deletion Sources/Jazz2/Actors/ActorBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "Player.h"
#include "Weapons/FreezerShot.h"
#include "Weapons/ToasterShot.h"
#include "Weapons/Thunderbolt.h"

#if !defined(WITH_COROUTINES)
# pragma message("WITH_COROUTINES is not defined, building without asynchronous loading support")
Expand Down Expand Up @@ -1099,7 +1100,7 @@ namespace Jazz2::Actors
_renderer.AnimPaused = true;
freezerShot->DecreaseHealth(INT32_MAX);
}
} else if(auto* toasterShot = runtime_cast<Weapons::ToasterShot*>(shot)) {
} else if(runtime_cast<Weapons::ToasterShot*>(shot) || runtime_cast<Weapons::Thunderbolt*>(shot)) {
_frozenTimeLeft = std::min(1.0f, _frozenTimeLeft);
}
}
Expand Down
4 changes: 3 additions & 1 deletion Sources/Jazz2/Actors/Environment/Spring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "../../Tiles/TileMap.h"
#include "../Weapons/ShieldFireShot.h"
#include "../Weapons/ToasterShot.h"
#include "../Weapons/Thunderbolt.h"

using namespace Jazz2::Tiles;

Expand Down Expand Up @@ -166,7 +167,8 @@ namespace Jazz2::Actors::Environment
{
if (_state == State::Frozen) {
ActorBase* actorBase = other.get();
if (runtime_cast<Weapons::ToasterShot*>(actorBase) || runtime_cast<Weapons::ShieldFireShot*>(actorBase)) {
if (runtime_cast<Weapons::ToasterShot*>(actorBase) || runtime_cast<Weapons::Thunderbolt*>(actorBase) ||
runtime_cast<Weapons::ShieldFireShot*>(actorBase)) {
_state = State::Heated;
SetState(ActorState::CanBeFrozen, true);
}
Expand Down
14 changes: 7 additions & 7 deletions Sources/Jazz2/UI/ControlScheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,30 +68,30 @@ namespace Jazz2::UI
if (analogAsButtons && axisValue >= IInputManager::AnalogButtonDeadZone) {
result.PressedActions |= (1ull << (std::uint32_t)i) | (1ull << (32 + (std::uint32_t)i));
}
if (i < 4 && axisValue > IInputManager::AnalogButtonDeadZone) {
if (i < 4 && axisValue > GamepadDeadZone) {
switch ((PlayerActions)i) {
case PlayerActions::Left: {
float axisValueAdjusted = -axisValue;
if (result.Movement.X < IInputManager::LeftStickDeadZone && axisValueAdjusted < result.Movement.X) {
if (result.Movement.X < GamepadDeadZone && axisValueAdjusted < result.Movement.X) {
result.Movement.X = axisValueAdjusted;
}
break;
}
case PlayerActions::Right: {
if (result.Movement.X > -IInputManager::LeftStickDeadZone && axisValue > result.Movement.X) {
if (result.Movement.X > -GamepadDeadZone && axisValue > result.Movement.X) {
result.Movement.X = axisValue;
}
break;
}
case PlayerActions::Up: {
float axisValueAdjusted = -axisValue;
if (result.Movement.Y < IInputManager::LeftStickDeadZone && axisValueAdjusted < result.Movement.Y) {
if (result.Movement.Y < GamepadDeadZone && axisValueAdjusted < result.Movement.Y) {
result.Movement.Y = axisValueAdjusted;
}
break;
}
case PlayerActions::Down: {
if (result.Movement.Y > -IInputManager::LeftStickDeadZone && axisValue > result.Movement.Y) {
if (result.Movement.Y > -GamepadDeadZone && axisValue > result.Movement.Y) {
result.Movement.Y = axisValue;
}
break;
Expand Down Expand Up @@ -134,12 +134,12 @@ namespace Jazz2::UI

// Normalize both axes
float movementLengthX = std::abs(result.Movement.X);
float normalizedLength = (movementLengthX - IInputManager::LeftStickDeadZone) / (1.0f - IInputManager::LeftStickDeadZone * 2.0f);
float normalizedLength = (movementLengthX - GamepadDeadZone) / (1.0f - GamepadDeadZone * 2.0f);
normalizedLength = std::clamp(normalizedLength, 0.0f, 1.0f);
result.Movement.X = std::copysign(normalizedLength, result.Movement.X);

float movementLengthY = std::abs(result.Movement.Y);
normalizedLength = (movementLengthY - IInputManager::LeftStickDeadZone) / (1.0f - IInputManager::LeftStickDeadZone * 2.0f);
normalizedLength = (movementLengthY - GamepadDeadZone) / (1.0f - GamepadDeadZone * 2.0f);
normalizedLength = std::clamp(normalizedLength, 0.0f, 1.0f);
result.Movement.Y = std::copysign(normalizedLength, result.Movement.Y);

Expand Down
1 change: 1 addition & 0 deletions Sources/Jazz2/UI/ControlScheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ namespace Jazz2::UI
static constexpr std::uint32_t GamepadNegativeMask = 0x20000000u;
static constexpr std::uint32_t GamepadIndexMask = 0x0FFF0000u;
static constexpr std::uint32_t ButtonMask = 0x0000FFFFu;
static constexpr float GamepadDeadZone = 0.1f;

static ControlSchemeMapping _mappings[MaxSupportedPlayers * (std::int32_t)PlayerActions::Count];
};
Expand Down
4 changes: 2 additions & 2 deletions Sources/Jazz2/UI/Menu/CustomLevelSelectSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ namespace Jazz2::UI::Menu
_y = (availableHeight - _height < 0.0f ? std::clamp(_y, availableHeight - _height, 0.0f) : 0.0f);

Vector2f center = Vector2f(centerX, topLine + 12.0f + _y);
float column1 = contentBounds.X + contentBounds.W * 0.25f;
float column2 = contentBounds.X + contentBounds.W * 0.52f;
float column1 = contentBounds.X + (contentBounds.W >= 460 ? (contentBounds.W * 0.25f) : 20.0f);
float column2 = contentBounds.X + (contentBounds.W >= 460 ? (contentBounds.W * 0.52f) : (contentBounds.W * 0.44f));

std::size_t itemsCount = _items.size();
for (int32_t i = 0; i < itemsCount; i++) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Jazz2/UI/Menu/EpisodeSelectSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ namespace Jazz2::UI::Menu
}

if (!_multiplayer && (item.Item.Flags & EpisodeDataFlags::CanContinue) == EpisodeDataFlags::CanContinue) {
float expandX = centerX + (item.Item.Description.DisplayName.size() + 3) * 2.8f * size + 40.0f;
float expandX = centerX + (item.Item.Description.DisplayName.size() + 3) * 2.8f * size + (canvas->ViewSize.X >= 400 ? 40.0f : 0.0f);
float moveX = expandedAnimation3 * -12.0f;
_root->DrawStringShadow(">"_s, charOffset, expandX + moveX, item.Y, IMenuContainer::FontLayer + 20,
Alignment::Right, Colorf(0.5f, 0.5f, 0.5f, 0.5f * std::min(1.0f, 0.6f + _animation)), 0.8f, 1.1f, 1.1f, 0.4f, 0.4f);
Expand Down
2 changes: 1 addition & 1 deletion Sources/Jazz2/UI/Menu/RemapControlsSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ namespace Jazz2::UI::Menu

auto& mapping = ControlScheme::_mappings[_currentPlayerIndex * (std::int32_t)PlayerActions::Count + (std::int32_t)item.Item.Type];

_root->DrawStringShadow(item.Item.DisplayName, charOffset, centerX * 0.3f, item.Y, IMenuContainer::FontLayer, Alignment::Left,
_root->DrawStringShadow(item.Item.DisplayName, charOffset, centerX * 0.3f, item.Y, IMenuContainer::MainLayer - 100, Alignment::Left,
isSelected && _waitForInput ? Colorf(0.62f, 0.44f, 0.34f, 0.5f) : Font::DefaultColor, 0.8f);

std::int32_t targetCount = (std::int32_t)mapping.Targets.size();
Expand Down
4 changes: 2 additions & 2 deletions Sources/Jazz2/UI/Menu/ServerSelectSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ namespace Jazz2::UI::Menu
_y = (availableHeight - _height < 0.0f ? std::clamp(_y, availableHeight - _height, 0.0f) : 0.0f);

Vector2f center = Vector2f(centerX, topLine + 12.0f + _y);
float column1 = contentBounds.X + contentBounds.W * 0.25f;
float column2 = contentBounds.X + contentBounds.W * 0.52f;
float column1 = contentBounds.X + (contentBounds.W >= 460 ? (contentBounds.W * 0.25f) : 20.0f);
float column2 = contentBounds.X + (contentBounds.W >= 460 ? (contentBounds.W * 0.52f) : (contentBounds.W * 0.44f));

std::size_t itemsCount = _items.size();
for (int32_t i = 0; i < itemsCount; i++) {
Expand Down
10 changes: 6 additions & 4 deletions Sources/Jazz2/UI/Menu/StartGameOptionsSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ namespace Jazz2::UI::Menu
}

float imageScale = (contentBounds.W >= 400 ? 1.0f : 0.5f);
_root->DrawElement(MenuDim, 0, center.X * 0.36f, center.Y * 1.4f, IMenuContainer::ShadowLayer - 2, Alignment::Center, Colorf::White, 24.0f * imageScale, 36.0f * imageScale);
_root->DrawElement(selectedDifficultyImage, _selectedDifficulty, center.X * 0.36f, center.Y * 1.4f + 3.0f, IMenuContainer::ShadowLayer, Alignment::Center, Colorf(0.0f, 0.0f, 0.0f, 0.2f * _imageTransition), 0.88f * imageScale, 0.88f * imageScale);
float imageOffsetX = center.X * (contentBounds.W >= 400 ? 0.36f : 0.32f);
float imageOffsetY = center.Y * (contentBounds.W >= 400 ? 1.4f : 1.06f);
_root->DrawElement(MenuDim, 0, imageOffsetX, imageOffsetY, IMenuContainer::ShadowLayer - 2, Alignment::Center, Colorf::White, 24.0f * imageScale, 36.0f * imageScale);
_root->DrawElement(selectedDifficultyImage, _selectedDifficulty, imageOffsetX, imageOffsetY + 3.0f, IMenuContainer::ShadowLayer, Alignment::Center, Colorf(0.0f, 0.0f, 0.0f, 0.2f * _imageTransition), 0.88f * imageScale, 0.88f * imageScale);

if (_imageTransition < 1.0f) {
AnimState lastDifficultyImage;
Expand All @@ -138,10 +140,10 @@ namespace Jazz2::UI::Menu
case 1: lastDifficultyImage = MenuDifficultySpaz; break;
case 2: lastDifficultyImage = MenuDifficultyLori; break;
}
_root->DrawElement(lastDifficultyImage, _lastDifficulty, center.X * 0.36f, center.Y * 1.4f, IMenuContainer::MainLayer, Alignment::Center, Colorf(1.0f, 1.0f, 1.0f, 1.0f - _imageTransition), 0.88f * imageScale, 0.88f * imageScale);
_root->DrawElement(lastDifficultyImage, _lastDifficulty, imageOffsetX, imageOffsetY, IMenuContainer::MainLayer, Alignment::Center, Colorf(1.0f, 1.0f, 1.0f, 1.0f - _imageTransition), 0.88f * imageScale, 0.88f * imageScale);
}

_root->DrawElement(selectedDifficultyImage, _selectedDifficulty, center.X * 0.36f, center.Y * 1.4f, IMenuContainer::MainLayer, Alignment::Center, Colorf(1.0f, 1.0f, 1.0f, _imageTransition), 0.88f * imageScale, 0.88f * imageScale);
_root->DrawElement(selectedDifficultyImage, _selectedDifficulty, imageOffsetX, imageOffsetY, IMenuContainer::MainLayer, Alignment::Center, Colorf(1.0f, 1.0f, 1.0f, _imageTransition), 0.88f * imageScale, 0.88f * imageScale);

int32_t charOffset = 0;
for (int32_t i = 0; i < (int32_t)Item::Count; i++) {
Expand Down
8 changes: 4 additions & 4 deletions Sources/Resources.rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT

VS_VERSION_INFO VERSIONINFO
FILEVERSION 2, 6, 0, 0
PRODUCTVERSION 2, 6, 0, 0
FILEVERSION 2, 7, 0, 0
PRODUCTVERSION 2, 7, 0, 0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
Expand All @@ -21,12 +21,12 @@ VS_VERSION_INFO VERSIONINFO
BLOCK "000004b0"
{
VALUE "CompanyName", "Dan R."
VALUE "FileVersion", "2.6.0.0"
VALUE "FileVersion", "2.7.0.0"
VALUE "InternalName", "Jazz2"
VALUE "LegalCopyright", "© 2016-2024 Dan R."
VALUE "OriginalFilename", "Jazz2.exe"
VALUE "ProductName", "Jazz² Resurrection"
VALUE "ProductVersion", "2.6.0.0"
VALUE "ProductVersion", "2.7.0.0"
VALUE "FileDescription", "Jazz² Resurrection: Open-source reimplementation of Jazz Jackrabbit 2"
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/nCine/Audio/IAudioPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ namespace nCine
adjustedPos.Z *= 0.5f;

// Normalize audio position for smooth panning when near. Do it in physical units, so this remains constant regardless of unit changes.
constexpr float SmoothPanRadius = 16.0f;
constexpr float SmoothPanRadius = 32.0f;
float listenerSpaceDist = adjustedPos.Length();
if (listenerSpaceDist < SmoothPanRadius) {
float panningActive = listenerSpaceDist / SmoothPanRadius;
Expand Down
1 change: 1 addition & 0 deletions Sources/project.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
</provides>

<releases>
<release version="2.7.0" date="2024-05-27"/>
<release version="2.6.0" date="2024-03-08"/>
<release version="2.5.0" date="2024-01-26"/>
<release version="2.4.1" date="2023-12-28"/>
Expand Down

0 comments on commit 59313e8

Please sign in to comment.