Skip to content

Commit

Permalink
feat(geode): Update to geode v3.0.0-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaghettDev committed Jun 15, 2024
1 parent bbf3d4d commit 532790e
Show file tree
Hide file tree
Showing 15 changed files with 219 additions and 171 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
- name: Build the mod
uses: geode-sdk/build-geode-mod@main
with:
cli: 'v3.0.0-beta.1'
bindings: geode-sdk/bindings
bindings-ref: main
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
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.21)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_OSX_ARCHITECTURES "x86_64")
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)

project(GD-Roulette LANGUAGES CXX VERSION 1.0.0)
Expand Down
12 changes: 6 additions & 6 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"geode": "2.0.0-beta.25",
"geode": "3.0.0-beta.1",
"gd": {
"win": "2.204",
"android": "2.205",
"mac": "2.200"
"win": "2.206",
"android": "2.206",
"mac": "2.206"
},
"version": "v2.0.6",
"version": "v2.1.0",
"id": "spaghettdev.gd-roulette",
"name": "GD-Roulette",
"developer": "SpaghettDev",
Expand All @@ -27,7 +27,7 @@
"dependencies": [
{
"id": "geode.node-ids",
"version": ">=v1.3.0",
"version": ">=v1.12.0",
"importance": "required"
}
],
Expand Down
20 changes: 10 additions & 10 deletions src/custom_nodes/RLDifficultyNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RLDifficultyNode* RLDifficultyNode::create(const DifficultyInfo& di)

RLDifficultyNode* RLDifficultyNode::create(GJDifficulty difficulty)
{
return create({ difficulty, RL_FEATURE_STATE::NONE });
return create({ difficulty, GJFeatureState::None });
}

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

switch (m_difficulty_info.feature_state)
{
case RL_FEATURE_STATE::FEATURED:
case RL_FEATURE_STATE::EPIC:
case RL_FEATURE_STATE::LEGENDARY:
case RL_FEATURE_STATE::MYTHIC:
case GJFeatureState::Featured:
case GJFeatureState::Epic:
case GJFeatureState::Legendary:
case GJFeatureState::Mythic:
m_feature_sprite = CCSprite::createWithSpriteFrameName(
rl::constants::feature_state_to_sprite.at(m_difficulty_info.feature_state).data()
);
Expand Down Expand Up @@ -91,10 +91,10 @@ void RLDifficultyNode::setDifficulty(const DifficultyInfo& di)

switch (di.feature_state)
{
case RL_FEATURE_STATE::FEATURED:
case RL_FEATURE_STATE::EPIC:
case RL_FEATURE_STATE::LEGENDARY:
case RL_FEATURE_STATE::MYTHIC:
case GJFeatureState::Featured:
case GJFeatureState::Epic:
case GJFeatureState::Legendary:
case GJFeatureState::Mythic:
m_feature_sprite = CCSprite::createWithSpriteFrameName(
rl::constants::feature_state_to_sprite.at(di.feature_state).data()
);
Expand All @@ -113,7 +113,7 @@ void RLDifficultyNode::setDifficulty(const DifficultyInfo& di)

void RLDifficultyNode::setDifficulty(GJDifficulty difficulty)
{
setDifficulty({ difficulty, RL_FEATURE_STATE::NONE });
setDifficulty({ difficulty, GJFeatureState::None });
}

// replacing bad code with even more bad code :D
Expand Down
12 changes: 1 addition & 11 deletions src/custom_nodes/RLDifficultyNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,13 @@

using namespace geode::prelude;

// TODO: remove once GJFeatureState is merged into geode-sdk/geode (#706)
enum class RL_FEATURE_STATE
{
NONE = -1,
FEATURED,
EPIC,
LEGENDARY,
MYTHIC
};

class RLDifficultyNode : public CCNodeRGBA
{
private:
struct DifficultyInfo
{
GJDifficulty difficulty;
RL_FEATURE_STATE feature_state = RL_FEATURE_STATE::NONE;
GJFeatureState feature_state = GJFeatureState::None;

bool operator==(const DifficultyInfo&) const = default;
} m_difficulty_info;
Expand Down
2 changes: 0 additions & 2 deletions src/layers/CreatorLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class $modify(RouletteButton, CreatorLayer)
menu->setID("center-left-menu"_spr);
this->addChild(menu);

// Loader::get()->isModLoaded("absolllute.megahack")

// this still sucks :(
auto rouletteButton = CCMenuItemSpriteExtra::create(
CCSprite::create("RL_blankBtn_001.png"_spr),
Expand Down
9 changes: 1 addition & 8 deletions src/layers/LevelInfoLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,10 @@ class $modify(LevelInfoLayer)
if (g_rouletteManager.isPlaying && level->m_levelID.value() == g_rouletteManager.currentLevelID)
{
CCLabelBMFont* normalPercentageLabel = static_cast<CCLabelBMFont*>(this->getChildByID("normal-mode-percentage"));
float goalOffset = .0f;

if (!normalPercentageLabel) return true;

// wtf v2
if (this->m_level->m_normalPercent < 10)
goalOffset = 24.f;
else if (this->m_level->m_normalPercent < 100)
goalOffset = 31.f;
else
goalOffset = 39.f;
float goalOffset = normalPercentageLabel->getContentWidth() / 2;

auto goalPercentage = CCLabelBMFont::create(
fmt::format("({}%)", g_rouletteManager.levelPercentageGoal).c_str(),
Expand Down
7 changes: 2 additions & 5 deletions src/layers/PauseLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ class $modify(PauseLayer)
if (g_rouletteManager.isPlaying && playLayer->m_level->m_levelID.value() == g_rouletteManager.currentLevelID)
{
CCLabelBMFont* normalPercentageLabel = static_cast<CCLabelBMFont*>(this->getChildByID("normal-progress-label"));
float goalOffset = 24.f;

if (!normalPercentageLabel) return;

if (playLayer->m_level->m_normalPercent < 10)
goalOffset = 28.f;
else if (playLayer->m_level->m_normalPercent <= 100)
goalOffset = 40.f;
float goalOffset = normalPercentageLabel->getContentWidth() / 2 + 7.f;

auto goalPercentage = CCLabelBMFont::create(
fmt::format("({}%)", g_rouletteManager.levelPercentageGoal).c_str(),
"bigFont.fnt"
Expand Down
9 changes: 6 additions & 3 deletions src/layers/PlayLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ class $modify(GJBaseGameLayer)

class $modify(PlayLayerPause, PlayLayer)
{
CCAction* pauseGameAction = nullptr;
struct Fields
{
CCAction* pause_game_action = nullptr;
};

void pause()
{
GameManager::sharedState()->getPlayLayer()->pauseGame(false);

CCDirector::sharedDirector()->getRunningScene()->stopAction(m_fields->pauseGameAction);
CCDirector::sharedDirector()->getRunningScene()->stopAction(m_fields->pause_game_action);
}

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

m_fields->pauseGameAction = runningScene->runAction(
m_fields->pause_game_action = runningScene->runAction(
CCSequence::create(
CCDelayTime::create(1.f),
CCCallFunc::create(runningScene, callfunc_selector(PlayLayerPause::pause)),
Expand Down
Loading

0 comments on commit 532790e

Please sign in to comment.