Skip to content

Commit

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

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

Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)

project(FakeRate VERSION 1.3.0)
project(FakeRate VERSION 1.3.1)

add_library(${PROJECT_NAME} SHARED
src/FakeRate.cpp
src/FREditPopup.cpp
src/FREffects.cpp
src/main.cpp
)

Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Fake Rate Changelog
## v1.3.1 (2024-07-30)
- Fixed Grandpa Demon's Infinity Demon sprite
- Adjusted Demons In Between difficulties
- Fixed an issue with overlapping demons

## v1.3.0 (2024-07-25)
- Added Grandpa Demon and Demons In Between support
- Added the ability to customize coin verification status
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.3.0",
"geode": "3.4.0",
"gd": {
"android": "2.206",
"win": "2.206",
"mac": "2.206"
},
"version": "v1.3.0",
"version": "v1.3.1",
"id": "hiimjustin000.fake_rate",
"name": "Fake Rate",
"developer": "hiimjustin000",
Expand Down
16 changes: 11 additions & 5 deletions src/FREditPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ bool FREditPopup::setup(GJGameLevel* level, FakeRateSaveData data, UpdateFakeRat
m_grdSprite->setPosition({ 60.0f, 105.0f });
m_grdSprite->setVisible(false);
m_mainLayer->addChild(m_grdSprite);

m_grdInfinity = FREffects::grdInfinity();
m_grdInfinity->setPosition({ 59.6f, 119.0f });
m_grdInfinity->setVisible(false);
m_mainLayer->addChild(m_grdInfinity, 30);
}
if (Loader::get()->isModLoaded("hiimjustin000.demons_in_between")) {
m_dibSprite = CCSprite::createWithSpriteFrameName("hiimjustin000.demons_in_between/DIB_01_btn2_001.png");
Expand Down Expand Up @@ -199,7 +204,6 @@ void FREditPopup::updateLabels() {
coins[i]->setPositionY(m_difficultySprite->getPositionY() - 31.5f - (m_stars != 0 ? 14.0f : 0.0f) - (m_difficulty > 5 ? 9.0f : 0.0f));
coins[i]->setColor(m_coins ? ccColor3B { 255, 255, 255 } : ccColor3B { 255, 175, 75 });
}
auto difficultyVisible = true;
m_difficultySprite->setOpacity(255);
if (Loader::get()->isModLoaded("uproxide.more_difficulties")) {
if (m_moreDifficultiesOverride == 4 || m_moreDifficultiesOverride == 7 || m_moreDifficultiesOverride == 9) {
Expand All @@ -217,6 +221,8 @@ void FREditPopup::updateLabels() {
fmt::format("itzkiba.grandpa_demon/GrD_demon{}_text.png", m_grandpaDemonOverride - 1).c_str()));
m_grdSprite->setPosition(m_difficultySprite->getPosition());
m_grdSprite->setVisible(true);
m_grdInfinity->setPosition(m_difficultySprite->getPosition() + CCPoint { -0.4f, 14.0f });
m_grdInfinity->setVisible(m_grandpaDemonOverride == 5);
m_difficultySprite->setOpacity(0);
}
else m_grdSprite->setVisible(false);
Expand Down Expand Up @@ -587,10 +593,10 @@ bool FRDIBPopup::setup(int difficulty, int demonsInBetweenOverride, SetDIBCallba
auto diff = 0;
switch (m_demonsInBetweenOverride) {
case 1: case 2: case 3: case 4: diff = 7; break;
case 5: case 6: case 7: case 8: diff = 8; break;
case 9: case 10: case 11: case 12: diff = 6; break;
case 13: case 14: case 15: case 16: diff = 9; break;
case 17: case 18: case 19: case 20: diff = 10; break;
case 5: case 6: case 7: case 8: case 9: diff = 8; break;
case 10: case 11: case 12: case 13: diff = 6; break;
case 14: case 15: case 16: case 17: diff = 9; break;
case 18: case 19: case 20: diff = 10; break;
}
callback(diff, m_demonsInBetweenOverride);
onClose(nullptr);
Expand Down
3 changes: 2 additions & 1 deletion src/FREditPopup.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "FakeRate.hpp"
#include "FREffects.hpp"

typedef MiniFunction<void(FakeRateSaveData, bool)> UpdateFakeRateCallback;
typedef MiniFunction<void(int, int, int, int)> SetDifficultyCallback;
Expand All @@ -20,6 +20,7 @@ class FREditPopup : public Popup<GJGameLevel*, FakeRateSaveData, UpdateFakeRateC
GJDifficultySprite* m_difficultySprite;
CCSprite* m_mdSprite;
CCSprite* m_grdSprite;
CCSprite* m_grdInfinity;
CCSprite* m_dibSprite;
CCSprite* m_starSprite;
CCLabelBMFont* m_starsLabel;
Expand Down
20 changes: 20 additions & 0 deletions src/FREffects.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "FREffects.hpp"

CCSprite* FREffects::grdInfinity() {
CCSprite* infinity = CCSprite::createWithSpriteFrameName("itzkiba.grandpa_demon/GrD_demon4_infinity.png");
infinity->setColor({ 255, 233, 136 });
infinity->setOpacity(100);
infinity->setScale(0.4f);
infinity->runAction(CCRepeatForever::create(CCSequence::create(
CCEaseSineInOut::create(CCFadeTo::create(1.5f, 200)),
CCEaseSineInOut::create(CCFadeTo::create(1.5f, 60)),
nullptr
)));
infinity->runAction(CCRepeatForever::create(CCSequence::create(
CCEaseSineInOut::create(CCScaleTo::create(1.5f, 0.45f)),
CCEaseSineInOut::create(CCScaleTo::create(1.5f, 0.35f)),
nullptr
)));
infinity->setBlendFunc({ 1, 1 });
return infinity;
}
6 changes: 6 additions & 0 deletions src/FREffects.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "FakeRate.hpp"

class FREffects {
public:
static CCSprite* grdInfinity();
};
35 changes: 25 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,19 @@ class $modify(FRLevelInfoLayer, LevelInfoLayer) {
.coins = coins
};

auto hideDifficulty = false;
auto hide = false;
if (auto betweenDifficultySprite = static_cast<CCSprite*>(getChildByID("hiimjustin000.demons_in_between/between-difficulty-sprite"))) {
betweenDifficultySprite->setVisible(remove);
m_difficultySprite->setOpacity(remove ? 0 : 255);
hideDifficulty = remove || hideDifficulty;
hide = remove || hide;
m_fields->m_fakeRateData.demonsInBetweenOverride = remove ? FakeRate::getDIBOverride(betweenDifficultySprite) : dbo;
}
auto gddpOverride = false;
if (auto gddpDifficultySprite = static_cast<CCSprite*>(getChildByID("gddp-difficulty"))) {
gddpOverride = gddpDifficultySprite->isVisible();
gddpDifficultySprite->setVisible(remove);
m_difficultySprite->setOpacity(remove ? 0 : 255);
hideDifficulty = remove || hideDifficulty;
hide = remove || hide;
}
if (Loader::get()->isModLoaded("itzkiba.grandpa_demon") && !gddpOverride) {
removeChildByTag(69420);
Expand All @@ -113,7 +113,7 @@ class $modify(FRLevelInfoLayer, LevelInfoLayer) {
if (auto grdInfinity = getChildByID("grd-infinity")) grdInfinity->setVisible(remove);
m_difficultySprite->setVisible(true);
m_difficultySprite->setOpacity(hasDemon && remove ? 0 : 255);
hideDifficulty = hasDemon && remove || hideDifficulty;
hide = (hasDemon && remove) || hide;
if (auto featureGlow = m_difficultySprite->getChildByTag(69420))
featureGlow->setPosition(m_difficultySprite->getContentSize() / 2);
m_fields->m_fakeRateData.grandpaDemonOverride = hasDemon && remove ? FakeRate::getGRDOverride(static_cast<CCSprite*>(getChildByID("grd-difficulty"))) : gdo;
Expand Down Expand Up @@ -175,34 +175,43 @@ class $modify(FRLevelInfoLayer, LevelInfoLayer) {
}
if (m_exactLengthLabel->isVisible()) m_exactLengthLabel->setPositionY(m_lengthLabel->getPositionY() - 14.0f);

m_difficultySprite->setOpacity(hideDifficulty ? 0 : 255);
if (Loader::get()->isModLoaded("uproxide.more_difficulties")) fixMoreDifficultiesIncompatibility(mdo, remove);
m_difficultySprite->setOpacity(hide ? 0 : 255);
if (Loader::get()->isModLoaded("uproxide.more_difficulties")) fixMoreDifficultiesIncompatibility(mdo, remove, hide);
if (Loader::get()->isModLoaded("itzkiba.grandpa_demon") && gdo > 0 && gdo < 7) {
auto grdSprite = CCSprite::createWithSpriteFrameName(fmt::format("itzkiba.grandpa_demon/GrD_demon{}_text.png", gdo - 1).c_str());
grdSprite->setID("grandpa-demon-sprite"_spr);
grdSprite->setPosition(position);
addChild(grdSprite, 3);
if (gdo == 5) {
auto grdInfinity = FREffects::grdInfinity();
grdInfinity->setID("grandpa-demon-infinity"_spr);
grdInfinity->setPosition(position + CCPoint { -0.4f, 14.0f });
addChild(grdInfinity, 30);
} else if (auto grdInfinity = getChildByID("grandpa-demon-infinity"_spr)) grdInfinity->removeFromParent();
m_difficultySprite->setOpacity(0);
}
else if (auto grdSprite = getChildByID("grandpa-demon-sprite"_spr)) grdSprite->removeFromParentAndCleanup(true);
else if (auto grdSprite = getChildByID("grandpa-demon-sprite"_spr)) {
grdSprite->removeFromParent();
if (auto grdInfinity = getChildByID("grandpa-demon-infinity"_spr)) grdInfinity->removeFromParent();
}
if (Loader::get()->isModLoaded("hiimjustin000.demons_in_between") && dbo > 0 && dbo < 21) {
auto dibSprite = CCSprite::createWithSpriteFrameName(fmt::format("hiimjustin000.demons_in_between/DIB_{:02d}_btn2_001.png", dbo).c_str());
dibSprite->setID("between-difficulty-sprite"_spr);
dibSprite->setPosition(position + FakeRate::getDIBOffset(dbo, GJDifficultyName::Long));
addChild(dibSprite, 3);
m_difficultySprite->setOpacity(0);
}
else if (auto dibSprite = getChildByID("between-difficulty-sprite"_spr)) dibSprite->removeFromParentAndCleanup(true);
else if (auto dibSprite = getChildByID("between-difficulty-sprite"_spr)) dibSprite->removeFromParent();
}

void fixMoreDifficultiesIncompatibility(int mdo, bool remove) {
void fixMoreDifficultiesIncompatibility(int mdo, bool remove, bool hide) {
auto spriteName = std::string();
auto moreDifficultiesSprite = static_cast<CCSprite*>(getChildByID("uproxide.more_difficulties/more-difficulties-spr"));
if (moreDifficultiesSprite) {
moreDifficultiesSprite->setVisible(false);
spriteName = FakeRate::getSpriteName(moreDifficultiesSprite);
}
m_difficultySprite->setOpacity(255);
m_difficultySprite->setOpacity(hide ? 0 : 255);

auto legacy = Loader::get()->getLoadedMod("uproxide.more_difficulties")->getSettingValue<bool>("legacy-difficulties");
auto frameName = "";
Expand Down Expand Up @@ -378,6 +387,12 @@ class $modify(FRLevelCell, LevelCell) {
grdSprite->setID("grandpa-demon-sprite"_spr);
grdSprite->setPosition(position);
difficultyContainer->addChild(grdSprite, 3);
if (gdo == 5) {
auto grdInfinity = FREffects::grdInfinity();
grdInfinity->setID("grandpa-demon-infinity"_spr);
grdInfinity->setPosition(position + CCPoint { -0.4f, 14.0f });
difficultyContainer->addChild(grdInfinity, 30);
}
difficultySprite->setOpacity(0);
}
auto dbo = fakeRateData.demonsInBetweenOverride;
Expand Down

0 comments on commit 3c043df

Please sign in to comment.