Skip to content

Commit

Permalink
v3-rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
user95401 committed Dec 7, 2024
1 parent 9cb7312 commit 43a111d
Show file tree
Hide file tree
Showing 50 changed files with 190 additions and 24 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ message("SRC: ${SRC}")
include_directories(src)

setup_geode_mod(${PROJECT_NAME})

#ImGui lol

CPMAddPackage("gh:matcool/gd-imgui-cocos#fbd4103")
target_link_libraries(${PROJECT_NAME} imgui-cocos)
12 changes: 6 additions & 6 deletions mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@
"type": "bool",
"default": false
},
"Add Objects in Menu Game": {
"name": "Add Objects in Menu Game",
"description": "spikes and pad....",
"type": "bool",
"default": true
},
"Freese Menu Game BG when Platformered": {
"name": "Freese Menu Game BG when Platformered",
"description": "Freese Menu Game BG when PlatformeredFreese Menu Game BG when PlatformeredFreese Menu Game BG when PlatformeredFreese Menu Game BG when Platformered....",
Expand Down Expand Up @@ -136,6 +130,12 @@
"type": "bool",
"default": true
},
"Boost Rotation Thing": {
"name": "Boost Rotation Thing",
"description": "Boost Rotation ThingBoost Rotation ThingBoost Rotation ThingBoost Rotation ThingBoost Rotation Thing.",
"type": "bool",
"default": true
},
"jelly cube": {
"name": "jelly cube",
"description": "jelly cube.",
Expand Down
Binary file not shown.
Binary file removed resources/sounds/menuLoops/menuLoop_rand(asd3).mp3
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/spritesheets/GJ_GameSheet03/GJ_sStarsIcon_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/spritesheets/GJ_GameSheet03/GJ_starsIcon_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 103 additions & 0 deletions src/_ImGui.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#pragma once

#include <imgui.h>
#include <cocos2d.h>

using namespace cocos2d;

static std::ostream& operator<<(std::ostream& stream, ImVec2 const& vec) {
return stream << vec.x << ", " << vec.y;
}

static std::ostream& operator<<(std::ostream& stream, ImVec4 const& vec) {
return stream << vec.x << ", " << vec.y << ", " << vec.z << ", " << vec.w;
}

static ImVec2 operator+(ImVec2 const& a, ImVec2 const& b) {
return {
a.x + b.x,
a.y + b.y
};
}

static ImVec2 operator-(ImVec2 const& a, ImVec2 const& b) {
return {
a.x - b.x,
a.y - b.y
};
}

static ImVec2 operator-(ImVec2 const& a) {
return { -a.x, -a.y };
}

static ImVec2& operator-=(ImVec2& a, ImVec2 const& b) {
a.x -= b.x;
a.y -= b.y;
return a;
}

static ImVec2 operator/(ImVec2 const& a, ImVec2 const& b) {
return {
a.x / b.x,
a.y / b.y
};
}

static ImVec2 operator/(ImVec2 const& a, int b) {
return {
a.x / b,
a.y / b
};
}

static ImVec2 operator/(ImVec2 const& a, float b) {
return {
a.x / b,
a.y / b
};
}

static bool operator!=(ImVec2 const& a, ImVec2 const& b) {
return a.x != b.x || a.y != b.y;
}

static ImVec2 operator*(ImVec2 const& v1, float multi) {
return { v1.x * multi, v1.y * multi };
}

static ImVec2 toVec2(CCPoint const& a) {
const auto size = ImGui::GetMainViewport()->Size;
const auto winSize = CCDirector::get()->getWinSize();
return {
a.x / winSize.width * size.x,
(1.f - a.y / winSize.height) * size.y
};
}

static ImVec2 toVec2(CCSize const& a) {
const auto size = ImGui::GetMainViewport()->Size;
const auto winSize = CCDirector::get()->getWinSize();
return {
a.width / winSize.width * size.x,
-a.height / winSize.height * size.y
};
}

static CCPoint toCocos(const ImVec2& pos) {
const auto winSize = CCDirector::sharedDirector()->getWinSize();
const auto size = ImGui::GetMainViewport()->Size;
return CCPointMake(
pos.x / size.x * winSize.width,
(1.f - pos.y / size.y) * winSize.height
);
};

#include <imgui-cocos.hpp>
#include <Geode/modify/CCDirector.hpp>
class $modify(ImGuiInit, CCDirector) {
$override void runWithScene(CCScene * pScene) {
CCDirector::runWithScene(pScene);
ImGuiCocos::get().setup([] {}).draw([] {});
};
};
13 changes: 10 additions & 3 deletions src/_main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "_main.hpp"

#ifdef GEODE_IS_WINDOWS

#include <Geode/modify/CCNode.hpp>
class $modify(UpdateSceneScaleByScreenView, CCNode) {
$override void visit() {
Expand All @@ -24,13 +22,22 @@ class $modify(FLAlertLayerShowupStartPointExt, CCNode) {
if (auto casted = typeinfo_cast<FLAlertLayer*>(this)) {
if (casted->m_mainLayer) {
if (casted->m_mainLayer->getContentSize().equals(CCDirector::get()->getWinSize())) {
casted->m_mainLayer->setAnchorPoint(getMousePos() / casted->m_mainLayer->getContentSize());
casted->m_mainLayer->setAnchorPoint(toCocos(ImGui::GetMousePos()) / casted->m_mainLayer->getContentSize());
}
};
};
if (auto casted = typeinfo_cast<MenuGameLayer*>(this)) {
if (casted->getContentSize().equals(CCDirector::get()->getWinSize())) {
casted->setAnchorPoint(toCocos(ImGui::GetMousePos()) / casted->getContentSize());
if (SETTING(bool, "Animate Menu Game")) void();
casted->setScale(1.005f);
}
};
}
};

#ifdef GEODE_IS_WINDOWS

#include <Geode/modify/AppDelegate.hpp>
class $modify(WindowNameExt, AppDelegate) {
$override void applicationWillEnterForeground() {
Expand Down
15 changes: 8 additions & 7 deletions src/_main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using namespace geode::prelude;
#include <regex>

#include <_fs.hpp>
#include <_ImGui.hpp>

//lol
#define SETTING(type, key_name) Mod::get()->getSettingValue<type>(key_name)
Expand All @@ -29,6 +30,8 @@ template<typename T, typename U> constexpr size_t OFFSET_BY_MEMBER(U T::* member
return c.get(reinterpret_cast<FriendeeClass__*>(v)); \
}(value)

#define LOG_THIS_FILE $execute { log::debug("LOG_THIS_FILE: \n\n{}\n", fs::path(__FILE__).filename().string()); }

namespace geode::cocos {
inline std::string frameName(CCNode* node) {
if (node == nullptr) return "NIL_NODE";
Expand Down Expand Up @@ -103,14 +106,12 @@ namespace geode::utils {
static std::mt19937 gen(rd());
return select_randomly(start, end, gen);
}
bool rndb(int variants = 2) {
bool rndb(int rarity = 1) {
auto varsVec = std::vector<bool>();
auto tempb = true;
auto tempvariants = variants;
while (tempvariants > 0) {
tempb = !tempb;
tempvariants = tempvariants - 1;
varsVec.push_back(tempb);
varsVec.push_back(true);
while (rarity > 0) {
rarity = rarity - 1;
varsVec.push_back(false);
}
auto rtn = *select_randomly(varsVec.begin(), varsVec.end());
//log::debug("{}({}) = {} of {}", __func__, variants, rtn, varsVec);
Expand Down
2 changes: 1 addition & 1 deletion src/download_mods.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ inline void downloadModsFromList(int id = 0, int attempts = 0, bool failed = 0)
if (web::WebResponse* res = e->getValue()) {
std::string data = res->string().unwrapOr("no res");
if ((res->code() < 399) and (res->code() > 10)) {
res->into(dirs::getModsDir() / filename);
auto save_result = res->into(dirs::getModsDir() / filename);
auto msg = fmt::format("{}\n installed! id: {}", filename, id);
AchievementNotifier::sharedState()->notifyAchievement(
"", msg.data(), "GJ_infoIcon_001.png", 1);
Expand Down
2 changes: 1 addition & 1 deletion src/random_shit/PopupRandomMeme.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class $modify(PopupRandomMeme, CCScene) {
if (string::contains(res->header("content-type").value_or("asd"), "image")) {
//log::info("image");
auto path = getMod()->getTempDir() / ".rand_meme_image";
res->into(path);
auto save_result = res->into(path);
auto sprite = CCSprite::create(path.string().c_str());
CCTextureCache::get()->removeTextureForKey(path.string().c_str());
fs::remove(path, fs::last_err_code);
Expand Down
2 changes: 1 addition & 1 deletion src/random_shit/SoggyPop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class $modify(PopupSoggyCat, CCMenuItem) {
if (SETTING(bool, "soggy cat?")) {
if (string::containsAny(this->getID(), { "play-button", "level-button" })) {
srand(time(0));
if ((rand() % 10 < 3)) {
if (rndb(6)) {
auto pop = createPopup();
pop->show();
PopupSoggyCat::onClick = [this]()
Expand Down
44 changes: 41 additions & 3 deletions src/random_shit/game_ruinify.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,27 @@ class $modify(GJBaseGameLayerExt, GJBaseGameLayer) {
if (p2 == 1) player = m_player1;//a
if (p2 == 2) player = m_player2;//a

if (p0 == GJGameEvent::NormalJump) //jump
if (SETTING(bool, "jelly cube")) player->animatePlatformerJump(0.9f);
if (SETTING(bool, "jelly cube")) {

if (p0 == GJGameEvent::NormalJump) player->animatePlatformerJump(1.0f);

if (p0 == GJGameEvent::PinkOrb) player->animatePlatformerJump(0.950f);
if (p0 == GJGameEvent::YellowOrb) player->animatePlatformerJump(1.0f);
if (p0 == GJGameEvent::RedOrb) player->animatePlatformerJump(1.1f);
if (p0 == GJGameEvent::DropOrb) player->animatePlatformerJump(1.25f);

if (p0 == GJGameEvent::HitHead) player->animatePlatformerJump(0.7f);

}

if (SETTING(bool, "Boost Rotation Thing")) {

if (p0 == GJGameEvent::PinkOrb) player->addChild(createDataNode("rotate_multiplier_while_flying"), 0, -20);
if (p0 == GJGameEvent::YellowOrb) player->addChild(createDataNode("rotate_multiplier_while_flying"), 0, -20);
if (p0 == GJGameEvent::RedOrb) player->addChild(createDataNode("rotate_multiplier_while_flying"), 0, -20);
if (p0 == GJGameEvent::DropOrb) player->addChild(createDataNode("rotate_multiplier_while_flying"), 0, -20);

};

}
};
Expand All @@ -29,20 +48,31 @@ class $modify(GJBaseGameLayerExt, GJBaseGameLayer) {
class $modify(PlayerObjectExt, PlayerObject) {
$override void switchedToMode(GameObjectType p0) {
//log::debug("{}->{}({})", this, __FUNCTION__, (int)p0);

if (p0 == GameObjectType::ShipPortal or p0 == GameObjectType::UfoPortal) {
//if animatePlatformerJump still runnig and sets scale after setup for related mode:
//13 and 14 is action tags i found in animatePlatformerJump
this->m_iconSprite->stopActionByTag(13);
this->m_iconSprite->stopActionByTag(14);
this->m_iconGlow->stopActionByTag(13);
this->m_iconGlow->stopActionByTag(14);
}

return PlayerObject::switchedToMode(p0);
}
$override void bumpPlayer(float p0, int p1, bool p2, GameObject * p3) {

if (SETTING(bool, "jelly cube")) this->animatePlatformerJump(p0);

if (SETTING(bool, "Boost Rotation Thing")) this->addChild(
createDataNode("rotate_multiplier_while_flying"), 0, (p0 + 1.0f) * -10
);

PlayerObject::bumpPlayer(p0, p1, p2, p3);
}
$override void updateRotation(float p0) {
if ((m_isRobot or m_isSpider) and not m_isOnGround) {

if ((m_isRobot or m_isSpider) and !m_isOnGround) {
auto plat = m_isPlatformer;

m_isPlatformer = 0;
Expand All @@ -58,6 +88,7 @@ class $modify(PlayerObjectExt, PlayerObject) {

return;
};

if (SETTING(bool, "Break Player Rotations At Plat")) if (m_isPlatformer) {

m_isPlatformer = 0;
Expand All @@ -66,6 +97,13 @@ class $modify(PlayerObjectExt, PlayerObject) {

return;
};

if (auto rotate_multiplier_while_flying = this->getChildByID("rotate_multiplier_while_flying")) {
if ((m_isUpsideDown ? m_yVelocity >= 0 : m_yVelocity <= 0) or m_isOnGround) rotate_multiplier_while_flying->removeFromParent();
return PlayerObject::updateRotation(p0 * (rotate_multiplier_while_flying->getTag() / 10));
}

PlayerObject::updateRotation(p0);

}
};
2 changes: 1 addition & 1 deletion src/random_shit/menuitems.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class $modify(CCMenuItemDialogExt, CCMenuItem) {
$override void activate() {
if (SETTING(bool, "No Button UDare Dialog")) return CCMenuItem::activate();
srand(time(0));
if ((rand() % 100 > 3) or findDataNode(this, "hasDialog")) {
if (!rndb(12) or findDataNode(this, "hasDialog")) {
return CCMenuItem::activate();
}
if (auto spriteitem = typeinfo_cast<CCMenuItemSpriteExtra*>(this)) {
Expand Down
2 changes: 1 addition & 1 deletion src/random_shit/menulayer_ruinify.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class $modify(MenuGameLayerExt, MenuGameLayer) {
//scale
this->runAction(CCRepeatForever::create(CCSequence::create(
CCEaseSineInOut::create(CCScaleTo::create(10, 1.005)),// o
CCEaseSineInOut::create(CCScaleTo::create(10, 1.000)),// 0
CCEaseSineInOut::create(CCScaleTo::create(10, 1.010)),// 0
nullptr
)));
}
Expand Down
12 changes: 12 additions & 0 deletions src/special_sprites.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
#pragma once
#include <_main.hpp>
//LOG_THIS_FILE;

#include <Geode/modify/CCSprite.hpp>
class $modify(SpecialSprites, CCSprite) {
static void onModify(auto & self) {
auto names = {
"cocos2d::CCSprite::initWithSpriteFrameName",
"cocos2d::CCSprite::initWithFile",
"cocos2d::CCSprite::create",
"cocos2d::CCSprite::createWithSpriteFrameName",
};
for (auto name : names) if (!self.setHookPriorityPost(name, Priority::First)) {
log::error("Failed to set hook priority for {}.", name);
}
}
void pulseOpacitySch(float) {
if (auto sprite = typeinfo_cast<CCSprite*>(this)) {
auto fmod = FMODAudioEngine::sharedEngine();
Expand Down

0 comments on commit 43a111d

Please sign in to comment.