Skip to content

Commit 532790e

Browse files
committed
feat(geode): Update to geode v3.0.0-beta.1
1 parent bbf3d4d commit 532790e

File tree

15 files changed

+219
-171
lines changed

15 files changed

+219
-171
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
- name: Build the mod
3636
uses: geode-sdk/build-geode-mod@main
3737
with:
38+
cli: 'v3.0.0-beta.1'
39+
bindings: geode-sdk/bindings
40+
bindings-ref: main
3841
combine: true
3942
target: ${{ matrix.config.target }}
4043

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.21)
22
set(CMAKE_CXX_STANDARD 20)
33
set(CMAKE_CXX_STANDARD_REQUIRED ON)
4-
set(CMAKE_OSX_ARCHITECTURES "x86_64")
4+
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
55
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
66

77
project(GD-Roulette LANGUAGES CXX VERSION 1.0.0)

mod.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"geode": "2.0.0-beta.25",
2+
"geode": "3.0.0-beta.1",
33
"gd": {
4-
"win": "2.204",
5-
"android": "2.205",
6-
"mac": "2.200"
4+
"win": "2.206",
5+
"android": "2.206",
6+
"mac": "2.206"
77
},
8-
"version": "v2.0.6",
8+
"version": "v2.1.0",
99
"id": "spaghettdev.gd-roulette",
1010
"name": "GD-Roulette",
1111
"developer": "SpaghettDev",
@@ -27,7 +27,7 @@
2727
"dependencies": [
2828
{
2929
"id": "geode.node-ids",
30-
"version": ">=v1.3.0",
30+
"version": ">=v1.12.0",
3131
"importance": "required"
3232
}
3333
],

src/custom_nodes/RLDifficultyNode.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RLDifficultyNode* RLDifficultyNode::create(const DifficultyInfo& di)
1818

1919
RLDifficultyNode* RLDifficultyNode::create(GJDifficulty difficulty)
2020
{
21-
return create({ difficulty, RL_FEATURE_STATE::NONE });
21+
return create({ difficulty, GJFeatureState::None });
2222
}
2323

2424
bool RLDifficultyNode::init(const DifficultyInfo& di)
@@ -44,10 +44,10 @@ bool RLDifficultyNode::init(const DifficultyInfo& di)
4444

4545
switch (m_difficulty_info.feature_state)
4646
{
47-
case RL_FEATURE_STATE::FEATURED:
48-
case RL_FEATURE_STATE::EPIC:
49-
case RL_FEATURE_STATE::LEGENDARY:
50-
case RL_FEATURE_STATE::MYTHIC:
47+
case GJFeatureState::Featured:
48+
case GJFeatureState::Epic:
49+
case GJFeatureState::Legendary:
50+
case GJFeatureState::Mythic:
5151
m_feature_sprite = CCSprite::createWithSpriteFrameName(
5252
rl::constants::feature_state_to_sprite.at(m_difficulty_info.feature_state).data()
5353
);
@@ -91,10 +91,10 @@ void RLDifficultyNode::setDifficulty(const DifficultyInfo& di)
9191

9292
switch (di.feature_state)
9393
{
94-
case RL_FEATURE_STATE::FEATURED:
95-
case RL_FEATURE_STATE::EPIC:
96-
case RL_FEATURE_STATE::LEGENDARY:
97-
case RL_FEATURE_STATE::MYTHIC:
94+
case GJFeatureState::Featured:
95+
case GJFeatureState::Epic:
96+
case GJFeatureState::Legendary:
97+
case GJFeatureState::Mythic:
9898
m_feature_sprite = CCSprite::createWithSpriteFrameName(
9999
rl::constants::feature_state_to_sprite.at(di.feature_state).data()
100100
);
@@ -113,7 +113,7 @@ void RLDifficultyNode::setDifficulty(const DifficultyInfo& di)
113113

114114
void RLDifficultyNode::setDifficulty(GJDifficulty difficulty)
115115
{
116-
setDifficulty({ difficulty, RL_FEATURE_STATE::NONE });
116+
setDifficulty({ difficulty, GJFeatureState::None });
117117
}
118118

119119
// replacing bad code with even more bad code :D

src/custom_nodes/RLDifficultyNode.hpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,13 @@
77

88
using namespace geode::prelude;
99

10-
// TODO: remove once GJFeatureState is merged into geode-sdk/geode (#706)
11-
enum class RL_FEATURE_STATE
12-
{
13-
NONE = -1,
14-
FEATURED,
15-
EPIC,
16-
LEGENDARY,
17-
MYTHIC
18-
};
19-
2010
class RLDifficultyNode : public CCNodeRGBA
2111
{
2212
private:
2313
struct DifficultyInfo
2414
{
2515
GJDifficulty difficulty;
26-
RL_FEATURE_STATE feature_state = RL_FEATURE_STATE::NONE;
16+
GJFeatureState feature_state = GJFeatureState::None;
2717

2818
bool operator==(const DifficultyInfo&) const = default;
2919
} m_difficulty_info;

src/layers/CreatorLayer.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ class $modify(RouletteButton, CreatorLayer)
2525
menu->setID("center-left-menu"_spr);
2626
this->addChild(menu);
2727

28-
// Loader::get()->isModLoaded("absolllute.megahack")
29-
3028
// this still sucks :(
3129
auto rouletteButton = CCMenuItemSpriteExtra::create(
3230
CCSprite::create("RL_blankBtn_001.png"_spr),

src/layers/LevelInfoLayer.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,10 @@ class $modify(LevelInfoLayer)
1414
if (g_rouletteManager.isPlaying && level->m_levelID.value() == g_rouletteManager.currentLevelID)
1515
{
1616
CCLabelBMFont* normalPercentageLabel = static_cast<CCLabelBMFont*>(this->getChildByID("normal-mode-percentage"));
17-
float goalOffset = .0f;
1817

1918
if (!normalPercentageLabel) return true;
2019

21-
// wtf v2
22-
if (this->m_level->m_normalPercent < 10)
23-
goalOffset = 24.f;
24-
else if (this->m_level->m_normalPercent < 100)
25-
goalOffset = 31.f;
26-
else
27-
goalOffset = 39.f;
20+
float goalOffset = normalPercentageLabel->getContentWidth() / 2;
2821

2922
auto goalPercentage = CCLabelBMFont::create(
3023
fmt::format("({}%)", g_rouletteManager.levelPercentageGoal).c_str(),

src/layers/PauseLayer.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@ class $modify(PauseLayer)
1515
if (g_rouletteManager.isPlaying && playLayer->m_level->m_levelID.value() == g_rouletteManager.currentLevelID)
1616
{
1717
CCLabelBMFont* normalPercentageLabel = static_cast<CCLabelBMFont*>(this->getChildByID("normal-progress-label"));
18-
float goalOffset = 24.f;
1918

2019
if (!normalPercentageLabel) return;
2120

22-
if (playLayer->m_level->m_normalPercent < 10)
23-
goalOffset = 28.f;
24-
else if (playLayer->m_level->m_normalPercent <= 100)
25-
goalOffset = 40.f;
21+
float goalOffset = normalPercentageLabel->getContentWidth() / 2 + 7.f;
22+
2623
auto goalPercentage = CCLabelBMFont::create(
2724
fmt::format("({}%)", g_rouletteManager.levelPercentageGoal).c_str(),
2825
"bigFont.fnt"

src/layers/PlayLayer.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@ class $modify(GJBaseGameLayer)
2222

2323
class $modify(PlayLayerPause, PlayLayer)
2424
{
25-
CCAction* pauseGameAction = nullptr;
25+
struct Fields
26+
{
27+
CCAction* pause_game_action = nullptr;
28+
};
2629

2730
void pause()
2831
{
2932
GameManager::sharedState()->getPlayLayer()->pauseGame(false);
3033

31-
CCDirector::sharedDirector()->getRunningScene()->stopAction(m_fields->pauseGameAction);
34+
CCDirector::sharedDirector()->getRunningScene()->stopAction(m_fields->pause_game_action);
3235
}
3336

3437
bool init(GJGameLevel* level, bool p1, bool p2)
@@ -76,7 +79,7 @@ class $modify(PlayLayerPause, PlayLayer)
7679
{
7780
const auto runningScene = CCDirector::sharedDirector()->getRunningScene();
7881

79-
m_fields->pauseGameAction = runningScene->runAction(
82+
m_fields->pause_game_action = runningScene->runAction(
8083
CCSequence::create(
8184
CCDelayTime::create(1.f),
8285
CCCallFunc::create(runningScene, callfunc_selector(PlayLayerPause::pause)),

0 commit comments

Comments
 (0)