Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alphalaneous committed Nov 19, 2024
1 parent d9e52a1 commit a4d5245
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 31 deletions.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"win": "2.2074",
"android": "2.2074"
},
"version": "v0.9.9",
"version": "v0.9.10",
"id": "zalphalaneous.minecraft",
"name": "Minecraftify!",
"developer": "Alphalaneous",
Expand Down
2 changes: 2 additions & 0 deletions src/ui/hooks/CCMenuItemSpriteExtra.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class $modify(MyCCMenuItemSpriteExtra, CCMenuItemSpriteExtra){
CCMenuItemSpriteExtra::selected();
}
else {
#ifndef GEODE_IS_ANDROID
FMODAudioEngine::sharedEngine()->playEffect("click.ogg"_spr);
#endif
(m_pListener->*m_pfnSelector)(this);
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/ui/hooks/MenuLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class $modify(MenuLayer){
return false;
}
if (CCNode* bottomMenu = this->getChildByIDRecursive("bottom-menu")){
bottomMenu->getChildByIDRecursive("achievements-button")->setVisible(false);
bottomMenu->getChildByIDRecursive("settings-button")->setVisible(false);
bottomMenu->getChildByIDRecursive("stats-button")->setVisible(false);
bottomMenu->getChildByIDRecursive("newgrounds-button")->setVisible(false);
bottomMenu->getChildByIDRecursive("geode.loader/geode-button")->setVisible(false);
Utils::getNodeSafe(bottomMenu, "achievements-button")->setVisible(false);
Utils::getNodeSafe(bottomMenu, "settings-button")->setVisible(false);
Utils::getNodeSafe(bottomMenu, "stats-button")->setVisible(false);
Utils::getNodeSafe(bottomMenu, "newgrounds-button")->setVisible(false);
Utils::getNodeSafe(bottomMenu, "geode.loader/geode-button")->setVisible(false);
}
if (Loader::get()->isModLoaded("alphalaneous.vanilla_pages")){

Expand Down
8 changes: 4 additions & 4 deletions src/ui/nodes/MCButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ MCButton* MCButton::create(gd::string text, float width, CCObject* target, SEL_M

MCButtonChild* child = MCButtonChild::create(text, width, target, selector);
ret->child = child;
if (ret && ret->init())
{
if (ret && ret->init()) {
ret->setContentSize(child->getScaledContentSize());
ret->addChild(child);
ret->ignoreAnchorPointForPosition(false);
ret->autorelease();
ret->scheduleUpdate();
return ret;
} else {
delete ret;
ret = nullptr;
}
CC_SAFE_DELETE(ret);
return nullptr;
}

Expand Down
9 changes: 4 additions & 5 deletions src/ui/nodes/MCButtonChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,18 @@ MCButtonChild* MCButtonChild::create(gd::string text, float width, CCObject* tar
label->setScale(0.12f);
label->setZOrder(2);

if (ret && ret->initWithNormalSprite(buttonSprite, nullptr, nullptr, target, selector))
{
if (ret && ret->initWithNormalSprite(buttonSprite, nullptr, nullptr, target, selector)) {
ret->autorelease();
ret->scheduleUpdate();
ret->setScale(3.5);
ret->addChild(label);
ret->setAnchorPoint({0,0});
ret->label = label;
label->setPosition({ret->getContentSize().width/2, ret->getContentSize().height/2});

return ret;
} else {
delete ret;
ret = nullptr;
}
CC_SAFE_DELETE(ret);
return nullptr;
}

Expand Down
8 changes: 4 additions & 4 deletions src/ui/nodes/MCLabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ MCLabel* MCLabel::create(std::wstring text, std::string font){

MCLabel *ret = new (std::nothrow) MCLabel();

if (ret && ret->init(text, font))
{
if (ret && ret->init(text, font)) {
ret->autorelease();
return ret;
} else {
delete ret;
ret = nullptr;
}
CC_SAFE_DELETE(ret);
return nullptr;
}

Expand Down
8 changes: 4 additions & 4 deletions src/ui/nodes/MCScrollBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

MCScrollBar* MCScrollBar::create(ScrollLayer* node, float height){
MCScrollBar *ret = new (std::nothrow) MCScrollBar();
if (ret && ret->init(node, height))
{
if (ret && ret->init(node, height)) {
ret->autorelease();
return ret;
} else {
delete ret;
ret = nullptr;
}
CC_SAFE_DELETE(ret);
return nullptr;
}

Expand Down
13 changes: 7 additions & 6 deletions src/ui/nodes/Panorama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
#include "../../utils/Utils.h"

Panorama* Panorama::create(){
auto node = new Panorama();
if (!node->init()) {
CC_SAFE_DELETE(node);
return nullptr;
auto ret = new Panorama();
if (ret && ret->init()) {
ret->autorelease();
} else {
delete ret;
ret = nullptr;
}
node->autorelease();
return node;
return ret;
}

bool Panorama::init(){
Expand Down
4 changes: 2 additions & 2 deletions src/utils/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ class Utils {
}

if(!found){
CCImage* img = new CCImage;
CCImage* img = new CCImage();
img->initWithImageFile(filePath.c_str());
img->retain();

CCTexture2D* texture = new CCTexture2D;
CCTexture2D* texture = new CCTexture2D();
texture->initWithImage(img);
texture->retain();

Expand Down

0 comments on commit a4d5245

Please sign in to comment.