Skip to content

Commit 97a7972

Browse files
committed
1.1.8
1 parent 5366cc5 commit 97a7972

File tree

10 files changed

+150
-107
lines changed

10 files changed

+150
-107
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.1.7)
7+
project(DeltaruneTextboxes VERSION 1.1.8)
88

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

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
This Geometry Dash mod turns every Popup into a Deltarune styled Textbox!
33

44
You can advance the text by pressing Z, Enter or by clicking/tapping on the screen!
5-
You can skip the text by pressing X or clicking/tapping on the screen!
5+
You can skip the text by pressing X, Space or clicking/tapping on the screen!
6+
7+
Keybinds changeable if you use the Custom Keybinds mod!
68

79
Apply using the Geode mod loader!
810

about.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ You can <cj>advance</c> the text by pressing <cy>Z</c>, <cy>Enter</c> or by </cy
66

77
You can <cj>skip</c> the text by pressing <cy>X</c>, <cy>Space</c> or by <cy>tapping</c>/<cy>clicking</c> while the text rolls out!
88

9+
If you're <c>able</c> to use the <cj>Custom Keybinds</c> mod, then you can <cj>reconfigure</c> these buttons!
10+
911
![[This should be a screenshot]](timestepyt.deltarune_textboxes/screenshot.jpg&scale:0.5)
1012

1113
If you want to suggest a feature, create an issue on github or ping me on discord (@timestepyt)

changelog.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
### v1.1.8
2+
- Text rolling pause is no longer limited to frame rate!
3+
- Fixed title positioning for titles that are multiple lines long
4+
- Fixed a crash for special type of DialogLayer that I thought I have already fixed
5+
- Now removing empty lines that are on the top of the textbox when opened
6+
17
### v1.1.7
2-
- removed custom keybinds support for Android 32bit since it crashes the game
8+
- Removed custom keybinds support for Android 32bit since it crashes the game
39

410
### v1.1.6
5-
- very quick crashfix
11+
- Very quick crashfix
612

713
### v1.1.5 (never released)
814
- Custom Keybinds support for Windows and Android (mac doesn't have it)
@@ -18,23 +24,23 @@
1824

1925
### v1.1.3 (never released)
2026
- Finally fixed choices not showing up (thanks prevter for having this bug and helping me fix it)
21-
- Mod comments support (kinda)
27+
- Mod comments supported (kinda)
2228

2329
### v1.1.2
24-
- Fix star not fully disappearing
25-
- Prevent the first line from being empty
30+
- Fixed star not fully disappearing
31+
- Prevented the first line from being empty
2632
- Animated corner pixels :D
2733

2834
### v1.1.1 (never released)
2935
- Crashfix
3036

3137
### v1.1.0 (never released)
32-
- Fix text being cut off on wider screens while having restrict width on
33-
- Fix weirdness with Prism Menu
34-
- Fix weirdness with Death Tracker
35-
- Fix buttons not showing up (maybe?)
36-
- Add drop shadow to text
37-
- Add star to non dialog as well
38+
- Fixed text being cut off on wider screens while having restrict width on
39+
- Fixed weirdness with Prism Menu
40+
- Fixed weirdness with Death Tracker
41+
- Fixed buttons not showing up (maybe?)
42+
- Added drop shadow to text
43+
- Added star to non dialog as well
3844

3945
### v1.0.0
4046
- Different character text sounds and fonts

mod.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"geode": "3.6.1",
2+
"geode": "3.7.1",
33
"gd": {
44
"win": "2.206",
55
"android": "2.206",
@@ -8,7 +8,7 @@
88
},
99
"id": "timestepyt.deltarune_textboxes",
1010
"name": "Deltarune Textboxes",
11-
"version": "v1.1.7",
11+
"version": "v1.1.8",
1212
"developer": "TimeStepYT",
1313
"description": "Makes FLAlertLayers look like textboxes from Deltarune",
1414
"repository": "https://github.com/Reinmmar/DeltaruneTextboxes",
@@ -121,7 +121,11 @@
121121
"type": "float",
122122
"min": 0,
123123
"max": 5,
124-
"default": 1,
124+
"default": 0.8,
125+
"control": {
126+
"arrow-step": 0.1,
127+
"big-arrow-step": 1
128+
},
125129
"description": "How many <cy>30th</c>s of a second it should <cj>pause</c> between characters for the <cg>rolling effect</c>"
126130
},
127131
"textSound": {

src/CCKeyboardDispatcher.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ class $modify(MyHookLol, CCKeyboardDispatcher) {
5050
blockKeys = false;
5151
}
5252
// else if (down && key == KEY_G) {
53-
// CCArray* objs = new CCArray();
54-
// objs->addObject(DialogObject::create("Scratch", "fart\nUh oh", 25, 1, false, ccc3(0, 255, 255)));
55-
// objs->addObject(DialogObject::create("The funny monkley", "stinky!", 26, 1, false, ccc3(0, 155, 155)));
56-
// objs->addObject(DialogObject::create("Glungus", "poopy!", 28, 1, false, ccc3(0, 155, 155)));
57-
// objs->addObject(DialogObject::create("Ned", "funny poopy!", 6, 1, false, ccc3(0, 155, 155)));
58-
// objs->addObject(DialogObject::create("Smongus", "Sorry you had to... read this.", 21, 1, false, ccc3(0, 155, 155)));
59-
// DialogLayer::createWithObjects(objs, 2);
53+
// CCArray* objs = new CCArray();
54+
// objs->addObject(DialogObject::create("Scratch", "fart\nUh oh", 25, 1, false, ccc3(0, 255, 255)));
55+
// objs->addObject(DialogObject::create("The funny\nmonkley", "stinky!", 26, 1, false, ccc3(0, 155, 155)));
56+
// objs->addObject(DialogObject::create("Glungus", "poopy!", 28, 1, false, ccc3(0, 155, 155)));
57+
// objs->addObject(DialogObject::create("Ned", "funny poopy!", 6, 1, false, ccc3(0, 155, 155)));
58+
// objs->addObject(DialogObject::create("Smongus", "Sorry you had to... read this.", 21, 1, false, ccc3(0, 155, 155)));
59+
// auto layer = DialogLayer::createWithObjects(objs, 2);
6060
// }
6161
return CCKeyboardDispatcher::dispatchKeyboardMSG(key, down, idk);
6262
}

src/DialogLayer.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,21 @@ bool DeltaruneDialogLayer::init(DialogObject* dialogObject, CCArray* objects, in
4242
}
4343
}
4444
m_fields->alert = unmodifiedAlert;
45-
4645
alert->m_fields->dialog = true;
4746
alert->m_fields->dialogLayer = this;
4847

49-
Loader::get()->queueInMainThread([=]{
48+
Loader::get()->queueInMainThread([=] {
5049
this->setVisible(false);
51-
});
50+
if (!this->getParent()) {
51+
alert->addChild(this);
52+
}
53+
});
5254

5355
alert->show();
5456
return true;
5557
}
5658
void DeltaruneDialogLayer::displayNextObject() {
59+
DialogLayer::displayNextObject();
5760
this->setVisible(false);
5861
}
5962
void DeltaruneDialogLayer::displayDialogObject(DialogObject* obj) {
@@ -63,5 +66,4 @@ void DeltaruneDialogLayer::displayDialogObject(DialogObject* obj) {
6366
bool DeltaruneDialogLayer::ccTouchBegan(CCTouch* touch, CCEvent* event) {
6467
return false;
6568
}
66-
void DeltaruneDialogLayer::keyDown(enumKeyCodes key) {
67-
}
69+
void DeltaruneDialogLayer::keyDown(enumKeyCodes key) {}

src/FLAlertLayer.cpp

Lines changed: 95 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "include.h"
21
#include "FLAlertLayer.h"
2+
#include "DialogLayer.h"
33

44
bool blockKeys = false;
55

@@ -131,7 +131,6 @@ void DeltaruneAlertLayer::onBtn2(CCObject* sender) {
131131
else if (btnSelected == 1) FLAlertLayer::onBtn1(sender);
132132
}
133133
void DeltaruneAlertLayer::onBtn1(CCObject* sender) {
134-
bool dialog = m_fields->dialog;
135134
if (m_fields->incompatible) {
136135
FLAlertLayer::onBtn1(sender);
137136
return;
@@ -374,6 +373,27 @@ void DeltaruneAlertLayer::skipText() {
374373
if (doneRolling) showButtons();
375374
}
376375

376+
int DeltaruneAlertLayer::emptyLinesAmount(int offset) {
377+
auto& textArea = m_fields->textArea;
378+
auto& linesProgressed = m_fields->linesProgressed;
379+
auto fontNode = (CCNode*) textArea->getChildren()->objectAtIndex(0);
380+
int lines = 0;
381+
while (true) {
382+
auto topLine = (CCLabelBMFont*) fontNode->getChildren()->objectAtIndex(linesProgressed + lines + offset);
383+
if (!topLine) break;
384+
std::string topLineString = topLine->getString();
385+
std::string noSpaceTopLineString = "";
386+
std::for_each(topLineString.begin(), topLineString.end(), [&noSpaceTopLineString](char c) {
387+
if (c != ' ') noSpaceTopLineString += c;
388+
});
389+
if (noSpaceTopLineString != "") break;
390+
lines++;
391+
m_mainLayer->getChildByID("star"_spr)->setVisible(true);
392+
if (!Mod::get()->getSettingValue<bool>("noShadow")) m_mainLayer->getChildByID("starShadow"_spr)->setVisible(true);
393+
}
394+
return lines;
395+
}
396+
377397
void DeltaruneAlertLayer::progressText() {
378398
if (!m_mainLayer) return;
379399
if (!m_buttonMenu) return;
@@ -393,11 +413,12 @@ void DeltaruneAlertLayer::progressText() {
393413

394414
if (getLinesLeft() <= 3) {
395415
if (!m_button2) {
396-
bool dialog = m_fields->dialog;
397-
DialogLayer* dialogLayer = m_fields->dialogLayer;
416+
auto dialogLayer = m_fields->dialogLayer;
398417
done = true;
418+
if (m_fields->dialog && dialogLayer) {
419+
dialogLayer->onClose();
420+
}
399421
FLAlertLayer::onBtn1(btn1);
400-
if (dialog && dialogLayer) dialogLayer->onClose();
401422
return;
402423
}
403424
else if (btnSelected != 0) {
@@ -426,26 +447,12 @@ void DeltaruneAlertLayer::progressText() {
426447
else if (getLinesLeft() == 3)
427448
offset = 1;
428449

429-
auto fontNode = (CCNode*) textArea->getChildren()->objectAtIndex(0);
430-
bool emptyLinesRemoved = false;
431-
while (true) {
432-
auto topLine = (CCLabelBMFont*) fontNode->getChildren()->objectAtIndex(linesProgressed + offset);
433-
if (!topLine) break;
434-
std::string topLineString = topLine->getString();
435-
std::string noSpaceTopLineString = "";
436-
std::for_each(topLineString.begin(), topLineString.end(), [&noSpaceTopLineString](char c) {
437-
if (c != ' ') noSpaceTopLineString += c;
438-
});
439-
if (noSpaceTopLineString != "") break;
440-
offset++;
441-
m_mainLayer->getChildByID("star"_spr)->setVisible(true);
442-
if (!noShadow) m_mainLayer->getChildByID("starShadow"_spr)->setVisible(true);
443-
emptyLinesRemoved = true;
444-
}
450+
int emptyLines = emptyLinesAmount(offset);
451+
offset += emptyLines;
445452

446453
auto& characters = m_fields->characterSpriteNames;
447454
int& dialogCount = m_fields->dialogCount;
448-
if (emptyLinesRemoved && characters.size() > 1) {
455+
if (characters.size() > 1) {
449456
dialogCount++;
450457
auto& spriteName = characters[dialogCount];
451458
auto prevChar = (CCSpriteGrayscale*) m_mainLayer->getChildByID("character-sprite"_spr);
@@ -483,70 +490,84 @@ void DeltaruneAlertLayer::rollText(float dt) {
483490
bool& playedSound = m_fields->playedSound;
484491
bool& doneRolling = m_fields->doneRolling;
485492
bool& rolledPage = m_fields->rolledPage;
493+
float& lostTime = m_fields->lostTime;
494+
float const pause = Mod::get()->getSettingValue<double>("textRollingPause") / 30;
486495

487-
if (waitQueue != 0) {
488-
waitQueue--;
489-
playedSound = false;
490-
return;
491-
}
492-
CCArrayExt<TextArea*> textAreas = m_fields->textAreaClippingNode->getChildren();
493-
if (rollingLine == 3) {
494-
unschedule(schedule_selector(DeltaruneAlertLayer::rollText));
495-
rolledPage = true;
496-
return;
497-
}
498-
else rolledPage = false;
496+
if (dt - pause > pause)
497+
lostTime += dt - pause;
499498

500-
bool newLine = false;
501499
bool playSound = true;
502-
for (auto textArea : textAreas) {
503-
CCArrayExt<CCLabelBMFont*> lines = static_cast<CCNode*>(textArea->getChildren()->objectAtIndex(0))->getChildren();
504-
int i = linesProgressed + rollingLine;
505-
if (i < lines.size() && i < linesProgressed + 3) {
506-
auto line = lines[i];
507-
CCArrayExt<CCNode*> letters = line->getChildren();
508-
auto letter = letters[characterCount];
509-
if (letter->isVisible()) {
500+
501+
for (bool firstRun = true; lostTime >= pause || firstRun;) {
502+
bool newLine = false;
503+
firstRun = false;
504+
if (waitQueue != 0) {
505+
waitQueue--;
506+
playedSound = false;
507+
if (lostTime >= pause && !firstRun) {
508+
lostTime -= pause;
509+
}
510+
continue;
511+
}
512+
CCArrayExt<TextArea*> textAreas = m_fields->textAreaClippingNode->getChildren();
513+
if (rollingLine == 3) {
514+
unschedule(schedule_selector(DeltaruneAlertLayer::rollText));
515+
rolledPage = true;
516+
return;
517+
}
518+
else rolledPage = false;
519+
520+
for (auto textArea : textAreas) {
521+
CCArrayExt<CCLabelBMFont*> lines = static_cast<CCNode*>(textArea->getChildren()->objectAtIndex(0))->getChildren();
522+
int currentLine = linesProgressed + rollingLine;
523+
if (currentLine < lines.size() && currentLine < linesProgressed + 3) {
524+
auto line = lines[currentLine];
525+
CCArrayExt<CCNode*> letters = line->getChildren();
526+
auto letter = letters[characterCount];
527+
if (letter->isVisible()) {
528+
unschedule(schedule_selector(DeltaruneAlertLayer::rollText));
529+
doneRolling = true;
530+
rolledPage = true;
531+
showButtons();
532+
return;
533+
}
534+
letter->setVisible(true);
535+
switch (line->getString()[characterCount]) {
536+
case ' ':
537+
playSound = false;
538+
break;
539+
case '.': [[fallthrough]];
540+
case ',': [[fallthrough]];
541+
case ':': [[fallthrough]];
542+
case ';': [[fallthrough]];
543+
case '?': [[fallthrough]];
544+
case '!':
545+
waitQueue = 2;
546+
break;
547+
default:
548+
break;
549+
}
550+
if (characterCount == line->getChildrenCount() - 1) {
551+
newLine = true;
552+
}
553+
}
554+
else {
510555
unschedule(schedule_selector(DeltaruneAlertLayer::rollText));
511556
doneRolling = true;
512557
rolledPage = true;
513558
showButtons();
514559
return;
515560
}
516-
letter->setVisible(true);
517-
switch (line->getString()[characterCount]) {
518-
case ' ':
519-
playSound = false;
520-
break;
521-
case '.': [[fallthrough]];
522-
case ',': [[fallthrough]];
523-
case ':': [[fallthrough]];
524-
case ';': [[fallthrough]];
525-
case '?': [[fallthrough]];
526-
case '!':
527-
waitQueue = 2;
528-
break;
529-
default:
530-
break;
531-
}
532-
if (characterCount == line->getChildrenCount() - 1) {
533-
newLine = true;
534-
}
535561
}
536-
else {
537-
unschedule(schedule_selector(DeltaruneAlertLayer::rollText));
538-
doneRolling = true;
539-
rolledPage = true;
540-
showButtons();
541-
return;
562+
characterCount++;
563+
if (newLine) {
564+
characterCount = 0;
565+
rollingLine++;
566+
}
567+
if (lostTime >= pause && !firstRun) {
568+
lostTime -= pause;
542569
}
543570
}
544-
characterCount++;
545-
if (newLine) {
546-
characterCount = 0;
547-
rollingLine++;
548-
}
549-
550571
auto nameToFile = m_fields->nameToFile;
551572
std::string const textSound = m_fields->textSound;
552573
std::string const resFolder = Mod::get()->getResourcesDir().string();

0 commit comments

Comments
 (0)