Skip to content

Commit

Permalink
not a glorified alertlayertweaks advertisement
Browse files Browse the repository at this point in the history
  • Loading branch information
RayDeeUx authored Oct 31, 2024
1 parent 179de65 commit 22d983c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <Geode/modify/MenuLayer.hpp>
#include <Geode/modify/PlayLayer.hpp>
#include <Geode/modify/FLAlertLayer.hpp>
#include <Geode/modify/PlayerObject.hpp>
#include <filesystem>
#include <iostream>
Expand All @@ -10,6 +11,8 @@
#include <regex>
#include "Settings.hpp"

#define PREFERRED_HOOK_PRIO (-2123456789)

using namespace geode::prelude;

const static std::regex percentRegex = std::regex(R"(^(\d+)%$)");
Expand Down Expand Up @@ -123,6 +126,21 @@ bool isNewBest(PlayLayer* pl) {
return pl->getCurrentPercentInt() > pl->m_level->m_normalPercent.value();
}

class $modify(MyFLAlertLayer, FLAlertLayer) {
static void onModify(auto & self)
{
(void) self.setHookPriority("FLAlertLayer::init", PREFERRED_HOOK_PRIO);
}
bool init(FLAlertLayerProtocol* delegate, char const* title, gd::string desc, char const* btn1, char const* btn2, float width, bool scroll, float height, float textScale) {
const std::string& titleAsString = title;
const std::string& descAsString = desc;
if (titleAsString != "\"New Best\" Text Font #" && !utils::string::contains(descAsString, "To use font numbers greater than 0: refer to the level editor for the font each number corresponds to, subtract that number by 1, and then put it here.") && !utils::string::contains(descAsString, "suggested by Saritahh") && !utils::string::contains(descAsString, "If using Oxygene One")) {
return FLAlertLayer::init(delegate, title, desc, btn1, btn2, width, scroll, height, textScale);
}
return FLAlertLayer::init(delegate, title, desc, btn1, btn2, 420.f, true, 320.f, 1.0f);
}
};

class $modify(MyMenuLayer, MenuLayer) {
struct Fields {
Mod* mod = Mod::get();
Expand Down

0 comments on commit 22d983c

Please sign in to comment.