Skip to content

Commit

Permalink
v7.0.0-beta.15
Browse files Browse the repository at this point in the history
- fix "edit special " button in editor
- add option to avoid crash at LevelTools::artistForAudio
- add titles to settings
  • Loading branch information
user95401 committed Sep 13, 2024
1 parent 639ea3a commit df6a6d2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 43 deletions.
15 changes: 2 additions & 13 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
{
"configurations": [
{
"name": "x64-Release",
"name": "x64-Clang-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ]
},
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"inheritEnvironments": [ "clang_cl_x64_x64" ],
"variables": []
}
]
Expand Down
22 changes: 18 additions & 4 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"geode": "3.3.0",
"geode": "3.6.0",
"gd": {
"win": "2.206",
"android": "2.206"
},
"version": "v7.0.0-beta.14",
"version": "v7.0.0-beta.15",
"id": "user95401.mainlevelseditor",
"name": "Main Levels Editor",
"developer": "user95401",
Expand All @@ -26,6 +26,16 @@
"type": "bool",
"default": false
},
"LevelTools::artistForAudio moment": {
"name": "Avoid crash at LevelTools::artistForAudio",
"description": "dont get original at hook of that function (since geode v3.6.0)",
"type": "bool",
"default": false
},
"Levels Listing": {
"type": "title",
"name": "Levels Listing"
},
"start_id": {
"name": "Level List Start ID",
"description": "its about populating the levels list",
Expand All @@ -34,7 +44,7 @@
"default": 1
},
"max_id": {
"name": " Level List Max ID",
"name": "Level List Max ID",
"description": "its about populating the levels list",
"type": "int",
"min": 1,
Expand All @@ -60,6 +70,10 @@
"type": "bool",
"default": true
},
"Songs Listing": {
"type": "title",
"name": "Songs Listing"
},
"songs_start_id": {
"name": "Songs List Start ID",
"description": "its about populating the songs list",
Expand All @@ -68,7 +82,7 @@
"default": 0
},
"songs_max_id": {
"name": " Songs List Max ID",
"name": "Songs List Max ID",
"description": "its about populating the songs list",
"type": "int",
"min": 0,
Expand Down
47 changes: 22 additions & 25 deletions src/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,36 +42,33 @@ class $modify(EditorPauseLayerExt, EditorPauseLayer) {

#include <Geode/modify/EditorUI.hpp>
class $modify(EditorUIExt, EditorUI) {
struct Fields {
SEL_MenuHandler m_orgEditObjectSpecialSel;
};
void callEditObjectSpecial() {
if (auto editSpecialButton = typeinfo_cast<CCMenuItemSpriteExtra*>(this->getChildByIDRecursive("edit-special-button"))) {
editSpecialButton->m_pfnSelector = m_fields->m_orgEditObjectSpecialSel;
editSpecialButton->activate();
editSpecialButton->m_pfnSelector = menu_selector(EditorUIExt::customEditObjectSpecial);
}
}
void customEditObjectSpecial(CCObject* p0) {
if (not this->m_selectedObject) return;
if (not this->m_editorLayer->getChildByIDRecursive("IsMainLevelEditor")) {
return callEditObjectSpecial();
}
//user coin id 1329, 142 secret coin
if (this->m_selectedObject->m_objectID == 1329) {
this->m_selectedObject->m_objectID = 142;
this->editObject(p0);
this->m_selectedObject->m_objectID = 1329;
return;
}
};
bool init(LevelEditorLayer* editorLayer) {
auto rtn = EditorUI::init(editorLayer);

//wasnt bindings for that yet
if (auto editSpecialButton = typeinfo_cast<CCMenuItemSpriteExtra*>(this->getChildByIDRecursive("edit-special-button"))) {
m_fields->m_orgEditObjectSpecialSel = editSpecialButton->m_pfnSelector;
editSpecialButton->m_pfnSelector = menu_selector(EditorUIExt::customEditObjectSpecial);
auto& org_pfnSelector = editSpecialButton->m_pfnSelector;
auto& org_pListener = editSpecialButton->m_pListener;
CCMenuItemExt::assignCallback<CCMenuItemSpriteExtra>(
editSpecialButton, [this, editSpecialButton, org_pfnSelector, org_pListener](
CCMenuItemSpriteExtra* item) {
if (not this->m_selectedObject) return;
if (not this->m_editorLayer->getChildByIDRecursive("IsMainLevelEditor")) {
return (org_pListener->*org_pfnSelector)(editSpecialButton);
}

//user coin id 1329, 142 secret coin
if (this->m_selectedObject->m_objectID == 1329) {
this->m_selectedObject->m_objectID = 142;
this->editObject(item);
this->m_selectedObject->m_objectID = 1329;
return;
}

(org_pListener->*org_pfnSelector)(editSpecialButton);
}
);

}

return rtn;
Expand Down
5 changes: 4 additions & 1 deletion src/songs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ class $modify(LevelTools) {
return not Audio::CallDefaults ? gd::string(Audio(p0).m_url.data()) : LevelTools::urlForAudio(p0);
};
$override static int artistForAudio(int p0) {
return not Audio::CallDefaults ? Audio(p0).m_artistID : LevelTools::artistForAudio(p0);
if (SETTING(bool, "LevelTools::artistForAudio moment")) {
return not Audio::CallDefaults ? Audio(p0).m_artistID : 1;
}
else return not Audio::CallDefaults ? Audio(p0).m_artistID : LevelTools::artistForAudio(p0);
};
/// ARTIST
$override static gd::string ytURLForArtist(int p0) {
Expand Down

0 comments on commit df6a6d2

Please sign in to comment.