-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d3ff538
commit 9a88fd1
Showing
13 changed files
with
94 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#define CALL_BUTTON_ORIGINAL(button) \ | ||
if (auto hooker = static_cast<ButtonHooker*>(static_cast<CCNode*>(button)->getUserObject("hooker"_spr))) \ | ||
(hooker->m_listener->*hooker->m_selector)(button) | ||
|
||
class ButtonHooker : public cocos2d::CCObject { | ||
private: | ||
public: | ||
cocos2d::CCObject* m_listener; | ||
cocos2d::CCObject* m_newListener; | ||
cocos2d::SEL_MenuHandler m_selector; | ||
cocos2d::SEL_MenuHandler m_newSelector; | ||
public: | ||
static ButtonHooker* create(cocos2d::CCMenuItem* button, cocos2d::CCObject* listener, cocos2d::SEL_MenuHandler selector); | ||
|
||
void onClick(cocos2d::CCObject* sender); | ||
static ButtonHooker* create(cocos2d::CCMenuItem* button, cocos2d::CCObject* listener, cocos2d::SEL_MenuHandler selector); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "../api/MoreIconsAPI.hpp" | ||
|
||
using namespace geode::prelude; | ||
|
||
#include <Geode/modify/MenuGameLayer.hpp> | ||
class $modify(MIMenuGameLayer, MenuGameLayer) { | ||
void resetPlayer() { | ||
MenuGameLayer::resetPlayer(); | ||
|
||
auto iconType = MoreIconsAPI::getIconType(m_playerObject); | ||
auto gameManager = GameManager::get(); | ||
auto iconCount = gameManager->countForType(iconType); | ||
auto cubeCount = iconType == IconType::Cube ? iconCount : gameManager->countForType(IconType::Cube); | ||
auto& vec = MoreIconsAPI::vectorForType(iconType); | ||
|
||
auto randomIcon = (int)roundf((rand() / (float)RAND_MAX) * (iconCount + vec.size() - 1)) + 1; | ||
auto randomCube = m_playerObject->m_isShip || m_playerObject->m_isBird | ||
? (int)roundf((rand() / (float)RAND_MAX) * (cubeCount + MoreIconsAPI::ICONS.size() - 1)) + 1 : 0; | ||
|
||
if (randomIcon > iconCount) { | ||
MoreIconsAPI::updatePlayerObject(m_playerObject, vec[randomIcon - iconCount - 1], iconType); | ||
if (m_playerObject->m_isShip || m_playerObject->m_isBird) { | ||
if (randomCube > cubeCount) MoreIconsAPI::updatePlayerObject(m_playerObject, MoreIconsAPI::ICONS[randomCube - cubeCount - 1], IconType::Cube); | ||
else m_playerObject->updatePlayerFrame(randomCube); | ||
} | ||
} | ||
else if (m_playerObject->m_isShip) { | ||
m_playerObject->updatePlayerShipFrame(randomIcon); | ||
if (randomCube > cubeCount) MoreIconsAPI::updatePlayerObject(m_playerObject, MoreIconsAPI::ICONS[randomCube - cubeCount - 1], IconType::Cube); | ||
else m_playerObject->updatePlayerFrame(randomCube); | ||
} | ||
else if (m_playerObject->m_isBall) m_playerObject->updatePlayerRollFrame(randomIcon); | ||
else if (m_playerObject->m_isBird) { | ||
m_playerObject->updatePlayerBirdFrame(randomIcon); | ||
if (randomCube > cubeCount) MoreIconsAPI::updatePlayerObject(m_playerObject, MoreIconsAPI::ICONS[randomCube - cubeCount - 1], IconType::Cube); | ||
else m_playerObject->updatePlayerFrame(randomCube); | ||
} | ||
else if (m_playerObject->m_isDart) m_playerObject->updatePlayerDartFrame(randomIcon); | ||
else if (m_playerObject->m_isRobot) m_playerObject->updatePlayerRobotFrame(randomIcon); | ||
else if (m_playerObject->m_isSpider) m_playerObject->updatePlayerSpiderFrame(randomIcon); | ||
else if (m_playerObject->m_isSwing) m_playerObject->updatePlayerSwingFrame(randomIcon); | ||
else m_playerObject->updatePlayerFrame(randomIcon); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters