Skip to content

Commit

Permalink
v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hiimjasmine00 committed Jul 25, 2024
1 parent d1720aa commit 17dab27
Show file tree
Hide file tree
Showing 19 changed files with 593 additions and 141 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ jobs:
- uses: actions/checkout@v4

- name: Build the mod
uses: geode-sdk/build-geode-mod@main
uses: hiimjustin000/build-geode-mod@commit-hash
with:
build-config: RelWithDebInfo
export-pdb: true
sdk: 49c8d38
cli: nightly
combine: true
target: ${{ matrix.config.target }}

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.9)
project(FakeRate VERSION 1.3.0)

add_library(${PROJECT_NAME} SHARED
src/FakeRate.cpp
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@
A mod that allows you to assign a fake rating to online levels.

# Features
- Ability to give online levels a fake rating
- This can be done either through a button in the level info screen or by editing save data
- The popup allows you to independently rate the level's difficulty, stars, and featured status
- Ability to give online levels a fake rating, which can be done either through a button in the level info screen or by editing save data
- A popup that allows you to independently rate the level's difficulty, stars, feature status, and coin verification status

# Credits
- [Uproxide](https://gdbrowser.com/u/25397826) - Some inspiration for the mod
- [hiimjustin000](https://gdbrowser.com/u/7466002) - Creator of the mod

# Gallery
![Fake Rate Popup](./resources/image1.png)\
![Difficulty Popup](./resources/image2.png)\
![Grandpa Demon Popup](./resources/image3.png)\
![Demons In Between Popup](./resources/image4.png)\
![Stars Popup](./resources/image5.png)\
![Feature Popup](./resources/image6.png)

# License
This mod is licensed under the [MIT License](./LICENSE).
17 changes: 14 additions & 3 deletions about.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
A mod that allows you to assign a fake rating to online levels.

# Features
- Ability to give online levels a fake rating
- This can be done either through a button in the level info screen or by editing save data
- The popup allows you to independently rate the level's difficulty, stars, and featured status
- Ability to give online levels a fake rating, which can be done either through a button in the level info screen or by editing save data
- A popup that allows you to independently rate the level's difficulty, stars, feature status, and coin verification status

# Credits
- [Uproxide](user:25397826) - Some inspiration for the mod
- [hiimjustin000](user:7466002) - Creator of the mod

# Gallery
![Fake Rate Popup](hiimjustin000.fake_rate/image1.png?scale=0.9)\
![Difficulty Popup](hiimjustin000.fake_rate/image2.png?scale=0.9)\
![Grandpa Demon Popup](hiimjustin000.fake_rate/image3.png?scale=1.2)\
![Demons In Between Popup](hiimjustin000.fake_rate/image4.png?scale=0.9)\
![Stars Popup](hiimjustin000.fake_rate/image5.png?scale=1.4)\
![Feature Popup](hiimjustin000.fake_rate/image6.png?scale=0.9)
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Fake Rate Changelog
## v1.3.0 (2024-07-25)
- Added Grandpa Demon and Demons In Between support
- Added the ability to customize coin verification status
- Added the ability to set negative stars
- Added a gallery to the mod's about page

## v1.2.9 (2024-07-05)
- Fixed a bug that caused two difficulty faces to be toggled in the difficulty selection popup with More Difficulties enabled
- Fixed incompatibility with the mod "GodlikeFaces" by adyagmd
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": "3.1.1",
"geode": "3.3.0",
"gd": {
"android": "2.206",
"win": "2.206",
"mac": "2.206"
},
"version": "v1.2.9",
"version": "v1.3.0",
"id": "hiimjustin000.fake_rate",
"name": "Fake Rate",
"developer": "hiimjustin000",
Expand Down
Binary file added resources/FR_dibBtn_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/FR_grdBtn_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/image3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/image4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/image5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/image6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
433 changes: 365 additions & 68 deletions src/FREditPopup.cpp

Large diffs are not rendered by default.

62 changes: 47 additions & 15 deletions src/FREditPopup.hpp
Original file line number Diff line number Diff line change
@@ -1,58 +1,90 @@
#include "FakeRate.hpp"

typedef MiniFunction<void(int, int, int, int, bool, bool)> UpdateFakeRateCallback;
typedef MiniFunction<void(int, int)> SetDifficultyCallback;
typedef MiniFunction<void(FakeRateSaveData, bool)> UpdateFakeRateCallback;
typedef MiniFunction<void(int, int, int, int)> SetDifficultyCallback;
typedef MiniFunction<void(int)> SetFeatureCallback;
typedef MiniFunction<void(int)> SetGRDCallback;
typedef MiniFunction<void(int, int)> SetDIBCallback;

class FREditPopup : public Popup<GJGameLevel*, int, int, int, int, UpdateFakeRateCallback>, SetIDPopupDelegate {
class FREditPopup : public Popup<GJGameLevel*, FakeRateSaveData, UpdateFakeRateCallback>, SetIDPopupDelegate {
protected:
GJGameLevel* m_level;
int m_stars;
int m_feature;
int m_difficulty;
int m_moreDifficultiesOverride;
int m_grandpaDemonOverride;
int m_demonsInBetweenOverride;
bool m_coins;
bool m_legacy;
GJDifficultySprite* m_difficultySprite;
CCSprite* m_casualSprite;
CCSprite* m_toughSprite;
CCSprite* m_cruelSprite;
CCSprite* m_mdSprite;
CCSprite* m_grdSprite;
CCSprite* m_dibSprite;
CCSprite* m_starSprite;
CCLabelBMFont* m_starsLabel;
CCArray* m_coins;
CCArray* m_coinSprites;

bool setup(GJGameLevel*, int, int, int, int, UpdateFakeRateCallback) override;
bool setup(GJGameLevel*, FakeRateSaveData, UpdateFakeRateCallback) override;
void updateLabels();
public:
static FREditPopup* create(GJGameLevel*, int, int, int, int, UpdateFakeRateCallback);
static FREditPopup* create(GJGameLevel*, FakeRateSaveData, UpdateFakeRateCallback);

void setIDPopupClosed(SetIDPopup*, int) override;

~FREditPopup() override;
};

class FRSetDifficultyPopup : public Popup<int, int, bool, SetDifficultyCallback> {
class FRSetDifficultyPopup : public Popup<int, int, int, int, bool, SetDifficultyCallback> {
protected:
int m_difficulty;
int m_moreDifficultiesOverride;
int m_grandpaDemonOverride;
int m_demonsInBetweenOverride;
bool m_legacy;
CCMenuItemSpriteExtra* m_selected;

bool setup(int, int, bool, SetDifficultyCallback) override;
bool setup(int, int, int, int, bool, SetDifficultyCallback) override;
void createDifficultyToggle(CCMenu*, int, int);
public:
static FRSetDifficultyPopup* create(int, int, bool, SetDifficultyCallback);
static FRSetDifficultyPopup* create(int, int, int, int, bool, SetDifficultyCallback);
};

class FRSetFeaturePopup : public Popup<int, int, int, bool, SetFeatureCallback> {
class FRSetFeaturePopup : public Popup<int, int, int, int, int, bool, SetFeatureCallback> {
protected:
GJFeatureState m_feature;
int m_difficulty;
int m_moreDifficultiesOverride;
int m_grandpaDemonOverride;
int m_demonsInBetweenOverride;
bool m_legacy;
CCMenuItemSpriteExtra* m_selected;

bool setup(int, int, int, bool, SetFeatureCallback) override;
bool setup(int, int, int, int, int, bool, SetFeatureCallback) override;
void createFeatureToggle(CCMenu*, GJFeatureState);
public:
static FRSetFeaturePopup* create(int, int, int, bool, SetFeatureCallback);
static FRSetFeaturePopup* create(int, int, int, int, int, bool, SetFeatureCallback);
};

class FRGRDPopup : public Popup<int, SetGRDCallback> {
protected:
int m_grandpaDemonOverride;
CCMenuItemSpriteExtra* m_selected;

bool setup(int, SetGRDCallback) override;
void createGRDToggle(CCMenu*, int);
public:
static FRGRDPopup* create(int, SetGRDCallback);
};

class FRDIBPopup : public Popup<int, int, SetDIBCallback> {
protected:
int m_difficulty;
int m_demonsInBetweenOverride;
CCMenuItemSpriteExtra* m_selected;

bool setup(int, int, SetDIBCallback) override;
void createDIBToggle(CCMenu*, int, int);
public:
static FRDIBPopup* create(int, int, SetDIBCallback);
};
30 changes: 30 additions & 0 deletions src/FakeRate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,33 @@ void FakeRate::toggle(CCNode* node, bool enabled) {
}
}
}

CCPoint FakeRate::getDIBOffset(int difficulty, GJDifficultyName name) {
if (difficulty < 1 || difficulty > 20) return { 0.0f, 0.0f };
return name == GJDifficultyName::Long ? LONG_OFFSETS[difficulty - 1] : SHORT_OFFSETS[difficulty - 1];
}

int FakeRate::getGRDOverride(CCSprite* sprite) {
auto sprName = getSpriteName(sprite);
if (sprName.substr(sprName.size() - 5) == "_text") sprName = sprName.substr(0, sprName.size() - 5);

auto pos = sprName.find("GrD_demon");
if (pos != std::string::npos) {
auto num = sprName.substr(pos + 9);
return std::stoi(num) + 1;
}
else return 0;
}

int FakeRate::getDIBOverride(CCSprite* sprite) {
auto sprName = getSpriteName(sprite);
if (sprName.substr(sprName.size() - 12) == "_btn_001.png") sprName = sprName.substr(0, sprName.size() - 12);
else if (sprName.substr(sprName.size() - 13) == "_btn2_001.png") sprName = sprName.substr(0, sprName.size() - 13);

auto pos = sprName.find("DIB_");
if (pos != std::string::npos) {
auto num = sprName.substr(pos + 4, 2);
return std::stoi(num);
}
else return 0;
}
29 changes: 27 additions & 2 deletions src/FakeRate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,33 @@ struct FakeRateSaveData {
int feature;
int difficulty;
int moreDifficultiesOverride;
int grandpaDemonOverride;
int demonsInBetweenOverride;
bool coins;
};

class FakeRate {
private:
inline static std::vector<CCPoint> LONG_OFFSETS = {
{ 0.0f, -5.0f }, { 0.125f, -5.0f }, { 0.0f, -5.0f }, { 0.0f, -5.125f }, { 0.25f, -5.0f },
{ 0.125f, -4.75f }, { 0.0f, -5.0f }, { 0.0f, -4.125f }, { -0.125f, -4.125f }, { 0.0f, -4.0f },
{ -0.125f, -4.125f }, { 0.0f, -4.125f }, { 0.125f, -4.125f }, { 0.0f, -4.125f }, { 0.0f, -4.125f },
{ 0.0f, -3.625f }, { 0.0f, -3.625f }, { 0.0f, -3.5f }, { 0.0f, -3.5f }, { 0.0f, -3.5f }
};
inline static std::vector<CCPoint> SHORT_OFFSETS = {
{ -0.125f, -0.25f }, { -0.125f, -0.25f }, { -0.125f, -0.25f }, { -0.125f, -0.375f }, { -0.125f, -0.25f },
{ -0.125f, -0.25f }, { -0.125f, -0.375f }, { -0.125f, 0.5f }, { -0.125f, 0.5f }, { -0.125f, 0.25f },
{ -0.125f, 0.5f }, { 0.125f, 0.5f }, { 0.125f, 0.5f }, { 0.125f, 0.5f }, { 0.0f, 0.5f },
{ 0.0f, 1.25f }, { 0.0f, 1.25f }, { 0.0f, 1.125f }, { 0.0f, 1.125f }, { 0.0f, 1.125f }
};
public:
static int getBaseCurrency(int);
static int getDifficultyFromLevel(GJGameLevel*);
static std::string getSpriteName(CCSprite*);
static void toggle(CCNode*, bool);
static CCPoint getDIBOffset(int, GJDifficultyName);
static int getGRDOverride(CCSprite*);
static int getDIBOverride(CCSprite*);
};

template<>
Expand All @@ -28,7 +47,10 @@ struct matjson::Serialize<std::vector<FakeRateSaveData>> {
.stars = item["stars"].as_int(),
.feature = item["feature"].as_int(),
.difficulty = item["difficulty"].as_int(),
.moreDifficultiesOverride = item.contains("more-difficulties-override") ? item["more-difficulties-override"].as_int() : 0
.moreDifficultiesOverride = item.contains("more-difficulties-override") ? item["more-difficulties-override"].as_int() : 0,
.grandpaDemonOverride = item.contains("grandpa-demon-override") ? item["grandpa-demon-override"].as_int() : 0,
.demonsInBetweenOverride = item.contains("demons-in-between-override") ? item["demons-in-between-override"].as_int() : 0,
.coins = item.contains("coins") ? item["coins"].as_bool() : true
});
}
return vec;
Expand All @@ -42,7 +64,10 @@ struct matjson::Serialize<std::vector<FakeRateSaveData>> {
{ "stars", item.stars },
{ "feature", item.feature },
{ "difficulty", item.difficulty },
{ "more-difficulties-override", item.moreDifficultiesOverride }
{ "more-difficulties-override", item.moreDifficultiesOverride },
{ "grandpa-demon-override", item.grandpaDemonOverride },
{ "demons-in-between-override", item.demonsInBetweenOverride },
{ "coins", item.coins }
});
}
return arr;
Expand Down
Loading

0 comments on commit 17dab27

Please sign in to comment.