Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
Signed-off-by: Nya Meow <nyameowmeow@icloud.com>
  • Loading branch information
vani11agirl authored Jul 31, 2024
1 parent 81dec5c commit 38c25a6
Showing 1 changed file with 26 additions and 44 deletions.
70 changes: 26 additions & 44 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,52 +1,34 @@
/**
* Include the Geode headers.
*/
#include "Geode/modify/Modify.hpp"
#include "ccTypes.h"
#include <Geode/Geode.hpp>
#include <Geode/binding/GameManager.hpp>
#include <Geode/modify/PlayLayer.hpp>

/**
* Brings cocos2d and all Geode namespaces to the current scope.
*/
using namespace geode::prelude;


#include <Geode/modify/PlayLayer.hpp>

ccColor3B paint(){
ccColor3B uwu;
/**
* Options:
* - Default (vanilla behavior): P1 color
* - Case 1: P2 color
* - Case 2: Player glow color
* - Case 3: Manual (configure in settings)
*/
switch(Mod::get()->getSettingValue<int64_t>("mode")){
case 1:
uwu = GameManager::sharedState()->colorForIdx(GameManager::sharedState()->getPlayerColor2());
break;
case 2:
uwu = GameManager::sharedState()->colorForIdx(GameManager::sharedState()->getPlayerGlowColor());
break;
case 3:
uwu = Mod::get()->getSettingValue<ccColor3B>("color");
break;
default:
uwu = GameManager::sharedState()->colorForIdx(GameManager::sharedState()->getPlayerColor());
break;
}
return uwu;
ccColor3B paint() {
auto gm = GameManager::sharedState(); // For convenience
/**
* Options:
* - Default (vanilla behavior): P1 color
* - Case 1: P2 color
* - Case 2: Player glow color
* - Case 3: Manual (configure in settings)
*/
switch(Mod::get()->getSettingValue<int64_t>("mode")){
case 1:
return gm->colorForIdx(gameManager->getPlayerColor2());
case 2:
return gm->colorForIdx(gameManager->getPlayerGlowColor());
case 3:
return Mod::get()->getSettingValue<ccColor3B>("color");
default:
return gm->colorForIdx(gameManager->getPlayerColor());
}
}

class $modify(PlayLayer) {
void startGame() {
PlayLayer::startGame();
if ((!m_level->isPlatformer()) && m_progressFill){
ccColor3B nya = paint();
// auto progress_bar = static_cast<CCSprite* >(m_progressFill); // fuuuuck // fuuuuuuck
m_progressFill->setColor(nya);
}
}
void startGame() {
PlayLayer::startGame();
if (!m_level->isPlatformer() && m_progressFill) {
m_progressFill->setColor(paint());
}
}
};

0 comments on commit 38c25a6

Please sign in to comment.