Skip to content

Commit

Permalink
laggy boi 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiLko committed Dec 10, 2024
1 parent c929d94 commit cb358f0
Show file tree
Hide file tree
Showing 4 changed files with 648 additions and 648 deletions.
112 changes: 56 additions & 56 deletions src/hacks/coin_finder.cpp
Original file line number Diff line number Diff line change
@@ -1,81 +1,81 @@
#include "show_trajectory.hpp"
// #include "show_trajectory.hpp"

#include <Geode/modify/PlayLayer.hpp>
// #include <Geode/modify/PlayLayer.hpp>

class CoinFinderNode : public cocos2d::CCDrawNode {
public:
static CoinFinderNode* create() {
CoinFinderNode* ret = new CoinFinderNode();
if (ret->init()) {
ret->autorelease();
return ret;
}
// class CoinFinderNode : public cocos2d::CCDrawNode {
// public:
// static CoinFinderNode* create() {
// CoinFinderNode* ret = new CoinFinderNode();
// if (ret->init()) {
// ret->autorelease();
// return ret;
// }

delete ret;
return nullptr;
// delete ret;
// return nullptr;

}
};
// }
// };

cocos2d::CCDrawNode* drawNode() {
// cocos2d::CCDrawNode* drawNode() {

static CoinFinderNode* instance = nullptr;
// static CoinFinderNode* instance = nullptr;

if (!instance) {
instance = CoinFinderNode::create();
instance->retain();
// if (!instance) {
// instance = CoinFinderNode::create();
// instance->retain();

cocos2d::_ccBlendFunc blendFunc;
blendFunc.src = GL_SRC_ALPHA;
blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
// cocos2d::_ccBlendFunc blendFunc;
// blendFunc.src = GL_SRC_ALPHA;
// blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;

instance->setBlendFunc(blendFunc);
}
// instance->setBlendFunc(blendFunc);
// }

return instance;
}
// return instance;
// }

class $modify(PlayLayer) {
// class $modify(PlayLayer) {

struct Fields {
std::vector<GameObject*> coins;
};
// struct Fields {
// std::vector<GameObject*> coins;
// };

void addObject(GameObject * obj) {
PlayLayer::addObject(obj);
// void addObject(GameObject * obj) {
// PlayLayer::addObject(obj);

if (obj->m_objectType == GameObjectType::UserCoin || obj->m_objectType == GameObjectType::SecretCoin)
m_fields->coins.push_back(obj);
// if (obj->m_objectType == GameObjectType::UserCoin || obj->m_objectType == GameObjectType::SecretCoin)
// m_fields->coins.push_back(obj);

}
// }

void setupHasCompleted() {
PlayLayer::setupHasCompleted();
// void setupHasCompleted() {
// PlayLayer::setupHasCompleted();

m_objectLayer->addChild(drawNode(), 499);
// m_objectLayer->addChild(drawNode(), 499);

}
// }

void postUpdate(float dt) {
PlayLayer::postUpdate(dt);
// void postUpdate(float dt) {
// PlayLayer::postUpdate(dt);

if (!Global::get().coinFinder) {
drawNode()->setVisible(false);
return;
}
// if (!Global::get().coinFinder) {
// drawNode()->setVisible(false);
// return;
// }

drawNode()->clear();
drawNode()->setVisible(true);
// drawNode()->clear();
// drawNode()->setVisible(true);

Global::get().safeMode = true;
// Global::get().safeMode = true;

for (GameObject* coin : m_fields->coins) {
cocos2d::ccColor4F color = { 0.85f, 0.85f, 0.85f, 0.75f };
// for (GameObject* coin : m_fields->coins) {
// cocos2d::ccColor4F color = { 0.85f, 0.85f, 0.85f, 0.75f };

if (coin->m_objectType == GameObjectType::SecretCoin)
color = { 0.96f, 1.f, 0.f, 0.75f };
// if (coin->m_objectType == GameObjectType::SecretCoin)
// color = { 0.96f, 1.f, 0.f, 0.75f };

drawNode()->drawSegment(m_player1->getPosition(), coin->getPosition(), 0.4f, color);
}
}
};
// drawNode()->drawSegment(m_player1->getPosition(), coin->getPosition(), 0.4f, color);
// }
// }
// };
Loading

0 comments on commit cb358f0

Please sign in to comment.