Skip to content

Commit 7b87a56

Browse files
committed
fix broken rift
1 parent 7319bd8 commit 7b87a56

15 files changed

Lines changed: 130 additions & 28 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,10 @@ file(GLOB SOURCES
2828
)
2929

3030
add_library(${PROJECT_NAME} SHARED ${SOURCES})
31-
add_link_options(/errorlimit:0)
3231

33-
# Windows specific settings
32+
# enable symbols on windows
3433
if (WIN32)
35-
# Disable annoying warnings
3634
target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS)
37-
38-
# Export all symbols for better debugging
3935
set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
4036
endif()
4137

@@ -50,7 +46,12 @@ include_directories(include src/Client src/Hacks/Speedhack src/Utils src/Notific
5046

5147
# CPMAddPackage("gh:TheSillyDoggo/gd-imgui-cocos#2d33a3d") # should be geode
5248

53-
CPMAddPackage("gh:EclipseMenu/RIFT#v1")
49+
CPMAddPackage(
50+
NAME rift
51+
GIT_REPOSITORY https://git.eclipse.menu/EclipseMenu/RIFT
52+
GIT_TAG v1
53+
)
54+
5455
CPMAddPackage("gh:rapidfuzz/rapidfuzz-cpp#main")
5556
CPMAddPackage("gh:maxnut/GDReplayFormat#72078e5")
5657
CPMAddPackage("gh:ZXShady/enchantum#116de86")

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# 2.8.7
22

3+
- Added **Auto Activate** in range
34
- Added info button for mods that have per player options
45
- Added movable startpos switcher button
56
- Fixed Button Module keybinds repeating
1.47 KB
Loading

src/Client/Module.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ bool Module::getRealEnabled()
4646

4747
if (auto pl = PlayLayer::get(); pl && pl->m_started)
4848
{
49+
if (pl->m_player1->m_isDead || (pl->m_player2 && pl->m_player2->m_isDead))
50+
return userEnabled;
51+
4952
bool inRange;
50-
auto ret = enableRanges.getEnable(pl->getCurrentPercent(), userEnabled, &inRange);
53+
bool ret = enableRanges.getEnable(pl->getCurrentPercent(), userEnabled, &inRange);
5154

5255
if (inRange && ret != userEnabled)
5356
SafeMode::get()->onModuleToggled(this);

src/Client/Ranges.cpp

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,36 @@
33
using namespace geode::prelude;
44
using namespace qolmod;
55

6+
// purpose: merge overlapped ranges
67
void Ranges::sort()
78
{
8-
// TODO: implement
9-
// purpose: stop overlapped ranges
9+
return;
10+
std::unordered_map<double, uint8_t> commandMap = {};
11+
12+
std::function<bool(double)> canReplace = [&](double v)
13+
{
14+
if (commandMap.contains(v) && commandMap[v] == 0)
15+
return true;
16+
17+
return !commandMap.contains(v);
18+
};
19+
20+
for (auto& zone : ranges)
21+
{
22+
if (canReplace(zone.min))
23+
commandMap.emplace(zone.min, zone.enable ? 1 : 2);
24+
25+
if (canReplace(zone.max))
26+
commandMap.emplace(zone.max, 0);
27+
}
28+
29+
std::map<double, uint8_t> sorted(commandMap.begin(), commandMap.end());
30+
log::info("BEGIN");
31+
32+
for (auto& sort : sorted)
33+
{
34+
log::error("1: {}, 2: {}", sort.first, sort.second);
35+
}
1036
}
1137

1238
bool Ranges::getEnable(float value, bool def, bool* inAnyRange)
@@ -27,13 +53,19 @@ bool Ranges::getEnable(float value, bool def, bool* inAnyRange)
2753

2854
void Ranges::addRange(qolmod::Range range)
2955
{
30-
ranges.push_back(range);
56+
if (std::abs<float>(range.min - range.max) <= 0.00005f)
57+
return;
58+
59+
ranges.insert(ranges.begin(), range);
3160
sort();
3261
}
3362

3463
void Ranges::addRange(float min, float max, bool enable)
3564
{
36-
ranges.push_back(qolmod::Range({
65+
if (std::abs<float>(min - max) <= 0.00005f)
66+
return;
67+
68+
ranges.insert(ranges.begin(), qolmod::Range({
3769
.min = min,
3870
.max = max,
3971
.enable = enable
@@ -46,6 +78,11 @@ void Ranges::clear()
4678
ranges.clear();
4779
}
4880

81+
bool Ranges::isEmpty()
82+
{
83+
return ranges.empty();
84+
}
85+
4986
matjson::Value Ranges::save()
5087
{
5188
sort();

src/Client/Ranges.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ namespace qolmod
88
{
99
std::vector<Range> ranges = {};
1010

11-
void sort();
1211
bool getEnable(float value, bool def, bool* inAnyRange = nullptr);
12+
1313
void addRange(float min, float max, bool enable);
1414
void addRange(qolmod::Range range);
15+
16+
void sort();
1517
void clear();
18+
bool isEmpty();
1619

1720
matjson::Value save();
1821
void load(const matjson::Value& value);

src/GUI/ModuleInfoAlert.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <Categories/FavouritesNode.hpp>
66
#include <SetupShortcutUI.hpp>
77
#include <EditKeyConfigUI.hpp>
8+
#include <SetupRangeUI.hpp>
89

910
using namespace geode::prelude;
1011
using namespace qolmod;
@@ -61,10 +62,16 @@ bool ModuleInfoAlert::init(Module* module)
6162
btnKeybind->getNormalImage()->setPosition(btnKeybind->getContentSize() / 2);
6263

6364
auto btnShortcut = CCMenuItemToggler::create(CCSprite::createWithSpriteFrameName("shortcuts.png"_spr), CCSprite::createWithSpriteFrameName("shortcuts.png"_spr), this, menu_selector(ModuleInfoAlert::onChangeShortcut));
64-
btnShortcut->setPositionX(m_mainLayer->getContentWidth() - 25 - 25);
65+
btnShortcut->setPositionX(m_mainLayer->getContentWidth() - 25 - 25 - 25);
66+
67+
auto btnRanges = Button::create(CCSprite::createWithSpriteFrameName("ranges.png"_spr), this, menu_selector(ModuleInfoAlert::onChangeRanges));
68+
btnRanges->setContentSize(btnRanges->getContentSize() * ccp(1, 2));
69+
btnRanges->setPositionX(m_mainLayer->getContentWidth() - 25 - 25);
70+
btnRanges->getNormalImage()->setPosition(btnRanges->getContentSize() / 2);
6571

6672
menu->addChild(btn);
6773
menu->addChild(btnKeybind);
74+
menu->addChild(btnRanges);
6875
menu->addChild(btnShortcut);
6976
m_mainLayer->addChild(menu, 8008569);
7077
return true;
@@ -100,4 +107,9 @@ void ModuleInfoAlert::onChangeShortcut(CCObject* sender)
100107
ui->modID = mod->getID();
101108
ui->setStartConfig(mod->isShortcutEnabled(), mod->getShortcutConfig());
102109
ui->show();
110+
}
111+
112+
void ModuleInfoAlert::onChangeRanges(CCObject* sender)
113+
{
114+
SetupRangeUI::create(mod)->show();
103115
}

src/GUI/ModuleInfoAlert.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace qolmod
1717
void onToggleFavourite(CCObject* sender);
1818
void onChangeKeybind(CCObject* sender);
1919
void onChangeShortcut(CCObject* sender);
20+
void onChangeRanges(CCObject* sender);
2021

2122
bool init(Module* module);
2223
};

src/GUI/OptionsUI.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <EditKeyConfigUI.hpp>
1010
#include <Button.hpp>
1111
#include <PulsingCircle.hpp>
12+
#include <SetupRangeUI.hpp>
1213

1314
using namespace qolmod;
1415

@@ -83,17 +84,24 @@ bool OptionsUI::setup()
8384
favBtn->m_offButton->setOpacity(150);
8485

8586
auto btnKeybind = Button::create(CCSprite::createWithSpriteFrameName("keybinds.png"_spr), this, menu_selector(OptionsUI::onChangeKeybind));
86-
btnKeybind->setContentSize(btnKeybind->getContentSize() * 3);
87+
btnKeybind->setContentSize(btnKeybind->getContentSize() * ccp(1, 2));
8788
btnKeybind->getNormalImage()->setPosition(btnKeybind->getContentSize() / 2);
8889
btnKeybind->setPosition(ccp(m_size.width - 18 * 2, -m_size.height + 18 * 2));
8990

91+
auto btnRanges = Button::create(CCSprite::createWithSpriteFrameName("ranges.png"_spr), this, menu_selector(OptionsUI::onChangeRanges));
92+
btnRanges->setContentSize(btnRanges->getContentSize() * ccp(1, 2));
93+
btnRanges->setPositionX(btnKeybind->getPositionX() - 25);
94+
btnRanges->setPositionY(btnKeybind->getPositionY());
95+
btnRanges->getNormalImage()->setPosition(btnRanges->getContentSize() / 2);
96+
9097
auto btnShortcut = CCMenuItemToggler::create(CCSprite::createWithSpriteFrameName("shortcuts.png"_spr), CCSprite::createWithSpriteFrameName("shortcuts.png"_spr), this, menu_selector(OptionsUI::onChangeShortcut));
9198
btnShortcut->setUserData(module);
9299
btnShortcut->setPosition(ccp(2, -m_size.height + 18 * 2));
93100

94101
menu3->addChild(favBtn);
95102
menu3->addChild(btnKeybind);
96103
menu3->addChild(btnShortcut);
104+
menu3->addChild(btnRanges);
97105

98106
node = CategoryNode::create();
99107
node->setAnchorPoint(ccp(0.5f, 0.5f));
@@ -145,15 +153,8 @@ void OptionsUI::onInfo(CCObject* sender)
145153
ModuleInfoAlert::create(module)->show();
146154
}
147155

148-
#include <SetupRangeUI.hpp>
149-
150156
void OptionsUI::onSeperateOptionsInfo(CCObject* sender)
151157
{
152-
// DO NOT UPLOAD THIS IS FOR TESTING
153-
SetupRangeUI::create(module)->show();
154-
155-
return;
156-
157158
Mod::get()->setSavedValue<bool>("has-shown-seperate-info", true);
158159

159160
if (pulsingCircle)
@@ -197,6 +198,11 @@ void OptionsUI::onChangeKeybind(CCObject* sender)
197198
ui->show();
198199
}
199200

201+
void OptionsUI::onChangeRanges(CCObject* sender)
202+
{
203+
SetupRangeUI::create(module)->show();
204+
}
205+
200206
OptionsUI::~OptionsUI()
201207
{
202208
if (instance == this)

src/GUI/OptionsUI.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class OptionsUI : public PopupBase
2929
void onToggleFavourite(CCObject* sender);
3030
void onChangeShortcut(CCObject* sender);
3131
void onChangeKeybind(CCObject* sender);
32+
void onChangeRanges(CCObject* sender);
3233

3334
CCSize calculateSize();
3435
virtual bool setup();

0 commit comments

Comments
 (0)