Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpha 10 #69

Merged
merged 5 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ file(GLOB SOURCES
src/features/BetterScaling/*.cpp
src/features/StartPosSwitcher/*.cpp
src/features/OffsetNextFree/*.cpp
src/features/RGBColorInput/*.cpp
src/features/*.cpp
src/other/*.cpp
src/*.cpp
Expand All @@ -34,6 +35,7 @@ add_subdirectory($ENV{GEODE_SDK} $ENV{GEODE_SDK}/build)

setup_geode_mod(${PROJECT_NAME} EXTERNALS be_team.editorapi:1.0.0)


# Build EditorAPI alongside BetterEdit
add_subdirectory(api)
target_link_libraries(${PROJECT_NAME} EditorAPI)
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# v5.0.0-alpha.10

- Fix a crash that could happen when entering the editor
- Correctly enable RGB Color Input

# v5.0.0-alpha.9

- Fix preview mode screwing up moving objects on playtest pause
Expand Down
4 changes: 2 additions & 2 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"geode": "1.3.4",
"version": "v5.0.0-alpha.9",
"version": "v5.0.0-alpha.10",
"id": "be_team.betteredit",
"name": "BetterEdit",
"developer": "BE Team",
Expand Down Expand Up @@ -54,7 +54,7 @@
"rgb-color-input": {
"type": "bool",
"default": true,
"name": "RGB + HEX Color Input",
"name": "RGB Color Input",
"description": "Adds a widget that allows RGB and HEX input in color edit, color trigger and pulse trigger"
},
"editor-pulse": {
Expand Down
7 changes: 4 additions & 3 deletions src/features/RGBColorInput/RGBColorInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,14 @@ class $modify(SetupPulsePopup) {
}
}

void updatePulseMode() {
SetupPulsePopup::updatePulseMode();
void onSelectPulseMode(CCObject* sender) {
SetupPulsePopup::onSelectPulseMode(sender);
if (!Mod::get()->getSettingValue<bool>("rgb-color-input")) {
return;
}
if (m_fields->rgbWidget) {
m_fields->rgbWidget->setVisible(m_pulseMode == 0);
m_fields->rgbWidget->updateLabels(true, true);
}
}
};
};
42 changes: 28 additions & 14 deletions src/features/StartPosSwitcher/StartPosSwitcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ class $modify(StartPosSwitchLayer, LevelEditorLayer) {
return false;
}
StartPosManager::get()->setStartPositions(m_objects);
auto bar = static_cast<StartPosButtonBar*>(m_editorUI->getChildByID("start-pos-button-bar"_spr));
if (bar) {
bar->setStartPosCounters();
if (m_editorUI && m_editorUI->getChildren()) {
auto bar = static_cast<StartPosButtonBar*>(m_editorUI->getChildByID("start-pos-button-bar"_spr));
if (bar) {
bar->setStartPosCounters();
}
}

return true;
Expand All @@ -74,9 +76,11 @@ class $modify(StartPosSwitchLayer, LevelEditorLayer) {
LevelEditorLayer::addSpecial(obj);
if (!m_editorInitialising && obj->m_objectID == 31) {
StartPosManager::get()->addStartPos(obj->getPosition());
auto bar = static_cast<StartPosButtonBar*>(m_editorUI->getChildByID("start-pos-button-bar"_spr));
if (bar) {
bar->setStartPosCounters();
if (m_editorUI && m_editorUI->getChildren()) {
auto bar = static_cast<StartPosButtonBar*>(m_editorUI->getChildByID("start-pos-button-bar"_spr));
if (bar) {
bar->setStartPosCounters();
}
}
}
}
Expand All @@ -96,8 +100,10 @@ class $modify(StartPosSwitchLayer, LevelEditorLayer) {
manager->clear();
}
manager->setStartPositions(m_objects);
auto buttonBar = static_cast<StartPosButtonBar*>(m_editorUI->getChildByID("start-pos-button-bar"_spr));
buttonBar->setStartPosCounters();
if (m_editorUI && m_editorUI->getChildren()) {
auto buttonBar = static_cast<StartPosButtonBar*>(m_editorUI->getChildByID("start-pos-button-bar"_spr));
buttonBar->setStartPosCounters();
}
}
}

Expand All @@ -108,6 +114,9 @@ class $modify(StartPosSwitchLayer, LevelEditorLayer) {

void setupLevelStart(LevelSettingsObject* obj) {
StartPosManager::get()->setStartPositions(m_objects);
if (!m_editorInitialising) {
return;
}
if (StartPosManager::get()->isLevelStart()) {
this->setStartPosObject(nullptr);
m_player1->setStartPos(CCPointZero);
Expand All @@ -122,9 +131,11 @@ class $modify(StartPosSwitchLayer, LevelEditorLayer) {
if (!startPos) {
Notification::create("Couldn't setup Start Position switcher.", CCSprite::createWithSpriteFrameName("edit_delBtnSmall_001.png"))->show();
StartPosManager::get()->setDefault();
auto bar = static_cast<StartPosButtonBar*>(m_editorUI->getChildByID("start-pos-button-bar"_spr));
if (bar) {
bar->setStartPosCounters();
if (m_editorUI && m_editorUI->getChildren()) {
auto bar = static_cast<StartPosButtonBar*>(m_editorUI->getChildByID("start-pos-button-bar"_spr));
if (bar) {
bar->setStartPosCounters();
}
}
LevelEditorLayer::setupLevelStart(obj);
return;
Expand Down Expand Up @@ -288,9 +299,12 @@ class $modify(GameObject) {
LevelEditorLayer::get(),
static_cast<StartPosObject*>(as<GameObject*>(this)),
[this]() {
auto buttonBar = static_cast<StartPosButtonBar*>(LevelEditorLayer::get()->m_editorUI->getChildByID("start-pos-button-bar"_spr));
if (buttonBar) {
buttonBar->setStartPosCounters();
auto editorUI = LevelEditorLayer::get()->m_editorUI;
if (editorUI && editorUI->getChildren()) {
auto buttonBar = static_cast<StartPosButtonBar*>(LevelEditorLayer::get()->m_editorUI->getChildByID("start-pos-button-bar"_spr));
if (buttonBar) {
buttonBar->setStartPosCounters();
}
}
}
);
Expand Down