From cb358f0b5aca8b577ffc9a75ef65c23170e009f7 Mon Sep 17 00:00:00 2001 From: ZIlko Date: Tue, 10 Dec 2024 10:54:07 -0600 Subject: [PATCH] laggy boi 3 --- src/hacks/coin_finder.cpp | 112 ++--- src/hacks/other.cpp | 310 ++++++------ src/hacks/show_trajectory.cpp | 872 +++++++++++++++++----------------- src/main.cpp | 2 +- 4 files changed, 648 insertions(+), 648 deletions(-) diff --git a/src/hacks/coin_finder.cpp b/src/hacks/coin_finder.cpp index 78c064e..a2d73fc 100644 --- a/src/hacks/coin_finder.cpp +++ b/src/hacks/coin_finder.cpp @@ -1,81 +1,81 @@ -#include "show_trajectory.hpp" +// #include "show_trajectory.hpp" -#include +// #include -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 coins; - }; +// struct Fields { +// std::vector 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); - } - } -}; \ No newline at end of file +// drawNode()->drawSegment(m_player1->getPosition(), coin->getPosition(), 0.4f, color); +// } +// } +// }; \ No newline at end of file diff --git a/src/hacks/other.cpp b/src/hacks/other.cpp index f4ce51c..1d41443 100644 --- a/src/hacks/other.cpp +++ b/src/hacks/other.cpp @@ -1,217 +1,217 @@ -#include "../includes.hpp" -#include "../ui/record_layer.hpp" +// #include "../includes.hpp" +// #include "../ui/record_layer.hpp" -#include -#include -#include -#include -#include +// #include +// #include +// #include +// #include +// #include -class $modify(CCScheduler) { +// class $modify(CCScheduler) { - void update(float dt) { - auto& g = Global::get(); +// void update(float dt) { +// auto& g = Global::get(); - if (g.state == state::none && !g.speedhackEnabled) { - if (g.currentPitch != 1.f) - Global::updatePitch(1.f); +// if (g.state == state::none && !g.speedhackEnabled) { +// if (g.currentPitch != 1.f) +// Global::updatePitch(1.f); - return CCScheduler::update(dt); - } +// return CCScheduler::update(dt); +// } - if (g.renderer.recording || g.renderer.recordingAudio) { - if (g.currentPitch != 1.f) - Global::updatePitch(1.f); +// if (g.renderer.recording || g.renderer.recordingAudio) { +// if (g.currentPitch != 1.f) +// Global::updatePitch(1.f); - return CCScheduler::update(dt); - } +// return CCScheduler::update(dt); +// } - float speedhack = 1.f; +// float speedhack = 1.f; - if (g.speedhackEnabled && !g.frameStepper) { - std::string speedhackValue = g.mod->getSavedValue("macro_speedhack"); +// if (g.speedhackEnabled && !g.frameStepper) { +// std::string speedhackValue = g.mod->getSavedValue("macro_speedhack"); - if (speedhackValue != "0.0" && speedhackValue != "") { - speedhack = std::stof(speedhackValue); - float decimals = speedhack - static_cast(speedhack); +// if (speedhackValue != "0.0" && speedhackValue != "") { +// speedhack = std::stof(speedhackValue); +// float decimals = speedhack - static_cast(speedhack); - float closest = safeValues[0]; - float minDiff = std::abs(decimals - closest); +// float closest = safeValues[0]; +// float minDiff = std::abs(decimals - closest); - for (float value : safeValues) { - if (speedhackValue == "1.0" || g.state == state::none) { - closest = decimals; - break; - } +// for (float value : safeValues) { +// if (speedhackValue == "1.0" || g.state == state::none) { +// closest = decimals; +// break; +// } - float diff = std::abs(decimals - value); +// float diff = std::abs(decimals - value); - if (diff < minDiff) { - minDiff = diff; - closest = value; - } - } +// if (diff < minDiff) { +// minDiff = diff; +// closest = value; +// } +// } - speedhack = static_cast(speedhack) + closest; - } +// speedhack = static_cast(speedhack) + closest; +// } - Global::updatePitch(speedhack); - } +// Global::updatePitch(speedhack); +// } - if (speedhack != 1.f && PlayLayer::get()) - g.safeMode = true; +// if (speedhack != 1.f && PlayLayer::get()) +// g.safeMode = true; - CCScheduler::update(dt * speedhack); - } +// CCScheduler::update(dt * speedhack); +// } -}; +// }; -class $modify(PlayerObject) { +// class $modify(PlayerObject) { - static void onModify(auto & self) { - if (!self.setHookPriority("PlayerObject::playDeathEffect", -1)) - log::warn("PlayerObject::playDeathEffect hook priority fail xD."); +// static void onModify(auto & self) { +// if (!self.setHookPriority("PlayerObject::playDeathEffect", -1)) +// log::warn("PlayerObject::playDeathEffect hook priority fail xD."); - if (!self.setHookPriority("PlayerObject::playSpawnEffect", -1)) - log::warn("PlayerObject::playSpawnEffect hook priority fail xD."); - } +// if (!self.setHookPriority("PlayerObject::playSpawnEffect", -1)) +// log::warn("PlayerObject::playSpawnEffect hook priority fail xD."); +// } - void playDeathEffect() { - if (!Global::get().mod->getSavedValue("macro_no_death_effect")) - PlayerObject::playDeathEffect(); - } +// void playDeathEffect() { +// if (!Global::get().mod->getSavedValue("macro_no_death_effect")) +// PlayerObject::playDeathEffect(); +// } - void playSpawnEffect() { - if (!Global::get().mod->getSavedValue("macro_no_respawn_flash")) - PlayerObject::playSpawnEffect(); - } +// void playSpawnEffect() { +// if (!Global::get().mod->getSavedValue("macro_no_respawn_flash")) +// PlayerObject::playSpawnEffect(); +// } -}; +// }; -class $modify(PlayLayer) { +// class $modify(PlayLayer) { - struct Fields { - CCObject* slopeFix = nullptr; - }; +// struct Fields { +// CCObject* slopeFix = nullptr; +// }; - static void onModify(auto & self) { - if (!self.setHookPriority("PlayLayer::destroyPlayer", -1)) - log::warn("PlayLayer::destroyPlayer hook priority fail xD."); +// static void onModify(auto & self) { +// if (!self.setHookPriority("PlayLayer::destroyPlayer", -1)) +// log::warn("PlayLayer::destroyPlayer hook priority fail xD."); - if (!self.setHookPriority("PlayLayer::showNewBest", -1)) - log::warn("PlayLayer::showNewBest hook priority fail xD."); - } +// if (!self.setHookPriority("PlayLayer::showNewBest", -1)) +// log::warn("PlayLayer::showNewBest hook priority fail xD."); +// } - void destroyPlayer(PlayerObject * p0, GameObject * p1) { - if (p0 != m_player1 && p0 != m_player2) return PlayLayer::destroyPlayer(p0, p1); +// void destroyPlayer(PlayerObject * p0, GameObject * p1) { +// if (p0 != m_player1 && p0 != m_player2) return PlayLayer::destroyPlayer(p0, p1); - if (!m_fields->slopeFix) - m_fields->slopeFix = p1; +// if (!m_fields->slopeFix) +// m_fields->slopeFix = p1; - auto& g = Global::get(); +// auto& g = Global::get(); - bool player2 = p0 == m_player2; +// bool player2 = p0 == m_player2; - if (!g.mod->getSavedValue("macro_noclip_p1") && !player2) - return PlayLayer::destroyPlayer(p0, p1); +// if (!g.mod->getSavedValue("macro_noclip_p1") && !player2) +// return PlayLayer::destroyPlayer(p0, p1); - if (!g.mod->getSavedValue("macro_noclip_p2") && player2) - return PlayLayer::destroyPlayer(p0, p1); +// if (!g.mod->getSavedValue("macro_noclip_p2") && player2) +// return PlayLayer::destroyPlayer(p0, p1); - if (!g.mod->getSavedValue("macro_noclip") || m_fields->slopeFix == p1) - PlayLayer::destroyPlayer(p0, p1); - else - Global::get().safeMode = true; - } +// if (!g.mod->getSavedValue("macro_noclip") || m_fields->slopeFix == p1) +// PlayLayer::destroyPlayer(p0, p1); +// else +// Global::get().safeMode = true; +// } - void showNewBest(bool po, int p1, int p2, bool p3, bool p4, bool p5) { - if (!Global::get().safeMode || !Mod::get()->getSavedValue("macro_auto_safe_mode")) - PlayLayer::showNewBest(po, p1, p2, p3, p4, p5); - }; +// void showNewBest(bool po, int p1, int p2, bool p3, bool p4, bool p5) { +// if (!Global::get().safeMode || !Mod::get()->getSavedValue("macro_auto_safe_mode")) +// PlayLayer::showNewBest(po, p1, p2, p3, p4, p5); +// }; - void levelComplete() { - auto& g = Global::get(); +// void levelComplete() { +// auto& g = Global::get(); - bool wasTestMode = m_isTestMode; +// bool wasTestMode = m_isTestMode; - if (g.safeMode && g.mod->getSavedValue("macro_auto_safe_mode")) - m_isTestMode = true; +// if (g.safeMode && g.mod->getSavedValue("macro_auto_safe_mode")) +// m_isTestMode = true; - if (m_isPracticeMode) - g.safeMode = false; +// if (m_isPracticeMode) +// g.safeMode = false; - PlayLayer::levelComplete(); - Macro::resetState(true); +// PlayLayer::levelComplete(); +// Macro::resetState(true); - m_isTestMode = wasTestMode; - } +// m_isTestMode = wasTestMode; +// } -}; +// }; -class $modify(EndLevelLayer) { +// class $modify(EndLevelLayer) { - void customSetup() { - EndLevelLayer::customSetup(); - auto& g = Global::get(); +// void customSetup() { +// EndLevelLayer::customSetup(); +// auto& g = Global::get(); - if (g.mod->getSettingValue("endscreen_button")) { - auto winSize = CCDirector::sharedDirector()->getWinSize(); +// if (g.mod->getSettingValue("endscreen_button")) { +// auto winSize = CCDirector::sharedDirector()->getWinSize(); - CCSprite* sprite = CCSprite::createWithSpriteFrameName("GJ_playBtn2_001.png"); - sprite->setScale(0.350f); +// CCSprite* sprite = CCSprite::createWithSpriteFrameName("GJ_playBtn2_001.png"); +// sprite->setScale(0.350f); - CCMenuItemSpriteExtra* btn = CCMenuItemSpriteExtra::create( - sprite, - this, - menu_selector(RecordLayer::openMenu2 - )); - btn->setPosition({160, -99}); +// CCMenuItemSpriteExtra* btn = CCMenuItemSpriteExtra::create( +// sprite, +// this, +// menu_selector(RecordLayer::openMenu2 +// )); +// btn->setPosition({160, -99}); - CCLayer* layer = this->getChildByType(0); +// CCLayer* layer = this->getChildByType(0); - CCMenu* menu = CCMenu::create(); - menu->setID("button-menu"_spr); - layer->addChild(menu); +// CCMenu* menu = CCMenu::create(); +// menu->setID("button-menu"_spr); +// layer->addChild(menu); - menu->addChild(btn); - } +// menu->addChild(btn); +// } - if (g.layer) { - static_cast(g.layer)->cursorWasHidden = false; - static_cast(g.layer)->onClose(nullptr); - } +// if (g.layer) { +// static_cast(g.layer)->cursorWasHidden = false; +// static_cast(g.layer)->onClose(nullptr); +// } - if (!g.safeMode) return; - if (!g.mod->getSavedValue("macro_auto_safe_mode")) return; +// if (!g.safeMode) return; +// if (!g.mod->getSavedValue("macro_auto_safe_mode")) return; - CCLabelBMFont* lbl = CCLabelBMFont::create("Auto-safe-mode", "goldFont.fnt"); - lbl->setPosition({ 3.5, 10 }); - lbl->setOpacity(155); - lbl->setID("safe-mode-label"_spr); - lbl->setScale(0.55f); - lbl->setAnchorPoint({ 0, 0.5 }); +// CCLabelBMFont* lbl = CCLabelBMFont::create("Auto-safe-mode", "goldFont.fnt"); +// lbl->setPosition({ 3.5, 10 }); +// lbl->setOpacity(155); +// lbl->setID("safe-mode-label"_spr); +// lbl->setScale(0.55f); +// lbl->setAnchorPoint({ 0, 0.5 }); - addChild(lbl); - } +// addChild(lbl); +// } - void onHideLayer(CCObject* obj) { - EndLevelLayer::onHideLayer(obj); +// void onHideLayer(CCObject* obj) { +// EndLevelLayer::onHideLayer(obj); - if (CCNode* lbl = getChildByID("safe-mode-label"_spr)) - lbl->setVisible(!lbl->isVisible()); - } +// if (CCNode* lbl = getChildByID("safe-mode-label"_spr)) +// lbl->setVisible(!lbl->isVisible()); +// } -}; +// }; -class $modify(GJGameLevel) { +// class $modify(GJGameLevel) { - static void onModify(auto & self) { - if (!self.setHookPriority("GJGameLevel::savePercentage", -1)) - log::warn("GJGameLevel::savePercentage hook priority fail xD."); - } +// static void onModify(auto & self) { +// if (!self.setHookPriority("GJGameLevel::savePercentage", -1)) +// log::warn("GJGameLevel::savePercentage hook priority fail xD."); +// } - void savePercentage(int p0, bool p1, int p2, int p3, bool p4) { - if (!Global::get().safeMode || !Mod::get()->getSavedValue("macro_auto_safe_mode")) - GJGameLevel::savePercentage(p0, p1, p2, p3, p4); - } -}; \ No newline at end of file +// void savePercentage(int p0, bool p1, int p2, int p3, bool p4) { +// if (!Global::get().safeMode || !Mod::get()->getSavedValue("macro_auto_safe_mode")) +// GJGameLevel::savePercentage(p0, p1, p2, p3, p4); +// } +// }; \ No newline at end of file diff --git a/src/hacks/show_trajectory.cpp b/src/hacks/show_trajectory.cpp index d081bba..d17d68e 100644 --- a/src/hacks/show_trajectory.cpp +++ b/src/hacks/show_trajectory.cpp @@ -1,520 +1,520 @@ -#include "show_trajectory.hpp" +// #include "show_trajectory.hpp" -#include -#include -#include -#include -#include -#include -#include -#include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include -ShowTrajectory t; +// ShowTrajectory t; -$execute{ +// $execute{ - geode::listenForSettingChanges("show_trajectory_color1", +[](cocos2d::ccColor3B value) { - t.color1 = ccc4FFromccc3B(value); - t.color3 = ShowTrajectory::getMergedColor(t.color1, t.color2); - }); +// geode::listenForSettingChanges("show_trajectory_color1", +[](cocos2d::ccColor3B value) { +// t.color1 = ccc4FFromccc3B(value); +// t.color3 = ShowTrajectory::getMergedColor(t.color1, t.color2); +// }); - geode::listenForSettingChanges("show_trajectory_color2", +[](cocos2d::ccColor3B value) { - t.color2 = ccc4FFromccc3B(value); - t.color3 = ShowTrajectory::getMergedColor(t.color1, t.color2); - }); +// geode::listenForSettingChanges("show_trajectory_color2", +[](cocos2d::ccColor3B value) { +// t.color2 = ccc4FFromccc3B(value); +// t.color3 = ShowTrajectory::getMergedColor(t.color1, t.color2); +// }); - geode::listenForSettingChanges("show_trajectory_length", +[](int64_t value) { - t.length = value; - }); +// geode::listenForSettingChanges("show_trajectory_length", +[](int64_t value) { +// t.length = value; +// }); -}; +// }; -void ShowTrajectory::updateTrajectory(PlayLayer* pl) { - if (!t.fakePlayer1 || !t.fakePlayer2) return; +// void ShowTrajectory::updateTrajectory(PlayLayer* pl) { +// if (!t.fakePlayer1 || !t.fakePlayer2) return; - auto& g = Global::get(); +// auto& g = Global::get(); - g.safeMode = true; +// g.safeMode = true; - t.creatingTrajectory = true; - g.creatingTrajectory = true; +// t.creatingTrajectory = true; +// g.creatingTrajectory = true; - t.trajectoryNode()->setVisible(true); - t.trajectoryNode()->clear(); +// t.trajectoryNode()->setVisible(true); +// t.trajectoryNode()->clear(); - if (t.fakePlayer1 && pl->m_player1) { - createTrajectory(pl, t.fakePlayer1, pl->m_player1, true); - createTrajectory(pl, t.fakePlayer2, pl->m_player1, false); - } +// if (t.fakePlayer1 && pl->m_player1) { +// createTrajectory(pl, t.fakePlayer1, pl->m_player1, true); +// createTrajectory(pl, t.fakePlayer2, pl->m_player1, false); +// } - if (pl->m_gameState.m_isDualMode && pl->m_player2) { - createTrajectory(pl, t.fakePlayer2, pl->m_player2, true); - createTrajectory(pl, t.fakePlayer1, pl->m_player2, false); - } +// if (pl->m_gameState.m_isDualMode && pl->m_player2) { +// createTrajectory(pl, t.fakePlayer2, pl->m_player2, true); +// createTrajectory(pl, t.fakePlayer1, pl->m_player2, false); +// } - t.creatingTrajectory = false; - g.creatingTrajectory = false; -} -float rot = 0.f; -void ShowTrajectory::createTrajectory(PlayLayer* pl, PlayerObject* fakePlayer, PlayerObject* realPlayer, bool hold) { - - bool player2 = pl->m_player2 == realPlayer; +// t.creatingTrajectory = false; +// g.creatingTrajectory = false; +// } +// float rot = 0.f; +// void ShowTrajectory::createTrajectory(PlayLayer* pl, PlayerObject* fakePlayer, PlayerObject* realPlayer, bool hold) { + +// bool player2 = pl->m_player2 == realPlayer; - PlayerData playerData = PlayerPracticeFixes::saveData(realPlayer); - PlayerPracticeFixes::applyData(fakePlayer, playerData, false, true); - - t.cancelTrajectory = false; +// PlayerData playerData = PlayerPracticeFixes::saveData(realPlayer); +// PlayerPracticeFixes::applyData(fakePlayer, playerData, false, true); + +// t.cancelTrajectory = false; - for (int i = 0; i < t.length; i++) { - CCPoint prevPos = fakePlayer->getPosition(); +// for (int i = 0; i < t.length; i++) { +// CCPoint prevPos = fakePlayer->getPosition(); - if (hold) { - if (player2) - t.player2Trajectory[i] = prevPos; - else - t.player1Trajectory[i] = prevPos; - } +// if (hold) { +// if (player2) +// t.player2Trajectory[i] = prevPos; +// else +// t.player1Trajectory[i] = prevPos; +// } - fakePlayer->m_collisionLogTop->removeAllObjects(); - fakePlayer->m_collisionLogBottom->removeAllObjects(); - fakePlayer->m_collisionLogLeft->removeAllObjects(); - fakePlayer->m_collisionLogRight->removeAllObjects(); +// fakePlayer->m_collisionLogTop->removeAllObjects(); +// fakePlayer->m_collisionLogBottom->removeAllObjects(); +// fakePlayer->m_collisionLogLeft->removeAllObjects(); +// fakePlayer->m_collisionLogRight->removeAllObjects(); - pl->checkCollisions(fakePlayer, t.delta, false); +// pl->checkCollisions(fakePlayer, t.delta, false); - if (t.cancelTrajectory) { - fakePlayer->updatePlayerScale(); - drawPlayerHitbox(fakePlayer, t.trajectoryNode()); - break; - } +// if (t.cancelTrajectory) { +// fakePlayer->updatePlayerScale(); +// drawPlayerHitbox(fakePlayer, t.trajectoryNode()); +// break; +// } - if (i == 0) { - hold ? fakePlayer->pushButton(static_cast(1)) : fakePlayer->releaseButton(static_cast(1)); - if (pl->m_levelSettings->m_platformerMode) - realPlayer->m_isGoingLeft ? fakePlayer->pushButton(static_cast(2)) : fakePlayer->pushButton(static_cast(3)); - } +// if (i == 0) { +// hold ? fakePlayer->pushButton(static_cast(1)) : fakePlayer->releaseButton(static_cast(1)); +// if (pl->m_levelSettings->m_platformerMode) +// realPlayer->m_isGoingLeft ? fakePlayer->pushButton(static_cast(2)) : fakePlayer->pushButton(static_cast(3)); +// } - fakePlayer->update(t.delta); - fakePlayer->updateRotation(t.delta); - fakePlayer->updatePlayerScale(); - - cocos2d::ccColor4F color = hold ? t.color2 : t.color1; - - if (!hold) { - if ((player2 && t.player2Trajectory[i] == prevPos) || !player2 && t.player1Trajectory[i] == prevPos) - color = t.color3; - } - - if (i >= t.length - 40) - color.a = (t.length - i) / 40.f; - - t.trajectoryNode()->drawSegment(prevPos, fakePlayer->getPosition(), 0.6f, color); - - } -} - -void ShowTrajectory::drawPlayerHitbox(PlayerObject* player, CCDrawNode* drawNode) { - cocos2d::CCRect bigRect = player->GameObject::getObjectRect(); - cocos2d::CCRect smallRect = player->GameObject::getObjectRect(0.3, 0.3); - - std::vector vertices = ShowTrajectory::getVertices(player, bigRect, t.deathRotation); - drawNode->drawPolygon(&vertices[0], 4, ccc4f(t.color1.r, t.color1.g, t.color1.b, 0.2f), 0.5, t.color1); - - vertices = ShowTrajectory::getVertices(player, smallRect, t.deathRotation); - drawNode->drawPolygon(&vertices[0], 4, ccc4f(t.color3.r, t.color3.g, t.color3.b, 0.2f), 0.35, ccc4f(t.color3.r, t.color3.g, t.color3.b, 0.55f)); -} - -std::vector ShowTrajectory::getVertices(PlayerObject* player, cocos2d::CCRect rect, float rotation) { - std::vector vertices = { - ccp(rect.getMinX(), rect.getMaxY()), - ccp(rect.getMaxX(), rect.getMaxY()), - ccp(rect.getMaxX(), rect.getMinY()), - ccp(rect.getMinX(), rect.getMinY()) - }; - - cocos2d::CCPoint center = ccp( - (rect.getMinX() + rect.getMaxX()) / 2.f, - (rect.getMinY() + rect.getMaxY()) / 2.f - ); - - float size = static_cast(rect.getMaxX() - rect.getMinX()); - - if ((size == 18 || size == 5) && player->getScale() == 1) { - for (auto& vertex : vertices) { - vertex.x = center.x + (vertex.x - center.x) / 0.6f; - vertex.y = center.y + (vertex.y - center.y) / 0.6f; - } - } - - if ((size == 7 || size == 30 || size == 29 || size == 9) && player->getScale() != 1) { - for (auto& vertex : vertices) { - vertex.x = center.x + (vertex.x - center.x) * 0.6; - vertex.y = center.y + (vertex.y - center.y) * 0.6f; - } - } - - if (player->m_isDart) { - for (auto& vertex : vertices) { - vertex.x = center.x + (vertex.x - center.x) * 0.3f; - vertex.y = center.y + (vertex.y - center.y) * 0.3f; - } - } +// fakePlayer->update(t.delta); +// fakePlayer->updateRotation(t.delta); +// fakePlayer->updatePlayerScale(); + +// cocos2d::ccColor4F color = hold ? t.color2 : t.color1; + +// if (!hold) { +// if ((player2 && t.player2Trajectory[i] == prevPos) || !player2 && t.player1Trajectory[i] == prevPos) +// color = t.color3; +// } + +// if (i >= t.length - 40) +// color.a = (t.length - i) / 40.f; + +// t.trajectoryNode()->drawSegment(prevPos, fakePlayer->getPosition(), 0.6f, color); + +// } +// } + +// void ShowTrajectory::drawPlayerHitbox(PlayerObject* player, CCDrawNode* drawNode) { +// cocos2d::CCRect bigRect = player->GameObject::getObjectRect(); +// cocos2d::CCRect smallRect = player->GameObject::getObjectRect(0.3, 0.3); + +// std::vector vertices = ShowTrajectory::getVertices(player, bigRect, t.deathRotation); +// drawNode->drawPolygon(&vertices[0], 4, ccc4f(t.color1.r, t.color1.g, t.color1.b, 0.2f), 0.5, t.color1); + +// vertices = ShowTrajectory::getVertices(player, smallRect, t.deathRotation); +// drawNode->drawPolygon(&vertices[0], 4, ccc4f(t.color3.r, t.color3.g, t.color3.b, 0.2f), 0.35, ccc4f(t.color3.r, t.color3.g, t.color3.b, 0.55f)); +// } + +// std::vector ShowTrajectory::getVertices(PlayerObject* player, cocos2d::CCRect rect, float rotation) { +// std::vector vertices = { +// ccp(rect.getMinX(), rect.getMaxY()), +// ccp(rect.getMaxX(), rect.getMaxY()), +// ccp(rect.getMaxX(), rect.getMinY()), +// ccp(rect.getMinX(), rect.getMinY()) +// }; + +// cocos2d::CCPoint center = ccp( +// (rect.getMinX() + rect.getMaxX()) / 2.f, +// (rect.getMinY() + rect.getMaxY()) / 2.f +// ); + +// float size = static_cast(rect.getMaxX() - rect.getMinX()); + +// if ((size == 18 || size == 5) && player->getScale() == 1) { +// for (auto& vertex : vertices) { +// vertex.x = center.x + (vertex.x - center.x) / 0.6f; +// vertex.y = center.y + (vertex.y - center.y) / 0.6f; +// } +// } + +// if ((size == 7 || size == 30 || size == 29 || size == 9) && player->getScale() != 1) { +// for (auto& vertex : vertices) { +// vertex.x = center.x + (vertex.x - center.x) * 0.6; +// vertex.y = center.y + (vertex.y - center.y) * 0.6f; +// } +// } + +// if (player->m_isDart) { +// for (auto& vertex : vertices) { +// vertex.x = center.x + (vertex.x - center.x) * 0.3f; +// vertex.y = center.y + (vertex.y - center.y) * 0.3f; +// } +// } - float angle = CC_DEGREES_TO_RADIANS(rotation * -1.f); - for (auto& vertex : vertices) { - float x = vertex.x - center.x; - float y = vertex.y - center.y; - - float xNew = center.x + (x * cos(angle)) - (y * sin(angle)); - float yNew = center.y + (x * sin(angle)) + (y * cos(angle)); - - vertex.x = xNew; - vertex.y = yNew; - } - - return vertices; -} - -cocos2d::ccColor4F ShowTrajectory::getMergedColor(cocos2d::ccColor4F color1, cocos2d::ccColor4F color2) { - cocos2d::ccColor4F newColor = { 0.f, 0.f, 0.f, 1.f }; - - newColor.r = (color1.r + color2.r) / 2; - newColor.b = (color1.b + color2.b) / 2; - newColor.g = (color1.g + color2.g) / 2; - - newColor.r = std::min(1.f, newColor.r + 0.45f); - newColor.g = std::min(1.f, newColor.g + 0.45f); - newColor.b = std::min(1.f, newColor.b + 0.45f); - - return newColor; -} - -void ShowTrajectory::handlePortal(PlayerObject* player, int id) { - if (!portalIDs.contains(id)) return; +// float angle = CC_DEGREES_TO_RADIANS(rotation * -1.f); +// for (auto& vertex : vertices) { +// float x = vertex.x - center.x; +// float y = vertex.y - center.y; + +// float xNew = center.x + (x * cos(angle)) - (y * sin(angle)); +// float yNew = center.y + (x * sin(angle)) + (y * cos(angle)); + +// vertex.x = xNew; +// vertex.y = yNew; +// } + +// return vertices; +// } + +// cocos2d::ccColor4F ShowTrajectory::getMergedColor(cocos2d::ccColor4F color1, cocos2d::ccColor4F color2) { +// cocos2d::ccColor4F newColor = { 0.f, 0.f, 0.f, 1.f }; + +// newColor.r = (color1.r + color2.r) / 2; +// newColor.b = (color1.b + color2.b) / 2; +// newColor.g = (color1.g + color2.g) / 2; + +// newColor.r = std::min(1.f, newColor.r + 0.45f); +// newColor.g = std::min(1.f, newColor.g + 0.45f); +// newColor.b = std::min(1.f, newColor.b + 0.45f); + +// return newColor; +// } + +// void ShowTrajectory::handlePortal(PlayerObject* player, int id) { +// if (!portalIDs.contains(id)) return; - switch (id) { - case 101: - player->togglePlayerScale(true, true); - player->updatePlayerScale(); - break; - case 99: - player->togglePlayerScale(false, true); - player->updatePlayerScale(); - break; - // case 11: - // player->flipGravity(true, true); break; - // case 10: - // player->flipGravity(false, true); break; - case 200: player->m_playerSpeed = 0.7f; break; - case 201: player->m_playerSpeed = 0.9f; break; - case 202: player->m_playerSpeed = 1.1f; break; - case 203: player->m_playerSpeed = 1.3f; break; - case 1334: player->m_playerSpeed = 1.6f; break; - } -} - -cocos2d::CCDrawNode* ShowTrajectory::trajectoryNode() { - - static TrajectoryNode* instance = nullptr; - - if (!instance) { - instance = TrajectoryNode::create(); - instance->retain(); - - cocos2d::_ccBlendFunc blendFunc; - blendFunc.src = GL_SRC_ALPHA; - blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA; - - instance->setBlendFunc(blendFunc); - } - - return instance; -} - -class $modify(PlayLayer) { - - static void onModify(auto & self) { - if (!self.setHookPriority("PlayLayer::destroyPlayer", 100)) - log::warn("PlayLayer::destroyPlayer hook priority fail xD."); +// switch (id) { +// case 101: +// player->togglePlayerScale(true, true); +// player->updatePlayerScale(); +// break; +// case 99: +// player->togglePlayerScale(false, true); +// player->updatePlayerScale(); +// break; +// // case 11: +// // player->flipGravity(true, true); break; +// // case 10: +// // player->flipGravity(false, true); break; +// case 200: player->m_playerSpeed = 0.7f; break; +// case 201: player->m_playerSpeed = 0.9f; break; +// case 202: player->m_playerSpeed = 1.1f; break; +// case 203: player->m_playerSpeed = 1.3f; break; +// case 1334: player->m_playerSpeed = 1.6f; break; +// } +// } + +// cocos2d::CCDrawNode* ShowTrajectory::trajectoryNode() { + +// static TrajectoryNode* instance = nullptr; + +// if (!instance) { +// instance = TrajectoryNode::create(); +// instance->retain(); + +// cocos2d::_ccBlendFunc blendFunc; +// blendFunc.src = GL_SRC_ALPHA; +// blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA; + +// instance->setBlendFunc(blendFunc); +// } + +// return instance; +// } + +// class $modify(PlayLayer) { + +// static void onModify(auto & self) { +// if (!self.setHookPriority("PlayLayer::destroyPlayer", 100)) +// log::warn("PlayLayer::destroyPlayer hook priority fail xD."); - if (!self.setHookPriority("PlayLayer::playEndAnimationToPos", 100)) - log::warn("PlayLayer::playEndAnimationToPos hook priority fail xD."); - } - - void postUpdate(float dt) { - PlayLayer::postUpdate(dt); +// if (!self.setHookPriority("PlayLayer::playEndAnimationToPos", 100)) +// log::warn("PlayLayer::playEndAnimationToPos hook priority fail xD."); +// } + +// void postUpdate(float dt) { +// PlayLayer::postUpdate(dt); - if (!t.trajectoryNode() || t.creatingTrajectory) return; +// if (!t.trajectoryNode() || t.creatingTrajectory) return; - int frame = Global::getCurrentFrame(); +// int frame = Global::getCurrentFrame(); - if (Global::get().showTrajectory && frame > 2) { +// if (Global::get().showTrajectory && frame > 2) { - ShowTrajectory::updateTrajectory(this); +// ShowTrajectory::updateTrajectory(this); - } - else if (t.trajectoryNode()->isVisible()) { - t.trajectoryNode()->clear(); - t.trajectoryNode()->setVisible(false); - } +// } +// else if (t.trajectoryNode()->isVisible()) { +// t.trajectoryNode()->clear(); +// t.trajectoryNode()->setVisible(false); +// } - } +// } - void setupHasCompleted() { - PlayLayer::setupHasCompleted(); +// void setupHasCompleted() { +// PlayLayer::setupHasCompleted(); - t.fakePlayer1 = nullptr; - t.fakePlayer2 = nullptr; - t.cancelTrajectory = false; - t.creatingTrajectory = false; +// t.fakePlayer1 = nullptr; +// t.fakePlayer2 = nullptr; +// t.cancelTrajectory = false; +// t.creatingTrajectory = false; - t.fakePlayer1 = PlayerObject::create(1, 1, this, this, true); - t.fakePlayer1->retain(); - t.fakePlayer1->setPosition({ 0, 105 }); - t.fakePlayer1->setVisible(false); - m_objectLayer->addChild(t.fakePlayer1); +// t.fakePlayer1 = PlayerObject::create(1, 1, this, this, true); +// t.fakePlayer1->retain(); +// t.fakePlayer1->setPosition({ 0, 105 }); +// t.fakePlayer1->setVisible(false); +// m_objectLayer->addChild(t.fakePlayer1); - t.fakePlayer2 = PlayerObject::create(1, 1, this, this, true); - t.fakePlayer2->retain(); - t.fakePlayer2->setPosition({ 0, 105 }); - t.fakePlayer2->setVisible(false); - m_objectLayer->addChild(t.fakePlayer2); +// t.fakePlayer2 = PlayerObject::create(1, 1, this, this, true); +// t.fakePlayer2->retain(); +// t.fakePlayer2->setPosition({ 0, 105 }); +// t.fakePlayer2->setVisible(false); +// m_objectLayer->addChild(t.fakePlayer2); - t.length = Mod::get()->getSettingValue("show_trajectory_length"); +// t.length = Mod::get()->getSettingValue("show_trajectory_length"); - t.color1 = ccc4FFromccc3B(Mod::get()->getSettingValue("show_trajectory_color1")); - t.color1.a = 1.f; +// t.color1 = ccc4FFromccc3B(Mod::get()->getSettingValue("show_trajectory_color1")); +// t.color1.a = 1.f; - t.color2 = ccc4FFromccc3B(Mod::get()->getSettingValue("show_trajectory_color2")); - t.color2.a = 1.f; +// t.color2 = ccc4FFromccc3B(Mod::get()->getSettingValue("show_trajectory_color2")); +// t.color2.a = 1.f; - t.color3 = ShowTrajectory::getMergedColor(t.color1, t.color2); +// t.color3 = ShowTrajectory::getMergedColor(t.color1, t.color2); - m_objectLayer->addChild(t.trajectoryNode(), 500); - } +// m_objectLayer->addChild(t.trajectoryNode(), 500); +// } - void destroyPlayer(PlayerObject * player, GameObject * gameObject) { - if (t.creatingTrajectory || (player == t.fakePlayer1 || player == t.fakePlayer2)) { - t.deathRotation = player->getRotation(); - t.cancelTrajectory = true; - return; - } +// void destroyPlayer(PlayerObject * player, GameObject * gameObject) { +// if (t.creatingTrajectory || (player == t.fakePlayer1 || player == t.fakePlayer2)) { +// t.deathRotation = player->getRotation(); +// t.cancelTrajectory = true; +// return; +// } - PlayLayer::destroyPlayer(player, gameObject); - } +// PlayLayer::destroyPlayer(player, gameObject); +// } - void onQuit() { - if (t.trajectoryNode()) - t.trajectoryNode()->clear(); +// void onQuit() { +// if (t.trajectoryNode()) +// t.trajectoryNode()->clear(); - t.fakePlayer1 = nullptr; - t.fakePlayer2 = nullptr; - t.cancelTrajectory = false; - t.creatingTrajectory = false; +// t.fakePlayer1 = nullptr; +// t.fakePlayer2 = nullptr; +// t.cancelTrajectory = false; +// t.creatingTrajectory = false; - PlayLayer::onQuit(); - } +// PlayLayer::onQuit(); +// } - void playEndAnimationToPos(cocos2d::CCPoint p0) { - if (!t.creatingTrajectory) - PlayLayer::playEndAnimationToPos(p0); - } +// void playEndAnimationToPos(cocos2d::CCPoint p0) { +// if (!t.creatingTrajectory) +// PlayLayer::playEndAnimationToPos(p0); +// } -}; +// }; -class $modify(PauseLayer) { - void goEdit() { - if (t.trajectoryNode()) - t.trajectoryNode()->clear(); +// class $modify(PauseLayer) { +// void goEdit() { +// if (t.trajectoryNode()) +// t.trajectoryNode()->clear(); - t.fakePlayer1 = nullptr; - t.fakePlayer2 = nullptr; - t.cancelTrajectory = false; - t.creatingTrajectory = false; +// t.fakePlayer1 = nullptr; +// t.fakePlayer2 = nullptr; +// t.cancelTrajectory = false; +// t.creatingTrajectory = false; - PauseLayer::goEdit(); - } -}; +// PauseLayer::goEdit(); +// } +// }; -class $modify(GJBaseGameLayer) { +// class $modify(GJBaseGameLayer) { - static void onModify(auto & self) { - if (!self.setHookPriority("GJBaseGameLayer::canBeActivatedByPlayer", 100)) - log::warn("GJBaseGameLayer::canBeActivatedByPlayer hook priority fail xD."); +// static void onModify(auto & self) { +// if (!self.setHookPriority("GJBaseGameLayer::canBeActivatedByPlayer", 100)) +// log::warn("GJBaseGameLayer::canBeActivatedByPlayer hook priority fail xD."); - if (!self.setHookPriority("GJBaseGameLayer::canBeActivatedByPlayer", 100)) - log::warn("GJBaseGameLayer::canBeActivatedByPlayer hook priority fail xD."); +// if (!self.setHookPriority("GJBaseGameLayer::canBeActivatedByPlayer", 100)) +// log::warn("GJBaseGameLayer::canBeActivatedByPlayer hook priority fail xD."); - if (!self.setHookPriority("GJBaseGameLayer::playerTouchedRing", 100)) - log::warn("GJBaseGameLayer::playerTouchedRing hook priority fail xD."); +// if (!self.setHookPriority("GJBaseGameLayer::playerTouchedRing", 100)) +// log::warn("GJBaseGameLayer::playerTouchedRing hook priority fail xD."); - if (!self.setHookPriority("GJBaseGameLayer::playerTouchedTrigger", 100)) - log::warn("GJBaseGameLayer::playerTouchedTrigger hook priority fail xD."); +// if (!self.setHookPriority("GJBaseGameLayer::playerTouchedTrigger", 100)) +// log::warn("GJBaseGameLayer::playerTouchedTrigger hook priority fail xD."); - if (!self.setHookPriority("GJBaseGameLayer::activateSFXTrigger", 100)) - log::warn("GJBaseGameLayer::activateSFXTrigger hook priority fail xD."); +// if (!self.setHookPriority("GJBaseGameLayer::activateSFXTrigger", 100)) +// log::warn("GJBaseGameLayer::activateSFXTrigger hook priority fail xD."); - if (!self.setHookPriority("GJBaseGameLayer::activateSongEditTrigger", 100)) - log::warn("GJBaseGameLayer::activateSongEditTrigger hook priority fail xD."); +// if (!self.setHookPriority("GJBaseGameLayer::activateSongEditTrigger", 100)) +// log::warn("GJBaseGameLayer::activateSongEditTrigger hook priority fail xD."); - if (!self.setHookPriority("GJBaseGameLayer::activateSongTrigger", 100)) - log::warn("GJBaseGameLayer::activateSongTrigger hook priority fail xD."); +// if (!self.setHookPriority("GJBaseGameLayer::activateSongTrigger", 100)) +// log::warn("GJBaseGameLayer::activateSongTrigger hook priority fail xD."); - if (!self.setHookPriority("GJBaseGameLayer::gameEventTriggered", 100)) - log::warn("GJBaseGameLayer::gameEventTriggered hook priority fail xD."); - } +// if (!self.setHookPriority("GJBaseGameLayer::gameEventTriggered", 100)) +// log::warn("GJBaseGameLayer::gameEventTriggered hook priority fail xD."); +// } - void collisionCheckObjects(PlayerObject * p0, gd::vector*objects, int p2, float p3) { - if (t.creatingTrajectory) { - std::vector disabledObjects; +// void collisionCheckObjects(PlayerObject * p0, gd::vector*objects, int p2, float p3) { +// if (t.creatingTrajectory) { +// std::vector disabledObjects; - for (const auto& obj : *objects) { - if (!obj) continue; +// for (const auto& obj : *objects) { +// if (!obj) continue; - if ((!objectTypes.contains(static_cast(obj->m_objectType)) && !portalIDs.contains(obj->m_objectID)) || collectibleIDs.contains(obj->m_objectID)) { - if (obj->m_isDisabled || obj->m_isDisabled2) continue; +// if ((!objectTypes.contains(static_cast(obj->m_objectType)) && !portalIDs.contains(obj->m_objectID)) || collectibleIDs.contains(obj->m_objectID)) { +// if (obj->m_isDisabled || obj->m_isDisabled2) continue; - disabledObjects.push_back(obj); - obj->m_isDisabled = true; - obj->m_isDisabled2 = true; - } - } +// disabledObjects.push_back(obj); +// obj->m_isDisabled = true; +// obj->m_isDisabled2 = true; +// } +// } - GJBaseGameLayer::collisionCheckObjects(p0, objects, p2, p3); +// GJBaseGameLayer::collisionCheckObjects(p0, objects, p2, p3); - for (const auto& obj : disabledObjects) { - if (!obj) continue; +// for (const auto& obj : disabledObjects) { +// if (!obj) continue; - obj->m_isDisabled = false; - obj->m_isDisabled2 = false; - } +// obj->m_isDisabled = false; +// obj->m_isDisabled2 = false; +// } - disabledObjects.clear(); +// disabledObjects.clear(); - return; - } +// return; +// } - GJBaseGameLayer::collisionCheckObjects(p0, objects, p2, p3); - } +// GJBaseGameLayer::collisionCheckObjects(p0, objects, p2, p3); +// } - bool canBeActivatedByPlayer(PlayerObject * p0, EffectGameObject * p1) { - if (t.creatingTrajectory) { +// bool canBeActivatedByPlayer(PlayerObject * p0, EffectGameObject * p1) { +// if (t.creatingTrajectory) { - ShowTrajectory::handlePortal(p0, p1->m_objectID); +// ShowTrajectory::handlePortal(p0, p1->m_objectID); - return false; - } +// return false; +// } - return GJBaseGameLayer::canBeActivatedByPlayer(p0, p1); - } +// return GJBaseGameLayer::canBeActivatedByPlayer(p0, p1); +// } - void playerTouchedRing(PlayerObject * p0, RingObject * p1) { - if (!t.creatingTrajectory) - GJBaseGameLayer::playerTouchedRing(p0, p1); - } +// void playerTouchedRing(PlayerObject * p0, RingObject * p1) { +// if (!t.creatingTrajectory) +// GJBaseGameLayer::playerTouchedRing(p0, p1); +// } - void playerTouchedTrigger(PlayerObject * p0, EffectGameObject * p1) { - if (!t.creatingTrajectory) - GJBaseGameLayer::playerTouchedTrigger(p0, p1); - else - ShowTrajectory::handlePortal(p0, p1->m_objectID); - } +// void playerTouchedTrigger(PlayerObject * p0, EffectGameObject * p1) { +// if (!t.creatingTrajectory) +// GJBaseGameLayer::playerTouchedTrigger(p0, p1); +// else +// ShowTrajectory::handlePortal(p0, p1->m_objectID); +// } - void activateSFXTrigger(SFXTriggerGameObject * p0) { - if (!t.creatingTrajectory) - GJBaseGameLayer::activateSFXTrigger(p0); +// void activateSFXTrigger(SFXTriggerGameObject * p0) { +// if (!t.creatingTrajectory) +// GJBaseGameLayer::activateSFXTrigger(p0); - } - void activateSongEditTrigger(SongTriggerGameObject * p0) { - if (!t.creatingTrajectory) - GJBaseGameLayer::activateSongEditTrigger(p0); +// } +// void activateSongEditTrigger(SongTriggerGameObject * p0) { +// if (!t.creatingTrajectory) +// GJBaseGameLayer::activateSongEditTrigger(p0); - } - // void activateSongTrigger(SongTriggerGameObject * p0) { - // if (!t.creatingTrajectory) - // GJBaseGameLayer::activateSongTrigger(p0); - // } +// } +// // void activateSongTrigger(SongTriggerGameObject * p0) { +// // if (!t.creatingTrajectory) +// // GJBaseGameLayer::activateSongTrigger(p0); +// // } - void gameEventTriggered(GJGameEvent p0, int p1, int p2) { - if (!t.creatingTrajectory) - GJBaseGameLayer::gameEventTriggered(p0, p1, p2); - } +// void gameEventTriggered(GJGameEvent p0, int p1, int p2) { +// if (!t.creatingTrajectory) +// GJBaseGameLayer::gameEventTriggered(p0, p1, p2); +// } -}; +// }; -class $modify(PlayerObject) { +// class $modify(PlayerObject) { - static void onModify(auto & self) { - if (!self.setHookPriority("PlayerObject::playDynamicSpiderRun", 100)) - log::warn("PlayerObject::playDynamicSpiderRun hook priority fail xD."); +// static void onModify(auto & self) { +// if (!self.setHookPriority("PlayerObject::playDynamicSpiderRun", 100)) +// log::warn("PlayerObject::playDynamicSpiderRun hook priority fail xD."); - if (!self.setHookPriority("PlayerObject::playSpiderDashEffect", 100)) - log::warn("PlayerObject::playSpiderDashEffect hook priority fail xD."); - - if (!self.setHookPriority("PlayerObject::incrementJumps", 100)) - log::warn("PlayerObject::incrementJumps hook priority fail xD."); - - if (!self.setHookPriority("PlayerObject::ringJump", 100)) - log::warn("PlayerObject::ringJump hook priority fail xD."); - } - - void update(float dt) { - PlayerObject::update(dt); - t.delta = dt; - } - - void playSpiderDashEffect(cocos2d::CCPoint p0, cocos2d::CCPoint p1) { - if (!t.creatingTrajectory) - PlayerObject::playSpiderDashEffect(p0, p1); - } - - void incrementJumps() { - if (!t.creatingTrajectory) - PlayerObject::incrementJumps(); - } - - void ringJump(RingObject * p0, bool p1) { - if (!t.creatingTrajectory) - PlayerObject::ringJump(p0, p1); - } - -}; - -class $modify(HardStreak) { - - static void onModify(auto & self) { - if (!self.setHookPriority("HardStreak::addPoint", 100)) - log::warn("HardStreak::addPoint hook priority fail xD."); - } - - void addPoint(cocos2d::CCPoint p0) { - if (!t.creatingTrajectory) - HardStreak::addPoint(p0); - } -}; - -class $modify(GameObject) { - - static void onModify(auto & self) { - if (!self.setHookPriority("GameObject::playShineEffect", 100)) - log::warn("GameObject::playShineEffect hook priority fail xD."); - } - - void playShineEffect() { - if (!t.creatingTrajectory) - GameObject::playShineEffect(); - } -}; - -class $modify(EffectGameObject) { - - static void onModify(auto & self) { - if (!self.setHookPriority("EffectGameObject::triggerObject", 100)) - log::warn("EffectGameObject::triggerObject hook priority fail xD."); - } - - void triggerObject(GJBaseGameLayer * p0, int p1, const gd::vector*p2) { - if (!t.creatingTrajectory) - EffectGameObject::triggerObject(p0, p1, p2); - } -}; \ No newline at end of file +// if (!self.setHookPriority("PlayerObject::playSpiderDashEffect", 100)) +// log::warn("PlayerObject::playSpiderDashEffect hook priority fail xD."); + +// if (!self.setHookPriority("PlayerObject::incrementJumps", 100)) +// log::warn("PlayerObject::incrementJumps hook priority fail xD."); + +// if (!self.setHookPriority("PlayerObject::ringJump", 100)) +// log::warn("PlayerObject::ringJump hook priority fail xD."); +// } + +// void update(float dt) { +// PlayerObject::update(dt); +// t.delta = dt; +// } + +// void playSpiderDashEffect(cocos2d::CCPoint p0, cocos2d::CCPoint p1) { +// if (!t.creatingTrajectory) +// PlayerObject::playSpiderDashEffect(p0, p1); +// } + +// void incrementJumps() { +// if (!t.creatingTrajectory) +// PlayerObject::incrementJumps(); +// } + +// void ringJump(RingObject * p0, bool p1) { +// if (!t.creatingTrajectory) +// PlayerObject::ringJump(p0, p1); +// } + +// }; + +// class $modify(HardStreak) { + +// static void onModify(auto & self) { +// if (!self.setHookPriority("HardStreak::addPoint", 100)) +// log::warn("HardStreak::addPoint hook priority fail xD."); +// } + +// void addPoint(cocos2d::CCPoint p0) { +// if (!t.creatingTrajectory) +// HardStreak::addPoint(p0); +// } +// }; + +// class $modify(GameObject) { + +// static void onModify(auto & self) { +// if (!self.setHookPriority("GameObject::playShineEffect", 100)) +// log::warn("GameObject::playShineEffect hook priority fail xD."); +// } + +// void playShineEffect() { +// if (!t.creatingTrajectory) +// GameObject::playShineEffect(); +// } +// }; + +// class $modify(EffectGameObject) { + +// static void onModify(auto & self) { +// if (!self.setHookPriority("EffectGameObject::triggerObject", 100)) +// log::warn("EffectGameObject::triggerObject hook priority fail xD."); +// } + +// void triggerObject(GJBaseGameLayer * p0, int p1, const gd::vector*p2) { +// if (!t.creatingTrajectory) +// EffectGameObject::triggerObject(p0, p1, p2); +// } +// }; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index d117708..5e234d6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -207,7 +207,7 @@ class $modify(BGLHook, GJBaseGameLayer) { if (!pl) return GJBaseGameLayer::processCommands(dt); - Global::updateSeed(); + // Global::updateSeed(); int frame = Global::getCurrentFrame();