Skip to content

Commit

Permalink
asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Jul 23, 2024
1 parent 89d3082 commit a65834e
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 21 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Fixed Unlock Buttons applying on list pages
- Fixed Confirm Practice Mode not working for exiting practice mode
- Fixed the FPS label text appearing as (a body part on girls that i dont think hjfod will let me say on new index) for the first few seconds
- Fixed No Glow not working
- Ported **All Modes Platformer** on Windows
- Ported **Random Seed**
- Added **No Robot Fire**
Expand All @@ -15,6 +16,7 @@
- Added **No Spider Dash Effect**
- Added **Longer Trail**
- Added **Suicide**
- Added **Best Run Label**

# 1.4.9

Expand Down
1 change: 1 addition & 0 deletions src/Client/ClientSetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ class ClientUtils
replay->modules.push_back(new Module("Message", "status-message", "Write a message of your choice to be shown"));
replay->modules.push_back(new Module("Session Time", "status-session", "Shows the time you've had the game open for in the format <cg>hh::mm::ss</c>"));
replay->modules.push_back(new Module("CPS Counter", "status-cps", "Shows your clicks per second. Tints <cg>Green</c> while you are clicking"));
replay->modules.push_back(new Module("Best Run", "best-run", "Shows your best run"));
//replay->modules.push_back(new StatusMessage());


Expand Down
29 changes: 9 additions & 20 deletions src/Hacks/NoGlow.cpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
#ifndef GEODE_IS_ANDROID32

#include <Geode/Geode.hpp>
#include <Geode/modify/GameObject.hpp>
#include <Geode/modify/GJBaseGameLayer.hpp>
#include <Geode/modify/PlayLayer.hpp>
#include "../Client/Client.h"

using namespace geode::prelude;

Module* noGlow = nullptr;

class $modify(GameObject) {

void commonSetup()
class $modify(PlayLayer)
{
void addObject(GameObject* obj)
{
GameObject::commonSetup();
obj->m_hasNoGlow = true;

if (!noGlow)
noGlow = Client::GetModule("no-glow");

if (PlayLayer::get())
{
if (noGlow->enabled)
m_hasNoGlow = true;
}
PlayLayer::addObject(obj);
}
};
#endif

QOLMOD_MOD_HOOK("no-glow", "PlayLayer::addObject")
};
26 changes: 26 additions & 0 deletions src/Labels/BestRun.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "BestRun.hpp"

void BestPlayLayer::resetLevel()
{
m_fields->toPercent = getCurrentPercent();

auto length = m_fields->toPercent - m_fields->fromPercent;

if (length > m_fields->bestLength)
{
m_fields->bestLength = length;
m_fields->bestFrom = m_fields->fromPercent;
m_fields->bestTo = m_fields->toPercent;
}

PlayLayer::resetLevel();
m_fields->fromPercent = getCurrentPercent();
}

std::string BestPlayLayer::getRunString()
{
if (m_fields->bestLength == 0)
return "Best Run: None";

return fmt::format("Best Run: {} - {}%", as<int>(m_fields->bestFrom), as<int>(m_fields->bestTo));
}
23 changes: 23 additions & 0 deletions src/Labels/BestRun.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

#include <Geode/Geode.hpp>
#include <Geode/modify/PlayLayer.hpp>
#include <Geode/modify/PlayerObject.hpp>
#include "../Client/Client.h"

using namespace geode::prelude;

class $modify (BestPlayLayer, PlayLayer)
{
struct Fields {
float fromPercent;
float toPercent;

float bestFrom;
float bestTo;
float bestLength;
};

void resetLevel();
std::string getRunString();
};
10 changes: 9 additions & 1 deletion src/Labels/Labels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bool StatusNode::init()
bottomRight->setID("bottom-right");
this->addChild(bottomRight);

int count = 9;
int count = 10;

for (size_t i = 0; i < count; i++)
{
Expand Down Expand Up @@ -230,9 +230,15 @@ void StatusNode::update(float dt)

if (!cpsM)
cpsM = Client::GetModule("status-cps");

if (!bestRun)
bestRun = Client::GetModule("best-run");

if (!attPL)
attPL = static_cast<AttemptPlayLayer*>(PlayLayer::get());

if (!bestRunPlayLayer)
bestRunPlayLayer = static_cast<BestPlayLayer*>(PlayLayer::get());

float v = 100 * as<NoclipPlayLayer*>(PlayLayer::get())->getNoclipAccuracy();

Expand Down Expand Up @@ -302,6 +308,7 @@ void StatusNode::update(float dt)
cps.erase(std::remove_if(cps.begin(), cps.end(), [](float i){ return i < 0; }), cps.end());

sLabels[8]->setString((cpsM->options[1]->enabled ? fmt::format("{} / {} CPS", cps.size(), totalClicks) : fmt::format("{} CPS", cps.size(), totalClicks)).c_str());
sLabels[9]->setString(bestRunPlayLayer->getRunString().c_str());

updateVis();
}
Expand Down Expand Up @@ -357,6 +364,7 @@ class $modify (PlayLayer)

auto stn = StatusNode::create();
stn->attPL = static_cast<AttemptPlayLayer*>(PlayLayer::get());
stn->bestRunPlayLayer = as<BestPlayLayer*>(PlayLayer::get());
this->addChild(stn);

return true;
Expand Down
4 changes: 4 additions & 0 deletions src/Labels/Labels.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <Geode/Geode.hpp>
#include <Geode/modify/PlayLayer.hpp>
#include <Geode/modify/PlayerObject.hpp>
#include "BestRun.hpp"
#include "../Client/Client.h"

using namespace geode::prelude;
Expand Down Expand Up @@ -60,6 +61,7 @@ class StatusNode : public CCNode
static inline Module* message = nullptr;
static inline Module* session = nullptr;
static inline Module* cpsM = nullptr;
static inline Module* bestRun = nullptr;

static inline Module* noclip = nullptr;

Expand All @@ -82,6 +84,8 @@ class StatusNode : public CCNode
std::vector<float> cps;
int totalClicks = 0;

BestPlayLayer* bestRunPlayLayer;

std::string formatTime(float time) {
// Convert float time to milliseconds
std::chrono::milliseconds duration(static_cast<long long>(time * 1000));
Expand Down

0 comments on commit a65834e

Please sign in to comment.