Skip to content

Commit 42e6c37

Browse files
committed
clean a bit
1 parent f226df4 commit 42e6c37

4 files changed

Lines changed: 9 additions & 12 deletions

File tree

src/hooks/PlayLayer/ForceLevels.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ static auto const oCongreg = Option::create(THIS_ID_CONGREG)
2626
->setOnline(true)
2727
->autoRegister();
2828

29-
static bool trySwitchToLevel(PlayLayer* pl, PlayerObject* player, GameObject* killer, std::shared_ptr<jumpscares::DownloadDelegate> delegate, int chance, int rng, bool dontCreateObjects, bool useReplay) {
29+
static bool trySwitchToLevel(PlayLayer* pl, std::shared_ptr<jumpscares::DownloadDelegate> delegate, int chance, int rng, bool dontCreateObjects, bool useReplay) {
3030
if (rng > chance) {
3131
log::debug("{} jumpscare not triggered {}", delegate->getLevelName(), chance);
3232
return false;
3333
};
3434

35-
jumpscares::switchToLevel(pl, delegate, player, killer, dontCreateObjects, useReplay);
35+
jumpscares::switchToLevel(pl, delegate, dontCreateObjects, useReplay);
3636

3737
return true;
3838
};
@@ -54,7 +54,7 @@ class $modify(GriefPlayLayer, PlayLayer) {
5454
if (p1 == m_anticheatSpike && !p0->m_isDead) return;
5555

5656
int rng = randng::fast();
57-
trySwitchToLevel(this, p0, p1, jumpscares::get::grief(), f->chance, rng, f->dontCreateObjects, m_useReplay);
57+
trySwitchToLevel(this, jumpscares::get::grief(), f->chance, rng, f->dontCreateObjects, m_useReplay);
5858
};
5959
};
6060

@@ -75,6 +75,6 @@ class $modify(CongregationPlayLayer, PlayLayer) {
7575
if (p1 == m_anticheatSpike && !p0->m_isDead) return;
7676

7777
int rng = randng::fast();
78-
trySwitchToLevel(this, p0, p1, jumpscares::get::congregation(), f->chance, rng, f->dontCreateObjects, m_useReplay);
78+
trySwitchToLevel(this, jumpscares::get::congregation(), f->chance, rng, f->dontCreateObjects, m_useReplay);
7979
};
8080
};

src/util/Jumpscares.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ namespace horrible {
5454
std::shared_ptr<DownloadDelegate> congregation();
5555
};
5656

57-
void switchToLevel(PlayLayer* pl, std::shared_ptr<DownloadDelegate> delegate, PlayerObject* player, GameObject* killer, bool dontCreateObjects, bool useReplay);
57+
void switchToLevel(PlayLayer* pl, std::shared_ptr<DownloadDelegate> delegate, bool dontCreateObjects, bool useReplay);
5858

5959
void downloadLevelAsync(std::shared_ptr<DownloadDelegate> delegate);
6060

src/util/src/Jumpscares.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ GJSearchObject* jumpscares::createLevelSearchObject(int levelID) {
134134
return GJSearchObject::create(SearchType::Type19, numToString(levelID));
135135
};
136136

137-
void jumpscares::switchToLevel(PlayLayer* pl, std::shared_ptr<DownloadDelegate> delegate, PlayerObject* player, GameObject* killer, bool dontCreateObjects, bool useReplay) {
137+
void jumpscares::switchToLevel(PlayLayer* pl, std::shared_ptr<DownloadDelegate> delegate, bool dontCreateObjects, bool useReplay) {
138138
if (!delegate) {
139139
delegate = JumpscareDelegateManager::get()->getDownloadDelegate().lock();
140140

@@ -154,9 +154,6 @@ void jumpscares::switchToLevel(PlayLayer* pl, std::shared_ptr<DownloadDelegate>
154154

155155
log::debug("Destroying player and exiting current level for {}", delegate->getLevelName());
156156

157-
pl->destroyPlayer(player, killer);
158-
pl->onExit();
159-
160157
if (!targetLevel->m_levelNotDownloaded) {
161158
log::warn("Switching to {} level ({})", delegate->getLevelName(), delegate->getLevelID());
162159

src/util/ui/src/RandomAd.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ bool RandomAd::init() {
5252
"Play!",
5353
"bigFont.fnt",
5454
themes::getButtonSquareSprite(theme)),
55-
[playBtnLoading](Button* sender) {
55+
[loading = WeakRef(playBtnLoading)](Button* sender) {
5656
sender->setVisible(false);
57-
playBtnLoading->setVisible(true);
57+
if (auto load = loading.lock()) load.take()->setVisible(true);
5858

5959
if (auto pl = PlayLayer::get()) {
6060
log::info("Switching from ad to Congregation jumpscare");
61-
jumpscares::switchToLevel(pl, jumpscares::get::congregation(), nullptr, nullptr, false, false);
61+
jumpscares::switchToLevel(pl, jumpscares::get::congregation(), false, false);
6262
} else {
6363
log::error("Player not in a level");
6464
};

0 commit comments

Comments
 (0)