Skip to content

Commit

Permalink
added 3d disable option
Browse files Browse the repository at this point in the history
  • Loading branch information
adafcaefc committed Dec 6, 2024
1 parent ebcfb4d commit 62dc11f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 26 deletions.
2 changes: 0 additions & 2 deletions Geome3Dash/src/game/editor/G3DCameraEditorPopup.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ namespace g3d
glm::vec3 cubePosition = glm::vec3(0, 105, 400);
double cubeRotationZ = 0;
glm::vec3 spikePosition = glm::vec3(900, 105, 400);
//sus3d::Model* cube;
//sus3d::Model* spike;

SplineGameObjectTransformer* splineTr;
SplinePlayerObjectTransformer* splinePlayerTr;
Expand Down
24 changes: 5 additions & 19 deletions Geome3Dash/src/hook/LevelEditorLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,13 @@ namespace g3d

void onStopPlaytest() {
LevelEditorLayer::onStopPlaytest();
m_fields->keyframeEditorLayer->hide();
const auto enabled = !geode::Mod::get()->getSettingValue<bool>("disable-general-3d");
if (enabled) { m_fields->keyframeEditorLayer->hide(); }
}

//std::optional<std::string> getFrameName(CCSprite* sprite)
//{
// auto texture = sprite->getTexture();
// auto rect = sprite->getTextureRect();
// auto* cachedFrames = CCSpriteFrameCache::sharedSpriteFrameCache()->m_pSpriteFrames;
// for (auto [key, frame] : geode::cocos::CCDictionaryExt<std::string, CCSpriteFrame*>(cachedFrames))
// {
// if (frame->getTexture() == texture && frame->getRect() == rect) { return key; }
// }
// return std::nullopt;
//}

void onSplineEditor(CCObject * obj)
{
//auto editorUI = dynamic_cast<EditorUI*>(this->getChildByID("EditorUI"));
//auto playtestButton = this->getChildByIDRecursive("playtest-button");
//auto playtestButtonSprite = playtestButton->getChildByType<CCSprite>(0);
//bool isPlayTesting = false;
//auto cFrame = getFrameName(playtestButtonSprite);
//if (cFrame.has_value() && cFrame.value() == "GJ_pauseEditorBtn_001.png") { isPlayTesting = true; }
//if (isPlayTesting) { editorUI->onPlaytest(playtestButton); }
m_fields->curveEditorLayer->show();
}

Expand Down Expand Up @@ -80,6 +63,9 @@ namespace g3d
{
if (!LevelEditorLayer::init(p0, p1)) { return false; }

const auto enabled = !geode::Mod::get()->getSettingValue<bool>("disable-general-3d");
if (!enabled) { return true; }

auto settingsButton = this->getChildByIDRecursive("settings-button");
auto settingsMenu = this->getChildByIDRecursive("settings-menu");

Expand Down
12 changes: 8 additions & 4 deletions Geome3Dash/src/hook/PlayLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ namespace g3d

void resetLevel()
{
if (!m_fields->playLayer3D)
const auto enabled = !geode::Mod::get()->getSettingValue<bool>("disable-general-3d");
if (enabled || G3DPlanetLayer::insideThePlanetLayerFlag)
{
m_fields->playLayer3D = G3DPlayLayer::create();
m_fields->playLayer3D->setZOrder(9);
this->addChild(m_fields->playLayer3D);
if (!m_fields->playLayer3D)
{
m_fields->playLayer3D = G3DPlayLayer::create();
m_fields->playLayer3D->setZOrder(9);
this->addChild(m_fields->playLayer3D);
}
}
PlayLayer::resetLevel();
}
Expand Down
10 changes: 9 additions & 1 deletion bin/mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@
"importance": "required"
}
],
"settings": {
"disable-general-3d": {
"type": "bool",
"name": "Disable 3D in Non-Story Levels",
"description": "Turn off 3D effects for levels outside Story Mode.",
"default": false
}
},
"resources": {
"sprites": ["resources/sprite/*.png"],
"sprites": ["resources/sprite/G3D_emptyBtn_001-uhd.png"],
"files": [
"resources/binaries/win/assimp-vc143-mt.dll",
"resources/binaries/win/pugixml.dll",
Expand Down

0 comments on commit 62dc11f

Please sign in to comment.