Skip to content

Commit

Permalink
Start new game confirmation message, bump geode version
Browse files Browse the repository at this point in the history
  • Loading branch information
0x5abe committed Jul 27, 2024
1 parent 43aa10a commit 98b1915
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"geode": "3.3.0",
"geode": "3.3.1",
"gd": {
"win": "2.206"
},
Expand Down
29 changes: 26 additions & 3 deletions src/ui/PlayLevelMenuPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ bool PlayLevelMenuPopup::init() {
}

CCEGLView::get()->showCursor(true);
PSPlayLayer* l_playLayer = static_cast<PSPlayLayer*>(PlayLayer::get());

m_validSaveExists = l_playLayer && l_playLayer->validSaveExists();

setup();

return true;
Expand Down Expand Up @@ -57,7 +61,7 @@ void PlayLevelMenuPopup::setup() {
l_continueButton->setID("continue-button"_spr);

PSPlayLayer* l_playLayer = static_cast<PSPlayLayer*>(PlayLayer::get());
if (l_playLayer && !l_playLayer->validSaveExists()) {
if (l_playLayer && !m_validSaveExists) {
l_continueButtonSprite->m_label->setColor({127,127,127});
l_continueButtonSprite->m_BGSprite->setColor({127,127,127});
l_continueButton->m_bEnabled = false;
Expand All @@ -80,8 +84,27 @@ void PlayLevelMenuPopup::setup() {

void PlayLevelMenuPopup::onNewGame(CCObject* sender) {
PSPlayLayer* l_playLayer = static_cast<PSPlayLayer*>(PlayLayer::get());
if (l_playLayer && l_playLayer->m_fields->m_loadingState == LoadingState::WaitingForPlayLevelMenuPopup) {
l_playLayer->m_fields->m_saveSlot = -3;
if (l_playLayer) {
if (m_validSaveExists) {
createQuickPopup("Start new game",
"Are you sure you want to <co>start a new game</c>?",
"Cancel",
"Ok",
[&](FLAlertLayer*, bool i_btn2) {
l_playLayer = static_cast<PSPlayLayer*>(PlayLayer::get());
if (i_btn2) {
if (l_playLayer->m_fields->m_loadingState == LoadingState::WaitingForPlayLevelMenuPopup) {
l_playLayer->m_fields->m_saveSlot = -3;
}
onClose(nullptr);
}
}
);
return;
}
if (l_playLayer->m_fields->m_loadingState == LoadingState::WaitingForPlayLevelMenuPopup) {
l_playLayer->m_fields->m_saveSlot = -3;
}
}

onClose(nullptr);
Expand Down
2 changes: 2 additions & 0 deletions src/ui/PlayLevelMenuPopup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class PlayLevelMenuPopup : public FLAlertLayer {
void keyBackClicked() override;

private:
bool m_validSaveExists = false;

void setup();

void onClose(cocos2d::CCObject* i_sender);
Expand Down

0 comments on commit 98b1915

Please sign in to comment.