Skip to content

Commit

Permalink
Initial 2.2 build
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Dec 31, 2023
1 parent 118a2d2 commit 4248d5d
Show file tree
Hide file tree
Showing 37 changed files with 155 additions and 116 deletions.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"geode": "1.3.7",
"geode": "2.0.0",
"version": "v3.1.1",
"id": "cvolton.betterinfo",
"name": "BetterInfo",
Expand Down
7 changes: 4 additions & 3 deletions src/hooks/CommentCell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class $modify(BICommentCell, CommentCell) {
auto level = GJGameLevel::create();
level->m_levelID = this->m_comment->m_levelID;

InfoLayer* infoLayer = InfoLayer::create(level, nullptr);
InfoLayer* infoLayer = InfoLayer::create(level, nullptr, nullptr);
infoLayer->m_scene = this->getParent()->getParent()->getParent()->getParent()->getParent()->getParent();
infoLayer->show();
}
Expand Down Expand Up @@ -136,8 +136,9 @@ class $modify(BICommentCell, CommentCell) {
bool liked = GameLevelManager::sharedState()->hasLikedItemFullCheck(type, this->m_comment->m_commentID, special);
if(liked) return;

auto GM = GameManager::sharedState();
if (this->m_comment->m_userID == GM->m_playerUserID) return;
//TODO: missing game manager members
/*auto GM = GameManager::sharedState();
if (this->m_comment->m_userID == GM->m_playerUserID) return;*/

auto AM = GJAccountManager::sharedState();
if (this->m_comment->m_accountID && this->m_comment->m_accountID == AM->m_accountID) return;
Expand Down
10 changes: 5 additions & 5 deletions src/hooks/CreatorLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class $modify(BICreatorLayer, CreatorLayer) {
/*
* Helpers
*/
void showQuestExclamationMark(){
/*void showQuestExclamationMark(){
auto menu = static_cast<CCMenu*>(this->getChildByID("creator-buttons-menu"));
auto GSM = GameStatsManager::sharedState();
Expand All @@ -45,7 +45,7 @@ class $modify(BICreatorLayer, CreatorLayer) {
exMark->setScale(0.7f);
exMark->setID("exclamation-mark"_spr);
questBtn->addChild(exMark);
}
}*/

/*
* Hooks
Expand Down Expand Up @@ -74,7 +74,7 @@ class $modify(BICreatorLayer, CreatorLayer) {

this->addChild(menu);

showQuestExclamationMark();
//showQuestExclamationMark();

return true;
}
Expand All @@ -88,9 +88,9 @@ class $modify(BICreatorLayer, CreatorLayer) {
CreatorLayer::onChallenge(sender);
}

void sceneWillResume(){
/*void sceneWillResume(){
CreatorLayer::sceneWillResume();
showQuestExclamationMark();
}
}*/
};
9 changes: 5 additions & 4 deletions src/hooks/DailyLevelPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class $modify(BIDailyLevelPage, DailyLevelPage) {
* Callbacks
*/
void onDailyHistory(CCObject* sender){
auto layer = DailyViewLayer::scene(this->m_weekly);
//TODO: support event levels
auto layer = DailyViewLayer::scene(m_type == GJTimedLevelType::Weekly);
auto transitionFade = CCTransitionFade::create(0.5, layer);
CCDirector::sharedDirector()->pushScene(transitionFade);
}
Expand All @@ -30,7 +31,7 @@ class $modify(BIDailyLevelPage, DailyLevelPage) {
auto winSize = CCDirector::sharedDirector()->getWinSize();

std::ostringstream currentDaily;
currentDaily << "Current: #" << ((this->m_weekly) ? GM->m_weeklyID % 100000 : GM->m_dailyID);
currentDaily << "Current: #" << ((m_type == GJTimedLevelType::Weekly) ? GM->m_weeklyID % 100000 : GM->m_dailyID);
auto currentDailyNode = CCLabelBMFont::create(currentDaily.str().c_str(), "chatFont.fnt");
currentDailyNode->setPosition({(winSize.width / 2) + 183, (winSize.height / 2) + 51});
currentDailyNode->setAnchorPoint({1,0});
Expand All @@ -41,8 +42,8 @@ class $modify(BIDailyLevelPage, DailyLevelPage) {
currentDailyNode->setID("current-daily-text"_spr);
}

bool init(bool isWeekly) {
if(!DailyLevelPage::init(isWeekly)) return false;
bool init(GJTimedLevelType type) {
if(!DailyLevelPage::init(type)) return false;

CCMenu* menu = this->m_buttonMenu;

Expand Down
8 changes: 4 additions & 4 deletions src/hooks/GameLevelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ class $modify(GameLevelManager) {
* Helpers
*/

bool validateRangeOption(const std::string& option, int value) {
/*bool validateRangeOption(const std::string& option, int value) {
if(Mod::get()->getSavedValue<bool>(option)) {
int min = Mod::get()->getSavedValue<int>(fmt::format("{}_min", option));
int max = Mod::get()->getSavedValue<int>(fmt::format("{}_max", option));
if(min != 0 && value < min) return false;
if(max != 0 && value > max) return false;
}
return true;
}
}*/

/*
* Hooks
Expand All @@ -43,7 +43,7 @@ class $modify(GameLevelManager) {
return userName;
}

CCArray* getCompletedLevels(bool newFilter){
/*CCArray* getCompletedLevels(bool newFilter){
CompleteMode mode = static_cast<CompleteMode>(Mod::get()->getSavedValue<int>("search_completed"));
if(mode == CompleteMode::modeDefault) return GameLevelManager::getCompletedLevels(newFilter);
Expand Down Expand Up @@ -206,5 +206,5 @@ class $modify(GameLevelManager) {
GameLevelManager::limitSavedLevels();
m_fields->skipSavedFilter = false;
}
}*/
};
22 changes: 17 additions & 5 deletions src/hooks/InfoLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,19 @@ class $modify(BIInfoLayer, InfoLayer) {
bool nextVisible = this->m_rightArrow->isVisible();

auto GLM = GameLevelManager::sharedState();
if(this->m_commentHistory) GLM->resetCommentTimersForLevelID(this->m_score->m_userID, this->m_commentHistory);
else GLM->resetCommentTimersForLevelID(this->m_level->m_levelID, this->m_commentHistory);
switch(m_mode) {
case CommentKeyType::Level:
GLM->resetCommentTimersForLevelID(this->m_level->m_levelID, m_mode);
break;
case CommentKeyType::User:
GLM->resetCommentTimersForLevelID(this->m_score->m_userID, m_mode);
break;
case CommentKeyType::LevelList:
//GLM->resetCommentTimersForLevelID(this->m_level->m_levelID, m_mode);
//TODO: need levellist class members
break;
}

this->loadPage(this->m_page, true);

this->m_loadingCircle->setVisible(false);
Expand All @@ -54,11 +65,12 @@ class $modify(BIInfoLayer, InfoLayer) {
this->getScheduler()->unscheduleSelector(schedule_selector(BIInfoLayer::onInfoLayerSchedule), this);
}

this->addChild(TextAlertPopup::create(text, 0.5f, 0.6f), 100);
//this->addChild(TextAlertPopup::create(text, 0.5f, 0.6f), 100);
Notification::create(text, NotificationIcon::None, .1f)->show();
}

bool init(GJGameLevel* level, GJUserScore* score) {
if (!InfoLayer::init(level, score)) return false;
bool init(GJGameLevel* level, GJUserScore* score, GJLevelList* list) {
if (!InfoLayer::init(level, score, list)) return false;

if(level) {
auto cache = BetterInfoCache::sharedState();
Expand Down
10 changes: 6 additions & 4 deletions src/hooks/LevelCell.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include <Geode/Bindings.hpp>
//TODO: reverse LevelCell

/*#include <Geode/Bindings.hpp>
#include <Geode/modify/LevelCell.hpp>
#include "../managers/BetterInfoCache.h"
Expand All @@ -14,7 +16,7 @@ class $modify(BILevelCell, LevelCell) {
static void onModify(auto& self) {
auto res = self.setHookPriority("LevelCell::onViewProfile", 99999);
}
}*/

/*void showDesc() {
if(m_fields->m_levelDesc) return;
Expand Down Expand Up @@ -100,7 +102,7 @@ class $modify(BILevelCell, LevelCell) {
* Hooks
*/

void onViewProfile(CCObject* sender) {
/*void onViewProfile(CCObject* sender) {
if(this->m_level->m_accountID == 0) {
UnregisteredProfileLayer::displayProfile(this->m_level->m_userID, this->m_level->m_creatorName);
Expand Down Expand Up @@ -167,4 +169,4 @@ class $modify(BILevelCell, LevelCell) {
}
}
}
};
};*/
4 changes: 2 additions & 2 deletions src/hooks/LevelInfoLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class $modify(LevelInfoLayer) {
res = self.setHookPriority("LevelInfoLayer::onLevelInfo", 99999);
}

bool init(GJGameLevel* level) {
if (!LevelInfoLayer::init(level)) return false;
bool init(GJGameLevel* level, bool challenge) {
if (!LevelInfoLayer::init(level, challenge)) return false;

/**
* Clickable green username
Expand Down
14 changes: 8 additions & 6 deletions src/hooks/LevelLeaderboard.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#include <Geode/Bindings.hpp>
//TODO: reverse LevelLeaderboard

/*#include <Geode/Bindings.hpp>
#include <Geode/modify/LevelLeaderboard.hpp>
using namespace geode::prelude;
class $modify(BILevelLeaderboard, LevelLeaderboard) {
class $modify(BILevelLeaderboard, LevelLeaderboard) {*/

/*
* Callbacks
*/

void onLeaderboardDaily(CCObject* sender){
/*void onLeaderboardDaily(CCObject* sender){
auto level = GJGameLevel::create();
level->m_levelID = this->m_level->m_levelID;
level->m_levelName = this->m_level->m_levelName;
Expand All @@ -19,13 +21,13 @@ class $modify(BILevelLeaderboard, LevelLeaderboard) {
newLeaderboard->onUpdate(sender);
CCDirector::sharedDirector()->getRunningScene()->addChild(newLeaderboard);
this->onClose(sender);
}
}*/

/*
* Hooks
*/

bool init(GJGameLevel* level, LevelLeaderboardType type) { //type is usually an enum but i dont have that rn
/*bool init(GJGameLevel* level, LevelLeaderboardType type) { //type is usually an enum but i dont have that rn
if(!LevelLeaderboard::init(level, type)) return false;
auto buttonSprite = ButtonSprite::create((level->m_dailyID ? "Daily" : "Normal"), 20, true, "bigFont.fnt", "GJ_button_01.png", 30, 0.5);
Expand All @@ -41,4 +43,4 @@ class $modify(BILevelLeaderboard, LevelLeaderboard) {
return true;
}
};
};*/
1 change: 1 addition & 0 deletions src/hooks/LevelPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class $modify(LevelPage) {
}

void onInfo(CCObject* sender) {
//TODO: reverse LevelPage
LevelProgressDialog::show(this->m_level);
}
};
14 changes: 8 additions & 6 deletions src/hooks/MoreSearchLayer.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include <Geode/Bindings.hpp>
//TODO: reverse MoreSearchLayer

/*#include <Geode/Bindings.hpp>
#include <Geode/modify/MoreSearchLayer.hpp>
#include "../layers/LevelFiltering/CvoltonSearchOptions.h"
Expand All @@ -12,13 +14,13 @@ class $modify(BIMoreSearchLayer, MoreSearchLayer) {
bool shouldSavedBtnBeVisible(){
return GameLevelManager::sharedState()->getBoolForKey("customsong_filter") && GameLevelManager::sharedState()->getBoolForKey("enable_songFilter");
}
}*/

/*
* Callbacks
*/

void onMoreSearchNext(CCObject* sender){
/*void onMoreSearchNext(CCObject* sender){
auto layer = CvoltonSearchOptions::create();
CCDirector::sharedDirector()->getRunningScene()->addChild(layer);
this->onClose(sender);
Expand All @@ -37,13 +39,13 @@ class $modify(BIMoreSearchLayer, MoreSearchLayer) {
GameLevelManager::sharedState()->setIntForKey(m_fields->m_songID, "song_filter");
m_enterSongID->setString(std::to_string(m_fields->m_songID));
}
}
}*/

/*
* Hooks
*/

void onClose(CCObject* sender){
/*void onClose(CCObject* sender){
if(m_fields->m_settings) m_fields->m_settings->release();
MoreSearchLayer::onClose(sender);
Expand Down Expand Up @@ -103,4 +105,4 @@ class $modify(BIMoreSearchLayer, MoreSearchLayer) {
if(m_fields->m_savedBtn) m_fields->m_savedBtn->setVisible(shouldSavedBtnBeVisible());
}
};
};*/
8 changes: 5 additions & 3 deletions src/hooks/PlayLayer.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include <Geode/Bindings.hpp>
//TODO: reverse PlayLayer and GJBaseGameLayer

/*#include <Geode/Bindings.hpp>
#include <Geode/modify/PlayLayer.hpp>
#include "../managers/BetterInfoScheduler.h"
Expand Down Expand Up @@ -55,7 +57,7 @@ class $modify(BIPlayLayer, PlayLayer) {
.y = player->m_position.y,
.rotation = player->getRotation()
});*/
}
/*}
void resetLevel(){
needsReset = false;
Expand All @@ -65,4 +67,4 @@ class $modify(BIPlayLayer, PlayLayer) {
auto stats = BetterInfoStats::sharedState();
stats->logAttempt(this->m_level, this->m_isPracticeMode);
}
};
};*/
12 changes: 6 additions & 6 deletions src/hooks/ProfilePage.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Geode/Bindings.hpp>
/*#include <Geode/Bindings.hpp>
#include <Geode/modify/ProfilePage.hpp>
#include "../utils.hpp"
Expand Down Expand Up @@ -46,7 +46,7 @@ class $modify(BIProfilePage, ProfilePage) {
/*
* Callbacks
*/

/*
void onProfilePageInfo(CCObject* sender){
auto score = this->m_score;
auto GM = GameManager::sharedState();
Expand Down Expand Up @@ -105,7 +105,7 @@ class $modify(BIProfilePage, ProfilePage) {
* Helper funcs
*/

inline void fixProfilePagePositions(){
/* inline void fixProfilePagePositions(){
auto layer = static_cast<CCLayer*>(this->getChildren()->objectAtIndex(0));
auto winSize = CCDirector::sharedDirector()->getWinSize();
Expand All @@ -117,12 +117,12 @@ class $modify(BIProfilePage, ProfilePage) {
CCNode* followTxt = typeinfo_cast<CCNode*>(layer->getChildren()->objectAtIndex(6));
if(followTxt->getPositionY() == (winSize.height / 2) - 125) followTxt->setVisible(false); //followTxt->setPositionX(followTxt->getPositionX() + 40);
}

*/
/*
* Hooks
*/

void loadPageFromUserInfo(GJUserScore* a2){
/*void loadPageFromUserInfo(GJUserScore* a2){
GameLevelManager::sharedState()->storeUserName(a2->m_userID, a2->m_accountID, a2->m_userName);
ProfilePage::loadPageFromUserInfo(a2);
Expand Down Expand Up @@ -277,4 +277,4 @@ class $modify(BIProfilePage, ProfilePage) {
ProfilePage::keyBackClicked();
}
};
};*/
Loading

0 comments on commit 4248d5d

Please sign in to comment.