Skip to content
This repository was archived by the owner on Jan 10, 2026. It is now read-only.

Commit f5e0459

Browse files
committed
actually fix it this time
1 parent b859bc1 commit f5e0459

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/main.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,17 @@
55

66
using namespace geode::prelude;
77

8-
CCNode* keystrokes;
8+
CCNode* keystrokes = nullptr;
99

1010
class $modify(PlayerObject) {
1111
$override
1212
void pushButton(PlayerButton p0) {
1313
PlayerObject::pushButton(p0);
1414

15-
if(!keystrokes) return;
15+
if(keystrokes == nullptr) return;
1616
if(!m_isPlatformer && p0 != PlayerButton::Jump) return;
1717
if(!PlayLayer::get()) return;
1818

19-
int expectedCount = 1;
20-
if(m_isPlatformer) expectedCount *= 3;
21-
if(PlayLayer::get()->m_level->m_twoPlayerMode) expectedCount *= 2;
22-
if(keystrokes->getChildrenCount() < expectedCount) return;
23-
2419
std::string player = (PlayLayer::get()->m_level->m_twoPlayerMode && this == PlayLayer::get()->m_player2) ? "p2-" : "p1-";
2520

2621
switch(p0) {
@@ -40,15 +35,10 @@ class $modify(PlayerObject) {
4035
void releaseButton(PlayerButton p0) {
4136
PlayerObject::releaseButton(p0);
4237

43-
if(!keystrokes) return;
38+
if(keystrokes == nullptr) return;
4439
if(!m_isPlatformer && p0 != PlayerButton::Jump) return;
4540
if(!PlayLayer::get()) return;
4641

47-
int expectedCount = 1;
48-
if(m_isPlatformer) expectedCount *= 3;
49-
if(PlayLayer::get()->m_level->m_twoPlayerMode) expectedCount *= 2;
50-
if(keystrokes->getChildrenCount() < expectedCount) return;
51-
5242
std::string player = (PlayLayer::get()->m_level->m_twoPlayerMode && this == PlayLayer::get()->m_player2) ? "p2-" : "p1-";
5343
switch(p0) {
5444
case PlayerButton::Left:
@@ -142,4 +132,10 @@ class $modify(KeystrokesLayer, PlayLayer) {
142132

143133
return true;
144134
}
135+
136+
$override
137+
void onExit() {
138+
keystrokes = nullptr;
139+
PlayLayer::onExit();
140+
}
145141
};

0 commit comments

Comments
 (0)