-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GauntletNode, GauntletSelectLayer, LevelPage, LevelSelectLayer and Mo…
…reOptionsLayer (#33) * GauntletSelectLayer, LevelPage, LevelSelectLayer and MoreOptionsLayer * GauntletNode, missing GauntletSelectLayer nodeIDs and typo fixe * Fix duplicate node and MOL on android * Fix epic compiler error * sorru * GauntletSelectLayer conflict
- Loading branch information
1 parent
ad79860
commit d49e19b
Showing
6 changed files
with
674 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#include <Geode/Geode.hpp> | ||
#include <Geode/binding/GauntletNode.hpp> | ||
#include <Geode/modify/GauntletNode.hpp> | ||
#include <Geode/utils/NodeIDs.hpp> | ||
|
||
using namespace geode::prelude; | ||
using namespace geode::node_ids; | ||
|
||
struct GauntletNodeIDs : Modify<GauntletNodeIDs, GauntletNode> { | ||
GJMapPack* m_gauntlet; | ||
|
||
static void onModify(auto& self) { | ||
if (!self.setHookPriority("GauntletNode::init", GEODE_ID_PRIORITY)) { | ||
log::warn("Failed to set GauntletNode::init hook priority, node IDs may not work properly"); | ||
} | ||
} | ||
|
||
bool init(GJMapPack* gauntlet) { | ||
if (!GauntletNode::init(gauntlet)) return false; | ||
|
||
m_fields->m_gauntlet = gauntlet; | ||
|
||
NodeIDs::get()->provide(this); | ||
|
||
return true; | ||
} | ||
}; | ||
|
||
$register_ids(GauntletNode) { | ||
const auto GSM = GameStatsManager::sharedState(); | ||
auto self = reinterpret_cast<GauntletNodeIDs*>(this); | ||
|
||
if (self->m_fields->m_gauntlet->hasCompletedMapPack()) { | ||
setIDs( | ||
this, | ||
0, | ||
"gauntlet-info-node", | ||
"empty-node", | ||
"background", | ||
"gauntlet-name-label", | ||
"gauntlet-label", | ||
"gauntlet-name-shadow-label", | ||
"gauntlet-shadow-label", | ||
"checkmark-sprite", | ||
"checkmark-shadow-sprite" | ||
); | ||
} else { | ||
setIDs( | ||
this, | ||
0, | ||
"gauntlet-info-node", | ||
"empty-node", | ||
"background", | ||
"gauntlet-name-label", | ||
"gauntlet-label", | ||
"gauntlet-name-shadow-label", | ||
"gauntlet-shadow-label" | ||
); | ||
} | ||
|
||
if (auto gauntletInfoNode = this->getChildByID("gauntlet-info-node")) { | ||
if ( | ||
self->m_fields->m_gauntlet->hasCompletedMapPack() && | ||
GSM->isSpecialChestUnlocked(GSM->getGauntletRewardKey(self->m_fields->m_gauntlet->m_packID)) | ||
) { | ||
setIDs( | ||
gauntletInfoNode, | ||
0, | ||
"gauntlet-sprite", | ||
"gauntlet-shadow-sprite", | ||
"gauntlet-progress-label", | ||
"gauntlet-progress-shadow-label" | ||
); | ||
} else { | ||
setIDs( | ||
gauntletInfoNode, | ||
0, | ||
"gauntlet-sprite", | ||
"gauntlet-shadow-sprite", | ||
"gauntlet-progress-label", | ||
"gauntlet-progress-shadow-label", | ||
"reward-label", | ||
"reward-shadow-label", | ||
"chest-sprite", | ||
"chest-shadow-sprite" | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
#include <Geode/Geode.hpp> | ||
#include <Geode/binding/LevelPage.hpp> | ||
#include <Geode/modify/LevelPage.hpp> | ||
#include <Geode/utils/NodeIDs.hpp> | ||
|
||
using namespace geode::prelude; | ||
using namespace geode::node_ids; | ||
|
||
$register_ids(LevelPage) { | ||
setIDs( | ||
this, | ||
0, | ||
"level-menu", | ||
"normal-progress-bar", | ||
"practice-progress-bar", | ||
"normal-progress-label", | ||
"practice-progress-label", | ||
"normal-mode-label", | ||
"practice-mode-label" | ||
); | ||
|
||
if (auto levelMenu = this->getChildByID("level-menu")) { | ||
if (auto levelButton = getChildOfType<CCMenuItemSpriteExtra>(levelMenu, 0)) { | ||
levelButton->setID("level-button"); | ||
|
||
// why in gods name does this sprite house everything | ||
if (auto whiteSprite = getChildOfType<CCSprite>(levelButton, 0)) { | ||
whiteSprite->setID("white-sprite"); | ||
|
||
if (auto scale9Sprite = getChildOfType<CCScale9Sprite>(whiteSprite, 0)) { | ||
scale9Sprite->setID("scale-9-sprite"); | ||
|
||
setIDs( | ||
scale9Sprite, | ||
0, | ||
"background", | ||
"level-name-label", | ||
"difficulty-sprite", | ||
"stars-icon", | ||
"stars-label", | ||
"secret-coin-icon-1", | ||
"secret-coin-icon-2", | ||
"secret-coin-icon-3" | ||
); | ||
} | ||
|
||
if (auto controllerStartSprite = getChildOfType<CCSprite>(whiteSprite, 0)) { | ||
controllerStartSprite->setID("controller-start-sprite"); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
struct LevelPageIDs : Modify<LevelPageIDs, LevelPage> { | ||
static void onModify(auto& self) { | ||
if (!self.setHookPriority("LevelPage::create", GEODE_ID_PRIORITY)) { | ||
log::warn("Failed to set LevelPage::create hook priority, node IDs may not work properly"); | ||
} | ||
} | ||
|
||
// LevelPage::init is half-inlined on windows | ||
static LevelPage* create(GJGameLevel* level) { | ||
auto layer = LevelPage::create(level); | ||
if (!layer) return nullptr; | ||
|
||
NodeIDs::get()->provide(layer); | ||
|
||
return layer; | ||
} | ||
|
||
void updateDynamicPage(GJGameLevel* level) { | ||
LevelPage::updateDynamicPage(level); | ||
|
||
// can't believe im bugfixing this game | ||
if (auto emptyMenu = getChildOfType<CCMenu>(this, 1); emptyMenu && emptyMenu->getChildrenCount() == 0) { | ||
emptyMenu->removeFromParent(); | ||
} | ||
|
||
if (GameStatsManager::sharedState()->getStat("8") < level->m_requiredCoins) { | ||
setIDs( | ||
this->getChildByID("level-menu") | ||
->getChildByID("level-button") | ||
->getChildByID("white-sprite") | ||
->getChildByID("scale-9-sprite"), | ||
8, | ||
"lock-sprite", | ||
"secret-coin-icon", | ||
"secret-coin-label" | ||
); | ||
} else { | ||
setIDs( | ||
this->getChildByID("level-menu") | ||
->getChildByID("level-button") | ||
->getChildByID("white-sprite") | ||
->getChildByID("scale-9-sprite"), | ||
8, | ||
"orbs-icon", | ||
"orbs-label" | ||
); | ||
} | ||
|
||
// this is how updateDynamicPage itself does it | ||
if (level->m_levelID <= 0) { | ||
if (level->m_levelID == -2) { | ||
if (auto buttonMenu = getChildOfType<CCMenu>(this, 1)) { | ||
buttonMenu->setID("button-menu"); | ||
|
||
if (auto towerButton = getChildOfType<CCMenuItemSpriteExtra>(buttonMenu, 0)) { | ||
towerButton->setID("tower-button"); | ||
|
||
if (auto towerSprite = getChildOfType<CCSprite>(towerButton, 0)) { | ||
towerSprite->setID("tower-sprite"); | ||
|
||
setIDs( | ||
towerSprite, | ||
0, | ||
"the-tower-sprite", | ||
"square-particle-system", | ||
"glow-particle-system", | ||
"skull-particle-system" | ||
); | ||
} | ||
} | ||
} | ||
} else { | ||
getChildOfType<CCLabelBMFont>(this, 4)->setID("coming-soon-label"); | ||
|
||
if (auto buttonMenu = getChildOfType<CCMenu>(this, 1)) { | ||
buttonMenu->setID("button-menu"); | ||
|
||
if (auto secretDoorButton = getChildOfType<CCMenuItemSpriteExtra>(buttonMenu, 0)) { | ||
secretDoorButton->setID("secret-door-button"); | ||
|
||
getChildOfType<CCSprite>(secretDoorButton, 0)->setID("secret-door-sprite"); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}; |
Oops, something went wrong.