Skip to content

Commit

Permalink
v1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
hiimjasmine00 committed May 20, 2024
1 parent 6a3b6b6 commit 6336997
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ project(FakeRate VERSION 1.0.0)
add_library(${PROJECT_NAME} SHARED
src/main.cpp
src/FREditPopup.cpp
src/FRUtilities.cpp
src/FakeRate.cpp
)

if (NOT DEFINED ENV{GEODE_SDK})
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Fake Rate Changelog
## v1.1.3 (2024-05-20)
- Fixed a mistake in the manifest that caused More Difficulties 1.1.0 to not be marked as incompatible

## v1.1.2 (2024-04-30)
- Marked More Difficulties version 1.1.0 as incompatible
- Fixed position of difficulty faces
Expand Down
6 changes: 3 additions & 3 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"geode": "2.0.0-beta.25",
"geode": "2.0.0-beta.26",
"gd": {
"android": "2.205",
"win": "2.204",
"mac": "2.200"
},
"version": "v1.1.2",
"version": "v1.1.3",
"id": "hiimjustin000.fake_rate",
"name": "Fake Rate",
"developer": "hiimjustin000",
Expand All @@ -18,7 +18,7 @@
"importance": "required"
}
],
"incompatibilies": [
"incompatibilities": [
{
"id": "uproxide.more_difficulties",
"importance": "breaking",
Expand Down
8 changes: 4 additions & 4 deletions src/FREditPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void FRLevelInfoLayer::checkFakeRate() {
.id = m_level->m_levelID,
.stars = m_level->m_stars,
.feature = m_level->m_featured > 1 ? m_level->m_isEpic + 1 : 0,
.difficulty = FRUtilities::getDifficultyFromLevel(m_level)
.difficulty = FakeRate::getDifficultyFromLevel(m_level)
};
}

Expand Down Expand Up @@ -117,7 +117,7 @@ void FRLevelInfoLayer::updateFakeRate(int stars, int feature, int difficulty, bo
if (showStars) {
m_orbsIcon->setPositionY(yPos - yOffset * 2.0f);
m_orbsLabel->setPositionY(m_orbsIcon->getPositionY());
auto orbs = FRUtilities::getBaseCurrency(stars);
auto orbs = FakeRate::getBaseCurrency(stars);
auto totalOrbs = (int)floorf(orbs * 1.25f);
m_orbsLabel->setString(fmt::format("{}/{}", (int)floorf(m_level->m_normalPercent != 100 ? orbs * m_level->m_normalPercent / 100.0f : totalOrbs), totalOrbs).c_str());
m_orbsLabel->limitLabelWidth(60.0f, 0.5f, 0.0f);
Expand Down Expand Up @@ -146,7 +146,7 @@ void FRLevelInfoLayer::fixMoreDifficultiesIncompatibility() {
auto moreDifficultiesSprite = static_cast<CCSprite*>(getChildByID("uproxide.more_difficulties/more-difficulties-spr"));
if (moreDifficultiesSprite) {
moreDifficultiesSprite->setVisible(false);
spriteName = FRUtilities::getSpriteName(moreDifficultiesSprite);
spriteName = FakeRate::getSpriteName(moreDifficultiesSprite);
}
m_difficultySprite->setOpacity(255);

Expand Down Expand Up @@ -350,7 +350,7 @@ void FREditPopup::onFeatureRight(CCObject*) {
}

void FREditPopup::updateLabels() {
m_difficulty = m_stars >= 10 ? m_difficulty > 5 ? m_difficulty : 7 : FRUtilities::getDifficultyForStars(m_stars);
m_difficulty = m_stars >= 10 ? m_difficulty > 5 ? m_difficulty : 7 : FakeRate::getDifficultyForStars(m_stars);
m_difficultySprite->updateDifficultyFrame(m_difficulty, (GJDifficultyName)1);
m_difficultySprite->updateFeatureState((GJFeatureState)m_feature);
m_difficultySprite->setPositionY(85.0f + (m_difficulty > 5 ? 5.0f : 0.0f));
Expand Down
4 changes: 2 additions & 2 deletions src/FREditPopup.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <vector>
#include <Geode/modify/LevelInfoLayer.hpp>
#include "FRUtilities.hpp"
#include "FakeRate.hpp"

struct FakeRateSaveData {
int id;
Expand All @@ -9,6 +8,7 @@ struct FakeRateSaveData {
int difficulty;
};

#include <Geode/modify/LevelInfoLayer.hpp>
class FRLevelInfoLayerDummy; struct FRLevelInfoLayer : Modify<FRLevelInfoLayer, LevelInfoLayer> {
struct Fields {
FakeRateSaveData m_fakeRateData;
Expand Down
10 changes: 5 additions & 5 deletions src/FRUtilities.cpp → src/FakeRate.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "FRUtilities.hpp"
#include "FakeRate.hpp"

int FRUtilities::getBaseCurrency(int stars) {
int FakeRate::getBaseCurrency(int stars) {
switch (stars) {
case 2: return 40;
case 3: return 60;
Expand All @@ -15,7 +15,7 @@ int FRUtilities::getBaseCurrency(int stars) {
}
}

int FRUtilities::getDifficultyForStars(int stars) {
int FakeRate::getDifficultyForStars(int stars) {
switch (stars) {
case 0: return 0;
case 1: return -1;
Expand All @@ -29,7 +29,7 @@ int FRUtilities::getDifficultyForStars(int stars) {
}
}

int FRUtilities::getDifficultyFromLevel(GJGameLevel* level) {
int FakeRate::getDifficultyFromLevel(GJGameLevel* level) {
auto difficulty = level->getAverageDifficulty();
if (level->m_demon > 0) switch (level->m_demonDifficulty) {
case 3: difficulty = 7; break;
Expand All @@ -41,7 +41,7 @@ int FRUtilities::getDifficultyFromLevel(GJGameLevel* level) {
return difficulty;
}

std::string FRUtilities::getSpriteName(CCNode* node) {
std::string FakeRate::getSpriteName(CCNode* node) {
if (auto spriteNode = typeinfo_cast<CCSprite*>(node)) {
if (auto texture = spriteNode->getTexture()) {
for (auto [key, frame] : CCDictionaryExt<std::string, CCSpriteFrame*>(CCSpriteFrameCache::sharedSpriteFrameCache()->m_pSpriteFrames)) {
Expand Down
2 changes: 1 addition & 1 deletion src/FRUtilities.hpp → src/FakeRate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using namespace geode::prelude;

class FRUtilities {
class FakeRate {
public:
static int getBaseCurrency(int);
static int getDifficultyForStars(int);
Expand Down
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <Geode/modify/LevelCell.hpp>
#include "FREditPopup.hpp"

#include <Geode/modify/LevelCell.hpp>
class $modify(FRLevelCell, LevelCell) {
static void onModify(auto& self) {
(void)self.setHookPriority("LevelCell::loadFromLevel", -100);
Expand Down Expand Up @@ -108,7 +108,7 @@ class $modify(FRLevelCell, LevelCell) {
orbsLabel->setID("orbs-label");
m_mainLayer->addChild(orbsLabel);
}
auto orbs = FRUtilities::getBaseCurrency(fakeRateData.stars);
auto orbs = FakeRate::getBaseCurrency(fakeRateData.stars);
auto totalOrbs = (int)floorf(orbs * 1.25f);
log::info("{}", level->m_normalPercent.value());
orbsLabel->setString((level->m_normalPercent == 100 ?
Expand All @@ -134,7 +134,7 @@ class $modify(FRLevelCell, LevelCell) {
auto moreDifficultiesSprite = static_cast<CCSprite*>(difficultyContainer->getChildByID("uproxide.more_difficulties/more-difficulties-spr"));
if (moreDifficultiesSprite) {
moreDifficultiesSprite->setVisible(false);
spriteName = FRUtilities::getSpriteName(moreDifficultiesSprite);
spriteName = FakeRate::getSpriteName(moreDifficultiesSprite);
}
auto difficultySprite = static_cast<GJDifficultySprite*>(difficultyContainer->getChildByID("difficulty-sprite"));
difficultySprite->setOpacity(255);
Expand Down

0 comments on commit 6336997

Please sign in to comment.