From ac74bdbe56a6d9a47fcaca7ca215a1de6a186597 Mon Sep 17 00:00:00 2001 From: Justin Pridgen Date: Sat, 29 Jun 2024 01:28:28 -0400 Subject: [PATCH] v1.2.6 --- CMakeLists.txt | 2 +- changelog.md | 3 +++ mod.json | 2 +- src/main.cpp | 22 ++++++++++++---------- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06284fe..e8a0369 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64") set(CMAKE_CXX_VISIBILITY_PRESET hidden) -project(FakeRate VERSION 1.2.5) +project(FakeRate VERSION 1.2.6) add_library(${PROJECT_NAME} SHARED src/FakeRate.cpp diff --git a/changelog.md b/changelog.md index 43a1ba3..1ff0c81 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # Fake Rate Changelog +## v1.2.6 (2024-06-29) +- Fixed a bug that caused the More Difficulties difficulty face to be offset in the level info page + ## v1.2.5 (2024-06-28) - Fixed a bug that caused the More Difficulties difficulty face to be offset in the level cell diff --git a/mod.json b/mod.json index 434a327..f5c04c5 100644 --- a/mod.json +++ b/mod.json @@ -5,7 +5,7 @@ "win": "2.206", "mac": "2.206" }, - "version": "v1.2.5", + "version": "v1.2.6", "id": "hiimjustin000.fake_rate", "name": "Fake Rate", "developer": "hiimjustin000", diff --git a/src/main.cpp b/src/main.cpp index b950d40..3ff4a51 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -53,14 +53,16 @@ class $modify(FRLevelInfoLayer, LevelInfoLayer) { void checkFakeRate() { auto vec = Mod::get()->getSavedValue>("fake-rate", {}); auto it = std::find_if(vec.begin(), vec.end(), [this](auto const& item) { return item.id == m_level->m_levelID; }); - auto stars = m_level->m_stars; + auto stars = m_level->m_stars.value(); + auto starsRequested = m_level->m_starsRequested; if (it != vec.end()) updateFakeRate(it->stars, it->feature, it->difficulty, it->moreDifficultiesOverride, false, true); else m_fields->m_fakeRateData = { .id = m_level->m_levelID, .stars = stars, .feature = m_level->m_featured > 1 ? m_level->m_isEpic + 1 : 0, .difficulty = FakeRate::getDifficultyFromLevel(m_level), - .moreDifficultiesOverride = stars == 4 || stars == 7 || stars == 9 ? stars : 0 + .moreDifficultiesOverride = stars == 4 || stars == 7 || stars == 9 ? stars : + stars == 0 && (starsRequested == 4 || starsRequested == 7 || starsRequested == 9) ? starsRequested : 0 }; } @@ -200,10 +202,6 @@ class $modify(FRLevelInfoLayer, LevelInfoLayer) { } if (!moreDifficultiesSprite) { moreDifficultiesSprite = CCSprite::createWithSpriteFrameName(frameName); - moreDifficultiesSprite->setPosition(difficultySpriteParent->convertToWorldSpace({ - m_difficultySprite->getPositionX() + (legacy ? 0.0f : 0.25f), - m_difficultySprite->getPositionY() - (legacy ? 0.0f : 0.1f) - })); moreDifficultiesSprite->setID("uproxide.more_difficulties/more-difficulties-spr"); addChild(moreDifficultiesSprite, 3); } @@ -211,6 +209,10 @@ class $modify(FRLevelInfoLayer, LevelInfoLayer) { moreDifficultiesSprite->initWithSpriteFrameName(frameName); moreDifficultiesSprite->setVisible(true); } + moreDifficultiesSprite->setPosition(difficultySpriteParent->convertToWorldSpace({ + m_difficultySprite->getPositionX() + (legacy ? 0.0f : 0.25f), + m_difficultySprite->getPositionY() - (legacy ? 0.0f : 0.1f) + })); m_difficultySprite->setOpacity(0); } } @@ -380,10 +382,6 @@ class $modify(FRLevelCell, LevelCell) { } if (!moreDifficultiesSprite) { moreDifficultiesSprite = CCSprite::createWithSpriteFrameName(frameName); - moreDifficultiesSprite->setPosition({ - difficultySprite->getPositionX() + (legacy ? 0.0f : 0.25f), - difficultySprite->getPositionY() - (legacy ? 0.0f : 0.1f) - }); moreDifficultiesSprite->setID("uproxide.more_difficulties/more-difficulties-spr"); difficultyContainer->addChild(moreDifficultiesSprite, 3); } @@ -391,6 +389,10 @@ class $modify(FRLevelCell, LevelCell) { moreDifficultiesSprite->initWithSpriteFrameName(frameName); moreDifficultiesSprite->setVisible(true); } + moreDifficultiesSprite->setPosition({ + difficultySprite->getPositionX() + (legacy ? 0.0f : 0.25f), + difficultySprite->getPositionY() - (legacy ? 0.0f : 0.1f) + }); difficultySprite->setOpacity(0); } }