Skip to content

Commit ac8a759

Browse files
committed
Bump rtrp version. Bug fixed & colors ig
1 parent f2b7eab commit ac8a759

File tree

8 files changed

+42
-33
lines changed

8 files changed

+42
-33
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Notable changes:
3939
- `rl::constants` namespace
4040
- `rl::utils::createLevelFromResponse()`, `rl::utils::getCreatorFromLevelResponse()`, `rl::utils::getDifficultyFromResponse()`
4141
- Geode 2.0.0-beta.21 support
42+
- Some missing node IDs to `RLRouletteLayer`
43+
- Some colors to some layers
4244

4345
### Changed
4446

@@ -61,6 +63,8 @@ Notable changes:
6163
- `RLRouletteLayer::getRandomListLevel` is passed a GJDifficulty instead of an int
6264
- How coins are positioned in `RLRouletteLayer` (they're now based on the difficulty node's position)
6365
- Some info about the info icons in ABOUT.md
66+
- How touch priority is handled in BaseCustomAlertLayer
67+
- No longer use `geode::cocos::handleTouchPriority`
6468

6569
### Fixed
6670

@@ -75,6 +79,7 @@ Notable changes:
7579
- Clicking the level's name/creator/id not copying it to the clipboard
7680
- Potential crash if `RLRouletteLayer::m_level` is empty (highly situational)
7781
- Geode invalid tags
82+
- Touch Prio on android :heart:
7883

7984
## [1.6.2] - 2024-02-09
8085

cmake/rtrp.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include(FetchContent)
33
FetchContent_Declare(
44
RTRP
55
GIT_REPOSITORY https://github.com/SpaghettDev/RTRP.git
6-
GIT_TAG deb04e500252058187b8afa1b1222d9fc5ed3191
6+
GIT_TAG a6f1bb12371db4028b9e7119f4bf44c8ca9c3445
77
GIT_PROGRESS TRUE
88
)
99
message("Fetching RTRP")

src/custom_layers/RLIntegerInputLayer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ RLIntegerInputLayer* RLIntegerInputLayer::create(const IntegerInputInfo& iili)
1818
bool RLIntegerInputLayer::init(const IntegerInputInfo& iili)
1919
{
2020
m_iili = iili;
21-
handleTouchPriority(this);
2221
if (!this->createBasics({ 175.f, 135.f }, menu_selector(RLIntegerInputLayer::onClose))) return false;
2322
this->closeBtn->setVisible(false);
2423

src/custom_layers/base/BaseCustomAlertLayer.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1+
#include <limits>
12
#include "BaseCustomAlertLayer.hpp"
23

3-
bool BaseCustomAlertLayer::createBasics(CCPoint contentSize, SEL_MenuHandler onClose, float closeBtnScale, const ccColor4B& color)
4+
bool BaseCustomAlertLayer::createBasics(CCPoint contentSize, SEL_MenuHandler onClose, float closeBtnScale, const ccColor4B& color, int prio)
45
{
56
if (!CCLayerColor::initWithColor(color)) return false;
67

78
alertSize = contentSize;
89

910
CCDirector* director = CCDirector::sharedDirector();
1011

11-
setTouchEnabled(true);
12-
setKeypadEnabled(true);
12+
this->setTouchEnabled(true);
13+
this->setKeypadEnabled(true);
1314

1415
m_mainLayer = CCLayer::create();
1516
this->addChild(m_mainLayer);
1617

17-
m_mainLayer->setTouchPriority(director->getTouchDispatcher()->getTargetPrio());
18+
if (prio == std::numeric_limits<int>::max())
19+
m_mainLayer->setTouchPriority(director->getTouchDispatcher()->getTargetPrio());
20+
else
21+
m_mainLayer->setTouchPriority(prio);
22+
// this is what FLAlertLayer::incrementForcePrio does
23+
director->getTouchDispatcher()->registerForcePrio(this, 2);
1824

1925
CCSize winSize = director->getWinSize();
2026
extension::CCScale9Sprite* bg = extension::CCScale9Sprite::create("GJ_square01.png", { .0f, .0f, 80.f, 80.f });

src/custom_layers/base/BaseCustomAlertLayer.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#pragma once
2+
#include <limits>
23

34
#include <Geode/Bindings.hpp>
45

@@ -10,7 +11,7 @@ class BaseCustomAlertLayer : public FLAlertLayer
1011
CCPoint alertSize{};
1112
CCMenuItemSpriteExtra* closeBtn{};
1213

13-
bool createBasics(CCPoint, SEL_MenuHandler, float = 1.f, const ccColor4B& = { 0x00, 0x00, 0x00, 0x4B });
14+
bool createBasics(CCPoint, SEL_MenuHandler, float = 1.f, const ccColor4B& = { 0x00, 0x00, 0x00, 0x4B }, int = std::numeric_limits<int>::max());
1415
void createTitle(std::string, float = .75f, float = 1.f);
1516
CCMenuItemSpriteExtra* createButton(const char*, CCPoint, SEL_MenuHandler, int = -1, float = 1.f, float = 1.2f);
1617
virtual void onClose(CCObject*) = 0;

src/custom_nodes/RLDifficultyNode.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ bool RLDifficultyNode::init(GJDifficulty difficulty, bool featured, bool epic)
2929
m_difficulty_sprite->setID("difficulty-sprite");
3030
this->addChild(m_difficulty_sprite);
3131

32+
// TODO: fix this setting the position relative to the bottom left when not in a CCMenuItemSpriteExtra
33+
const CCPoint& targetContentSize = m_difficulty_sprite->getContentSize();
34+
this->setContentSize(targetContentSize);
35+
m_difficulty_sprite->setPosition(targetContentSize / 2);
36+
3237
if (featured)
3338
{
3439
m_featured_sprite = CCSprite::createWithSpriteFrameName("GJ_featuredCoin_001.png");
@@ -45,9 +50,6 @@ bool RLDifficultyNode::init(GJDifficulty difficulty, bool featured, bool epic)
4550
this->addChild(m_epic_sprite, -1);
4651
}
4752

48-
this->setContentSize(m_difficulty_sprite->getContentSize());
49-
m_difficulty_sprite->setPosition(this->getContentSize() / 2);
50-
5153
return true;
5254
}
5355

@@ -62,6 +64,7 @@ void RLDifficultyNode::setColor(const ccColor3B& color)
6264
m_color = color;
6365
}
6466

67+
// basically RLDifficultyNode::init but without the call to CCNode::init and some extra checks
6568
void RLDifficultyNode::setDifficulty(GJDifficulty difficulty, bool featured, bool epic)
6669
{
6770
if (m_difficulty_info == DifficultyInfo{ difficulty, featured, epic }) return;
@@ -76,6 +79,11 @@ void RLDifficultyNode::setDifficulty(GJDifficulty difficulty, bool featured, boo
7679
m_difficulty_sprite->setID("difficulty-sprite");
7780
this->addChild(m_difficulty_sprite);
7881

82+
// man this codebase is getting worse by the minute
83+
// TODO: find a better way :despair:
84+
if (this->getParent() && typeinfo_cast<CCMenuItemSpriteExtra*>(this->getParent()))
85+
m_difficulty_sprite->setPosition(this->getContentSize() / 2);
86+
7987
if (featured)
8088
{
8189
m_featured_sprite = CCSprite::createWithSpriteFrameName("GJ_featuredCoin_001.png");
@@ -94,10 +102,5 @@ void RLDifficultyNode::setDifficulty(GJDifficulty difficulty, bool featured, boo
94102
this->addChild(m_epic_sprite, -1);
95103
}
96104

97-
// man this codebase is getting worse by the minute
98-
// TODO: is there a better way :despair:
99-
if (this->getParent() && typeinfo_cast<CCMenuItemSpriteExtra*>(this->getParent()))
100-
m_difficulty_sprite->setPosition(this->getContentSize() / 2);
101-
102105
m_difficulty_info = { difficulty, featured, epic };
103106
}

src/roulette/layers/RLRouletteInfoLayer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ void RLRouletteInfoLayer::onInfoIcon(CCObject* sender)
197197
FLAlertLayer::create(
198198
nullptr,
199199
"Normal List",
200-
"Levels ranging from the Easy difficulty to the Extreme Demon difficulty.\nOnly rated levels appear in this list.",
200+
"Levels ranging from the <cl>Easy</c> difficulty to the <cr>Extreme Demon</c> difficulty.\nOnly rated levels appear in this list.",
201201
"OK",
202202
nullptr
203203
)->show();
@@ -207,7 +207,7 @@ void RLRouletteInfoLayer::onInfoIcon(CCObject* sender)
207207
FLAlertLayer::create(
208208
nullptr,
209209
"Demon List",
210-
"The Pointercrate demon list.\nOnly includes levels from the regular demon list, and not the extended list.\nSource: https://pointercrate.com/demonlist",
210+
"The Pointercrate demon list.\n<cy>Only</c> includes levels from the regular demon list, <cr>and not</c> the extended list.\nSource: https://pointercrate.com/demonlist",
211211
"OK",
212212
nullptr
213213
)->show();
@@ -217,7 +217,7 @@ void RLRouletteInfoLayer::onInfoIcon(CCObject* sender)
217217
FLAlertLayer::create(
218218
nullptr,
219219
"Challenge List",
220-
"The Challenge list.\nSame as the demon list, as in the levels from the extended list don't appear in the roulette.\nSource: https://challengelist.gd/challenges",
220+
"The Challenge list.\nSame as the demon list, as in the levels from the extended list <cr>don't appear</c> in the roulette.\nSource: https://challengelist.gd/challenges",
221221
"OK",
222222
nullptr
223223
)->show();
@@ -227,7 +227,7 @@ void RLRouletteInfoLayer::onInfoIcon(CCObject* sender)
227227
FLAlertLayer::create(
228228
nullptr,
229229
"GD List",
230-
"A GD List.\nPretty self-explanatory.\nPlatformer levels appear in this list. No, i will not fix :D",
230+
"A GD List.\nPretty self-explanatory.\n<cr>Platformer levels appear in this list!</c> <cy>No</c>, i will not fix :D",
231231
"OK",
232232
nullptr
233233
)->show();

src/roulette/layers/RLRouletteLayer.cpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ bool RLRouletteLayer::init()
214214
levelCoinSprite->setPosition({ -120.f + 10.f * (i - 6), 13.f });
215215
levelCoinSprite->setScale(1.5f);
216216
levelCoinSprite->setVisible(false);
217+
levelCoinSprite->setID(fmt::format("coin-{}", i - 5));
217218
levelCoinSprite->setTag(i);
218219
if (i == 6)
219220
levelCoinSprite->setZOrder(-1);
@@ -253,7 +254,7 @@ bool RLRouletteLayer::init()
253254
menu_selector(RLRouletteLayer::onNextButton)
254255
);
255256
nextButton->setPosition({ 50.f, -70.f });
256-
nextButton->setTag(25);
257+
nextButton->setID("next-button");
257258
playing_menu->addChild(nextButton);
258259

259260
auto resetButton = CCMenuItemSpriteExtra::create(
@@ -316,14 +317,14 @@ bool RLRouletteLayer::init()
316317
errorResetButton->setID("reset-button");
317318
error_menu->addChild(errorResetButton);
318319

320+
319321
if (g_rouletteManager.isPaused)
320322
{
321323
g_rouletteManager.isPlaying = true;
322324
g_rouletteManager.isPaused = false;
323325
finishLevelRoulette();
324326
}
325327

326-
327328
return true;
328329
}
329330

@@ -343,7 +344,7 @@ void RLRouletteLayer::onClose(CCObject*)
343344
{
344345
m_confirmation_layer = RLConfirmationAlertLayer::create({
345346
"Woah there!",
346-
"Would you like to quit or pause the roulette?",
347+
"Would you like to <cr>quit</c> or <co>pause</c> the roulette?",
347348
[&](auto cl) {
348349
this->setKeypadEnabled(false);
349350
this->removeFromParentAndCleanup(true);
@@ -456,15 +457,10 @@ void RLRouletteLayer::onLevelInfo(CCObject* sender)
456457

457458
switch (textButton->getTag())
458459
{
459-
case 1:
460-
text = m_level.first.name;
461-
break;
462-
case 2:
463-
text = m_level.second.name;
464-
break;
465-
case 3:
466-
text = m_level.first.levelID;
467-
break;
460+
case 1: text = m_level.first.name; break;
461+
case 2: text = m_level.second.name; break;
462+
case 3: text = std::to_string(m_level.first.levelID); break;
463+
default: text = "[invalid]"; break;
468464
}
469465

470466
clipboard::write(text);
@@ -651,9 +647,8 @@ void RLRouletteLayer::finishLevelRoulette()
651647

652648
if (x_pos != .0f)
653649
playing_menu->getChildByTag(i)->setPositionX(x_pos);
654-
playing_menu->getChildByTag(i)->setVisible(x_pos != .0f);
655-
// playing_menu->getChildByTag(i)->setPositionY(difficulty >= GJDifficulty::Demon ? -1.f : 10.f);
656650
playing_menu->getChildByTag(i)->setPositionY(difficultyNodeYPos - coinsYOffset);
651+
playing_menu->getChildByTag(i)->setVisible(x_pos != .0f);
657652
}
658653
}
659654
else

0 commit comments

Comments
 (0)