|
1 | 1 | #include "JoystickNode.hpp" |
2 | 2 | #include "utils.hpp" |
3 | 3 |
|
| 4 | +#include <Geode/modify/GJBaseGameLayer.hpp> |
| 5 | +#include <Geode/modify/PlayLayer.hpp> |
| 6 | +#include <Geode/modify/LevelEditorLayer.hpp> |
| 7 | + |
| 8 | +bool enableCounters = false; |
| 9 | + |
| 10 | +class $modify(JSPL, PlayLayer) { |
| 11 | + void setupHasCompleted() { |
| 12 | + enableCounters = false; |
| 13 | + if (fastGetSetting<"counters", bool>()) { |
| 14 | + for (auto obj : CCArrayExt<GameObject*>(m_objects)) { |
| 15 | + if (obj->m_objectID == 914) { |
| 16 | + if (auto txt = static_cast<TextGameObject*>(obj); txt && txt->m_text == "--joystick-counters") { |
| 17 | + //removeObject(obj, true); |
| 18 | + enableCounters = true; |
| 19 | + } |
| 20 | + } |
| 21 | + } |
| 22 | + } |
| 23 | + PlayLayer::setupHasCompleted(); |
| 24 | + } |
| 25 | +}; |
| 26 | + |
| 27 | +class $modify(JSLEL, LevelEditorLayer) { |
| 28 | + void onPlaytest() { |
| 29 | + enableCounters = false; |
| 30 | + if (fastGetSetting<"counters", bool>()) { |
| 31 | + for (auto obj : CCArrayExt<GameObject*>(m_objects)) { |
| 32 | + if (obj->m_objectID == 914) { |
| 33 | + if (auto txt = static_cast<TextGameObject*>(obj); txt && txt->m_text == "--joystick-counters") { |
| 34 | + //removeObject(obj, true); |
| 35 | + enableCounters = true; |
| 36 | + } |
| 37 | + } |
| 38 | + } |
| 39 | + } |
| 40 | + LevelEditorLayer::onPlaytest(); |
| 41 | + } |
| 42 | +}; |
| 43 | + |
4 | 44 | bool JoystickNode::init() { |
5 | 45 | if (!CCMenu::init()) return false; |
6 | 46 | setContentSize({100, 100}); |
@@ -57,12 +97,14 @@ void JoystickNode::handleInput(GJBaseGameLayer *layer, CCPoint input, CCPoint ol |
57 | 97 | } else if (input.x == -1) { |
58 | 98 | layer->queueButton(2, true, false); |
59 | 99 | } |
| 100 | + if (enableCounters) layer->updateCounters(3740, input.x); |
60 | 101 | if (!fastGetSetting<"disable-updown", bool>() || m_twoPlayer) { |
61 | 102 | if (input.y == 1) { |
62 | 103 | layer->queueButton(3, true, true); |
63 | 104 | } else if (input.y == -1) { |
64 | 105 | layer->queueButton(2, true, true); |
65 | 106 | } |
| 107 | + if (enableCounters) layer->updateCounters(3741, input.y); |
66 | 108 | } |
67 | 109 | } |
68 | 110 |
|
|
0 commit comments