Skip to content

Commit 67686cf

Browse files
committed
april is coming up
1 parent 59d142b commit 67686cf

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
44
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
55
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
66

7-
project(DeltaruneTextboxes VERSION 1.3.0)
7+
project(DeltaruneTextboxes VERSION 1.4.1)
88

99
add_library(${PROJECT_NAME} SHARED
1010
src/FLAlertLayer.cpp

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### v1.4.1
2+
- Added a really cool guy (He's off-screen you can't see him)
3+
14
### v1.4.0
25
- Made purchase popups look Deltarune as well!
36
- Made the character image spot able to hold multiple nodes inside

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"id": "timestepyt.deltarune_textboxes",
1010
"name": "Deltarune Textboxes",
11-
"version": "v1.4.0",
11+
"version": "v1.4.1",
1212
"developer": "TimeStepYT",
1313
"description": "Makes Popups look like Deltarune",
1414
"links": {

src/FLAlertLayer.cpp

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44

55
bool blockKeys = false;
66

7+
static std::mt19937 mt{ static_cast<std::mt19937::result_type>(
8+
std::chrono::steady_clock::now().time_since_epoch().count()
9+
) };
10+
711
float randomNumberInAGivenRangeThatGetsAddedOrRemovedFromADifferentNumber(float range) { // thanks cvolton for this amazing name
8-
return static_cast<float>(rand() % static_cast<int>(range * 100 + 1)) / 100.f - (range / 2.f);
12+
return static_cast<float>(mt() % static_cast<int>(range * 100 + 1)) / 100.f - (range / 2.f);
913
}
1014

1115
void DeltaruneAlertLayer::initMaps() {
@@ -491,6 +495,23 @@ void DeltaruneAlertLayer::progressText() {
491495
schedule(schedule_selector(DeltaruneAlertLayer::rollText), pause / 30);
492496
}
493497

498+
void DeltaruneAlertLayer::handleAprilFools() {
499+
auto& nameToFile = m_fields->nameToFile;
500+
501+
time_t t = time(nullptr);
502+
struct tm now;
503+
504+
if (localtime_s(&now, &t) != 0)
505+
return;
506+
507+
if (now.tm_mon != 3 || now.tm_mday != 1)
508+
return;
509+
510+
auto randomSound = nameToFile.begin();
511+
std::advance(randomSound, mt() % nameToFile.size());
512+
m_fields->textSound = randomSound->first;
513+
}
514+
494515
void DeltaruneAlertLayer::rollText(float dt) {
495516
int& waitQueue = m_fields->waitQueue;
496517
int& linesProgressed = m_fields->linesProgressed;
@@ -578,22 +599,25 @@ void DeltaruneAlertLayer::rollText(float dt) {
578599
}
579600
}
580601
auto& nameToFile = m_fields->nameToFile;
581-
auto const textSound = m_fields->textSound;
602+
auto& textSound = m_fields->textSound;
582603
auto const resFolder = Mod::get()->getResourcesDir();
583-
auto path = resFolder / fmt::format("{}.wav", nameToFile[textSound]);
584604

585605
if (nameToFile.find(textSound) == nameToFile.end()) return;
586606

587607
if (!playSound || playedSound) {
588608
playedSound = false;
589609
return;
590610
}
611+
612+
handleAprilFools();
613+
591614
float pitch = 1.f;
592615
playedSound = true;
593616

594617
auto& system = m_fields->system;
595618
auto& channel = m_fields->channel;
596619
auto& sound = m_fields->sound;
620+
auto path = resFolder / fmt::format("{}.wav", nameToFile[textSound]);
597621

598622
if (textSound == "Queen")
599623
pitch = 1 + randomNumberInAGivenRangeThatGetsAddedOrRemovedFromADifferentNumber(0.2f);

src/FLAlertLayer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class $modify(DeltaruneAlertLayer, FLAlertLayer) {
6464
void skipText();
6565
int emptyLinesAmount(int = 0);
6666
void createImageNode();
67+
void handleAprilFools();
6768
void progressText();
6869
// I can't check for enter key so I guess I have to hook the buttons
6970
void onBtn2(CCObject*);

0 commit comments

Comments
 (0)