Skip to content

Commit

Permalink
fix some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
FireMario211 committed Nov 17, 2024
1 parent 8cab4c7 commit bb505cc
Show file tree
Hide file tree
Showing 11 changed files with 208 additions and 194 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ set(CMAKE_CXX_VISIBILITY_PRESET hidden)

if(NOT DEFINED GEODE_TARGET_PLATFORM)
set(GEODE_TARGET_PLATFORM "Win64")
set(GEODE_GD_VERSION 2.206)
set(GEODE_COMP_GD_VERSION 22060)
set(GEODE_GD_VERSION 2.2074)
set(GEODE_COMP_GD_VERSION 22074)
endif()

if (${GEODE_TARGET_PLATFORM} STREQUAL "Win64")
Expand Down Expand Up @@ -66,7 +66,7 @@ endif()
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND WIN32)
message("compiling on linux!!")
# why it requires advapi32 is beyond me
target_link_libraries(${PROJECT_NAME} opengl32 ws2_32 crypt32 wldap32 normaliz advapi32 comdlg32)
target_link_libraries(${PROJECT_NAME} opengl32 ws2_32 crypt32 wldap32 normaliz advapi32)
elseif(${GEODE_TARGET_PLATFORM} STREQUAL "Win32")
target_link_libraries(${PROJECT_NAME} opengl32 ws2_32 Crypt32 Wldap32 Normaliz)
endif()
Expand Down
6 changes: 3 additions & 3 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"geode": "4.0.0-alpha.1",
"geode": "4.0.0-beta.1",
"version": "v1.3.12",
"gd": {
"win": "2.2074",
Expand All @@ -20,12 +20,12 @@
"dependencies": [
{
"id": "geode.node-ids",
"version": ">=v1.14.0",
"version": ">=v1.17.0",
"importance": "required"
},
{
"id": "jouca.badgesapi",
"version": ">=v1.1.0",
"version": ">=v1.2.0-beta.3",
"importance": "required"
}
],
Expand Down
3 changes: 1 addition & 2 deletions src/MoreLeaderboards/LevelHelper.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#pragma once
#include "../includes.h"

#define STAR_EXP 5
Expand Down Expand Up @@ -412,4 +411,4 @@ class SpriteHelper {

return barColor;
}
};
};
4 changes: 1 addition & 3 deletions src/MoreLeaderboards/MoreLeaderboards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ void MoreLeaderboards::loadPageMore() {
addChild(listLayer);

if (MoreLeaderboards::scroll_int != 0) {
listLayer->m_listView->m_tableView->scrollLayer(-99999999);
listLayer->m_listView->m_tableView->scrollLayer((float)-INT_MAX);
listLayer->m_listView->m_tableView->scrollLayer(MoreLeaderboards::scroll_int);
}
}
Expand Down Expand Up @@ -1290,8 +1290,6 @@ void MoreLeaderboards::onTab(CCObject* pSender) {
class $modify(LeaderboardsLayer) {
bool init(LeaderboardState state) {
if (!LeaderboardsLayer::init(state)) return false;

log::info("weee");
auto menu = CCMenu::create();

auto plusSpr = CCSprite::createWithSpriteFrameName("GJ_plusBtn_001.png");
Expand Down
4 changes: 2 additions & 2 deletions src/Secret/BadApple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class $modify(SecretVault, SecretLayer2) {
void launchBadApple(CCObject* pSender) {

//GameSoundManager::sharedManager()->stopBackgroundMusic();
FMODAudioEngine::sharedEngine()->stopAllMusic();
FMODAudioEngine::sharedEngine()->stopAllMusic(true);
auto scene = cocos2d::CCScene::create();
auto layer = BadApple::create();
scene->addChild(layer);
Expand All @@ -199,7 +199,7 @@ class $modify(SecretVault, SecretLayer2) {

void launchCOTE(CCObject* pSender) {
//GameSoundManager::sharedManager()->stopBackgroundMusic();
FMODAudioEngine::sharedEngine()->stopAllMusic();
FMODAudioEngine::sharedEngine()->stopAllMusic(true);
auto scene = cocos2d::CCScene::create();
auto layer = COTE::create();
scene->addChild(layer);
Expand Down
104 changes: 0 additions & 104 deletions src/Settings/CustomSettings.cpp
Original file line number Diff line number Diff line change
@@ -1,114 +1,10 @@
#include "CustomSettings.hpp"
#include <Geode/loader/Dirs.hpp>
#include "../Notifications/EventsPush.h"
#include "../includes.h"
int cycleTypes = -1;

SettingNodeV3* SettingTestValue::createNode(float width) {
return SettingTestNode::create(static_pointer_cast<SettingTestValue>(shared_from_this()), width);
}
SettingNodeV3* SettingPosValue::createNode(float width) {
return SettingPosNode::create(static_pointer_cast<SettingPosValue>(shared_from_this()), width);
}
SettingNodeV3* SettingCreditsValue::createNode(float width) {
return SettingCreditsNode::create(static_pointer_cast<SettingCreditsValue>(shared_from_this()), width);
}

void SettingTestNode::onTestBtn(CCObject*) {
auto scene = CCDirector::sharedDirector()->getRunningScene();
cycleTypes = cycleTypes + 1;
if (cycleTypes > 4) cycleTypes = 0;
bool newRate = Mod::get()->getSettingValue<bool>("newRate");
bool daily = Mod::get()->getSettingValue<bool>("daily");
bool weekly = Mod::get()->getSettingValue<bool>("weekly");
if (!newRate && cycleTypes == 0) cycleTypes = 1;
if (!daily && cycleTypes == 1) cycleTypes = 2;
if (!weekly && cycleTypes == 2) cycleTypes = 3;
if (!newRate && !daily && !weekly) {
cycleTypes = 5;
}

sio::message::ptr data = sio::object_message::create();
//{'demon': 1, 'type': 1, 'starsum': 6, 'stars': 10, 'rate': 1, 'title': 'BRAINPOWER Let the base kick!', 'level_name': 'O-oooooooooo AAAAE-A-A-I-A-U-', 'level_creator': ' JO-oooooooooooo AAE-O-A-A-U-U-A- E-eee-ee-eee AAAAE-A-E-I-E-A- JO-ooo-oo-oo-oo EEEEO-A-AAA-AAAA', 'sprite': 'GJ_square01.png'}
data->get_map()["coins"] = sio::int_message::create(3);
data->get_map()["verified_coins"] = sio::int_message::create(1);
data->get_map()["platformer"] = sio::int_message::create(0);
switch (cycleTypes) {
case 0: // new rate
data->get_map()["title"] = sio::string_message::create("New Rated Level !");
data->get_map()["demon"] = sio::int_message::create(0);
data->get_map()["type"] = sio::int_message::create(0);
data->get_map()["stars"] = sio::int_message::create(1);
data->get_map()["starsum"] = sio::int_message::create(10);
data->get_map()["level_name"] = sio::string_message::create("Stereo Madness");
data->get_map()["level_creator"] = sio::string_message::create("by RobTop");
data->get_map()["sprite"] = sio::string_message::create("GJ_square01.png");
data->get_map()["rate"] = sio::int_message::create(1);
break;
case 1: // daily
data->get_map()["title"] = sio::string_message::create("New Daily Level !");
data->get_map()["demon"] = sio::int_message::create(0);
data->get_map()["type"] = sio::int_message::create(1);
data->get_map()["stars"] = sio::int_message::create(9);
data->get_map()["starsum"] = sio::int_message::create(40);
data->get_map()["level_name"] = sio::string_message::create("Cycles");
data->get_map()["level_creator"] = sio::string_message::create("by RobTop");
data->get_map()["sprite"] = sio::string_message::create("GJ_square01.png");
data->get_map()["rate"] = sio::int_message::create(1);
break;
case 2: // weekly
data->get_map()["title"] = sio::string_message::create("New Weekly Level !");
data->get_map()["demon"] = sio::int_message::create(1);
data->get_map()["type"] = sio::int_message::create(2);
data->get_map()["stars"] = sio::int_message::create(14);
data->get_map()["starsum"] = sio::int_message::create(7);
data->get_map()["level_name"] = sio::string_message::create("Theory of Everything 2");
data->get_map()["level_creator"] = sio::string_message::create("by RobTop");
data->get_map()["sprite"] = sio::string_message::create("GJ_square05.png");
data->get_map()["rate"] = sio::int_message::create(1);
break;
case 3: // Legendary rating test
data->get_map()["title"] = sio::string_message::create("New Rated Level !");
data->get_map()["demon"] = sio::int_message::create(0);
data->get_map()["type"] = sio::int_message::create(0);
data->get_map()["stars"] = sio::int_message::create(3);
data->get_map()["starsum"] = sio::int_message::create(20);
data->get_map()["level_name"] = sio::string_message::create("Oh no it's happening");
data->get_map()["level_creator"] = sio::string_message::create("by ...");
data->get_map()["sprite"] = sio::string_message::create("GJ_square01.png");
data->get_map()["rate"] = sio::int_message::create(3);
break;
case 4: // Mythic rating test
data->get_map()["title"] = sio::string_message::create("New Rated Level !");
data->get_map()["demon"] = sio::int_message::create(0);
data->get_map()["type"] = sio::int_message::create(0);
data->get_map()["stars"] = sio::int_message::create(100);
data->get_map()["starsum"] = sio::int_message::create(20);
data->get_map()["level_name"] = sio::string_message::create("FIRE IN THE HOLE!");
data->get_map()["level_creator"] = sio::string_message::create("by GD Community");
data->get_map()["sprite"] = sio::string_message::create("GJ_square01.png");
data->get_map()["rate"] = sio::int_message::create(4);
break;
case 5: // in case the user disables everything
data->get_map()["title"] = sio::string_message::create("New Rated Level !");
data->get_map()["demon"] = sio::int_message::create(1);
data->get_map()["type"] = sio::int_message::create(-1);
data->get_map()["stars"] = sio::int_message::create(2);
data->get_map()["starsum"] = sio::int_message::create(6);
data->get_map()["level_name"] = sio::string_message::create("Back On Track");
data->get_map()["level_creator"] = sio::string_message::create("by RobTop");
data->get_map()["sprite"] = sio::string_message::create("GJ_square01.png");
data->get_map()["rate"] = sio::int_message::create(1);
break;
default: // not possible
data->get_map()["title"] = sio::string_message::create("hi there hxd user, ghidra user or ida user. (or hi RobTop) Here's a little easter egg for you :)");
data->get_map()["demon"] = sio::int_message::create(1);
data->get_map()["type"] = sio::int_message::create(2);
data->get_map()["stars"] = sio::int_message::create(14);
data->get_map()["starsum"] = sio::int_message::create(7);
data->get_map()["sprite"] = sio::string_message::create("This will crash! :D");

break;
}
EventsPush::pushRateLevel(scene, data);
}
71 changes: 1 addition & 70 deletions src/Settings/CustomSettings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,78 +4,8 @@
#include <Geode/ui/TextInput.hpp>
using namespace geode::prelude;

/*
--- Test ---
*/

class SettingTestValue : public SettingV3 {
public:
static Result<std::shared_ptr<SettingV3>> parse(std::string const& key, std::string const& modID, matjson::Value const& json) {
auto res = std::make_shared<SettingTestValue>();
auto root = checkJson(json, "SettingTestValue");
res->init(key, modID, root);
res->parseNameAndDescription(root);
root.checkUnknownKeys();
return root.ok(std::static_pointer_cast<SettingV3>(res));
}

bool load(matjson::Value const& json) override {
return true;
}
bool save(matjson::Value& json) const override {
return true;
}
bool isDefaultValue() const override {
return true;
}
void reset() override {}
SettingNodeV3* createNode(float width) override;
};


class SettingTestNode : public SettingNodeV3 {
protected:
bool init(std::shared_ptr<SettingTestValue> setting, float width) {
if (!SettingNodeV3::init(setting, width))
return false;
this->setContentSize({ width, 35.f });
auto label = CCLabelBMFont::create("Test", "bigFont.fnt");
label->setScale(.6F);
auto playSpr = CCSprite::createWithSpriteFrameName("GJ_playBtn2_001.png");
playSpr->setScale(.4F);
auto testBtn = CCMenuItemSpriteExtra::create(
playSpr,
this,
menu_selector(SettingTestNode::onTestBtn)
);
getButtonMenu()->setContentWidth(width);
getButtonMenu()->addChildAtPosition(label, Anchor::Left, {42, 0});
getButtonMenu()->addChildAtPosition(testBtn, Anchor::Right, {-15, 0});
getButtonMenu()->updateLayout();
getNameLabel()->setVisible(false);
return true;
}
void onCommit() override {}
void onResetToDefault() override {}

public:
void onTestBtn(CCObject*);
bool hasUncommittedChanges() const override {
return false;
}
bool hasNonDefaultValue() const override {
return false;
}
static SettingTestNode* create(std::shared_ptr<SettingTestValue> setting, float width) {
auto ret = new SettingTestNode();
if (ret && ret->init(setting, width)) {
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(ret);
return nullptr;
}
};

/*
Notification Position
Expand Down Expand Up @@ -267,6 +197,7 @@ class SettingCreditsValue : public SettingV3 {
auto root = checkJson(json, "SettingCreditsValue");
res->init(key, modID, root);
res->parseNameAndDescription(root);
res->parseEnableIf(root);
root.checkUnknownKeys();
return root.ok(std::static_pointer_cast<SettingV3>(res));
}
Expand Down
Loading

0 comments on commit bb505cc

Please sign in to comment.