Skip to content

Commit 195e34f

Browse files
author
TheSillyDoggo
committed
im so fucking bad at literally everything i fucking hate myself
1 parent f6fae21 commit 195e34f

File tree

6 files changed

+36
-1
lines changed

6 files changed

+36
-1
lines changed

resources/label-help.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Variables
22
Variables are special values that you can put in the format of your label.
3+
4+
Variables can be used by typing {}, and putting the variable name inbetween the two {}.
5+
like this: "im playing {level_name} by {level_creator}!!!"
6+
which would show as: "im playing Bloodbath by Riot!!!"
7+
38
These are all the variables provided by QOLMod and what they do:
49

510
**isLevel** | If you are in the level (not the editor)
@@ -39,4 +44,5 @@ These are all the variables provided by QOLMod and what they do:
3944

4045
**bestRun_from** | The percentage that your best run was from
4146
**bestRun_to** | The percentage that your best run was to
42-
**percentage** | Current percentage in the level
47+
**percentage** | Current percentage in the level
48+
**last_percentage** | The last percentage you died at

src/Labels/LabelHooks.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,12 @@ void LabelBaseGameLayer::handleButton(bool down, int button, bool isPlayer1)
5050
else
5151
ll->triggerEvent(down ? LabelEventType::P2ClickStarted : LabelEventType::P2ClickEnded);
5252
}
53+
}
54+
55+
void LabelPlayLayer::destroyPlayer(PlayerObject* p0, GameObject* p1)
56+
{
57+
if (p1 != m_unk3688)
58+
as<LabelsUILayer*>(m_uiLayer)->m_fields->labelLayer->setLastPercentage(getCurrentPercent());
59+
60+
PlayLayer::destroyPlayer(p0, p1);
5361
}

src/Labels/LabelHooks.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <Geode/Geode.hpp>
44
#include <Geode/modify/UILayer.hpp>
55
#include <Geode/modify/GJBaseGameLayer.hpp>
6+
#include <Geode/modify/PlayLayer.hpp>
67
#include "LabelLayer.hpp"
78

89
using namespace geode::prelude;
@@ -24,4 +25,9 @@ class $modify (LabelBaseGameLayer, GJBaseGameLayer)
2425
void resetLevelVariables();
2526

2627
void handleButton(bool down, int button, bool isPlayer1);
28+
};
29+
30+
class $modify (LabelPlayLayer, PlayLayer)
31+
{
32+
virtual void destroyPlayer(PlayerObject* p0, GameObject* p1);
2733
};

src/Labels/LabelLayer.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,16 @@ int LabelLayer::getTotalClicks()
221221
return clicks1 + clicks2;
222222
}
223223

224+
void LabelLayer::setLastPercentage(float v)
225+
{
226+
lastPercentage = v;
227+
}
228+
229+
float LabelLayer::getLastPercentage()
230+
{
231+
return lastPercentage;
232+
}
233+
224234
CCNode* LabelLayer::nodeForAnchor(LabelAnchor anchor)
225235
{
226236
return nodes.at(anchor);

src/Labels/LabelLayer.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class LabelLayer : public CCLayer
2727

2828
int clicks1;
2929
int clicks2;
30+
float lastPercentage;
3031

3132
public:
3233
UILayer* uiLayer;
@@ -35,6 +36,9 @@ class LabelLayer : public CCLayer
3536

3637
void triggerEvent(LabelEventType type);
3738

39+
void setLastPercentage(float v);
40+
float getLastPercentage();
41+
3842
void incrementAttempts();
3943
int getAttempts();
4044

src/Labels/LabelNode.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ void LabelNode::update(float dt)
118118
script->setVariable("bestRun_from", rift::Value::floating(as<BestPlayLayer*>(PlayLayer::get())->m_fields->bestFrom));
119119
script->setVariable("bestRun_to", rift::Value::floating(as<BestPlayLayer*>(PlayLayer::get())->m_fields->bestTo));
120120
script->setVariable("percentage", rift::Value::floating(PlayLayer::get()->getCurrentPercent()));
121+
script->setVariable("last_percentage", rift::Value::floating(LabelLayer::get()->getLastPercentage()));
121122
}
122123

123124
auto res2 = script->run();

0 commit comments

Comments
 (0)