Skip to content

Commit

Permalink
feat(PlayLayer): Fix potential MacOS destroyPlayer bug (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaghettDev committed Apr 26, 2024
1 parent f8bebf9 commit bbf3d4d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.0.6] - 2024-04-26

### Fixed

- Potential MacOS bug

## [2.0.5] - 2024-04-19

### Changed
Expand Down
4 changes: 2 additions & 2 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"geode": "2.0.0-beta.24",
"geode": "2.0.0-beta.25",
"gd": {
"win": "2.204",
"android": "2.205",
"mac": "2.200"
},
"version": "v2.0.5",
"version": "v2.0.6",
"id": "spaghettdev.gd-roulette",
"name": "GD-Roulette",
"developer": "SpaghettDev",
Expand Down
9 changes: 7 additions & 2 deletions src/layers/PlayLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,22 @@ class $modify(PlayLayerPause, PlayLayer)
void destroyPlayer(PlayerObject* player, GameObject* obj)
{
#ifdef GEODE_IS_MACOS
const float currentDelta = delta;

PlayLayer::destroyPlayer(player, obj);

const int percentage = m_level->m_normalPercent;
#else
const int percentage = this->getCurrentPercentInt();
const float currentDelta = delta;
#endif // GEODE_IS_MACOS
if (
g_rouletteManager.isPlaying &&
this->m_level->m_levelID == g_rouletteManager.currentLevelID &&
!this->m_isPracticeMode &&
percentage >= g_rouletteManager.levelPercentageGoal
) {
if (delta > .2f/* && !this->m_player1->m_isDead*/)
if (currentDelta > .2f/* && !this->m_player1->m_isDead*/)
{
g_rouletteManager.hasFinishedPreviousLevel = true;
g_rouletteManager.currentLevelPercentage = percentage;
Expand All @@ -75,7 +78,9 @@ class $modify(PlayLayerPause, PlayLayer)

m_fields->pauseGameAction = runningScene->runAction(
CCSequence::create(
CCDelayTime::create(1.f), CCCallFunc::create(runningScene, callfunc_selector(PlayLayerPause::pause)), nullptr
CCDelayTime::create(1.f),
CCCallFunc::create(runningScene, callfunc_selector(PlayLayerPause::pause)),
nullptr
)
);
}
Expand Down

0 comments on commit bbf3d4d

Please sign in to comment.