@@ -126,33 +126,32 @@ void DeltaruneAlertLayer::changeTitle() {
126126void DeltaruneAlertLayer::changeText () {
127127 auto & textArea = m_fields->textArea ;
128128 if (!textArea) return ;
129- textArea->removeFromParent ();
130-
129+
131130 auto & sound = m_fields->textSound ;
132131 auto & size = m_fields->textSize ;
133132 auto & nameToSound = m_fields->nameToSound ;
134133 bool & noShadow = m_fields->noShadow ;
135-
136-
134+
135+
137136 noShadow = Mod::get ()->getSettingValue <bool >(" noShadow" ) || sound == " Sans" || sound == " Papyrus" ;
138-
137+
139138 CCLabelBMFont* star = CCLabelBMFont::create (" *" , " Determination.fnt" _spr);
140139 CCLabelBMFont* starShadow = nullptr ;
141140 if (!noShadow) starShadow = CCLabelBMFont::create (" *" , " Determination.fnt" _spr);
142-
141+
143142 auto str = m_fields->text ;
144143 auto screenSize = m_fields->screenSize ;
145144 auto & bg = m_fields->bg ;
146145 auto titleString = m_fields->title ->getString ();
147-
146+
148147 int xOffset = star->getContentWidth ();
149-
148+
150149 if (m_fields->dialog ) {
151150 if (nameToSound.find (titleString) != nameToSound.end ())
152- sound = nameToSound[titleString];
151+ sound = nameToSound[titleString];
153152 else
154- sound = " Default" ;
155-
153+ sound = " Default" ;
154+
156155 xOffset = m_fields->imageNode ->getContentWidth () + star->getContentWidth ();
157156 }
158157 star->setPositionX (bg->getPositionX () - screenSize / 2 + xOffset - star->getContentWidth () + 27 );
@@ -183,13 +182,13 @@ void DeltaruneAlertLayer::changeText() {
183182 size,
184183 false
185184 );
186-
185+
187186 newDesc->setContentWidth (creatingWidth);
188187 newDesc->setAnchorPoint (CCPoint{ 0 , 1 });
189188 newDesc->setPositionY (110 );
190189 newDesc->setZOrder (textArea->getZOrder ());
191190 newDesc->setID (" content-text-area" );
192-
191+
193192 TextArea* newDescGrad = nullptr ;
194193 TextArea* newDescShad = nullptr ;
195194 if (!Mod::get ()->getSettingValue <bool >(" noGradientOverlay" ) && sound != " Sans" && sound != " Papyrus" ) {
@@ -207,7 +206,7 @@ void DeltaruneAlertLayer::changeText() {
207206 newDescGrad->setPositionY (110 );
208207 newDescGrad->setZOrder (textArea->getZOrder () + 1 );
209208 newDescGrad->setID (" gradient-overlay" _spr);
210-
209+
211210 CCArrayExt<CCLabelBMFont*> linesGrad = newDescGrad->getChildByType <MultilineBitmapFont>(0 )->getChildren ();
212211 for (auto line : linesGrad) {
213212 CCArrayExt<CCSprite*> letters = line->getChildren ();
@@ -233,7 +232,7 @@ void DeltaruneAlertLayer::changeText() {
233232 newDescShad->setPositionX (newDescShad->getPositionX () + 1 );
234233 newDescShad->setZOrder (textArea->getZOrder () - 1 );
235234 newDescShad->setID (" shadow" _spr);
236-
235+
237236 CCArrayExt<CCLabelBMFont*> linesShad = newDescShad->getChildByType <MultilineBitmapFont>(0 )->getChildren ();
238237 int i = 0 ;
239238 for (auto line : linesShad) {
@@ -244,7 +243,7 @@ void DeltaruneAlertLayer::changeText() {
244243 auto origLine = origLinesParent->getChildByType <CCLabelBMFont>(i);
245244 auto origChar = origLine->getChildByType <CCSprite>(j);
246245 auto color = origChar->getColor ();
247-
246+
248247 if (color == ccColor3B{ 255 ,255 ,255 }) letter->setColor ({ 15 , 15 , 127 });
249248 else if (color == ccColor3B{ 255 , 0 , 255 }) letter->setColor ({ 76 , 0 , 76 });
250249 else if (color == ccColor3B{ 255 , 90 , 90 }) letter->setColor ({ 76 , 0 , 0 });
@@ -258,21 +257,22 @@ void DeltaruneAlertLayer::changeText() {
258257 uint8_t blue = color.b / 2 ;
259258 letter->setColor (ccColor3B{ red, green, blue });
260259 }
261-
260+
262261 letter->setVisible (false );
263262 j++;
264263 }
265264 i++;
266265 }
267266 }
268267 CCArrayExt<CCLabelBMFont*> lines = newDesc->getChildByType <MultilineBitmapFont>(0 )->getChildren ();
269-
268+
270269 for (auto line : lines) {
271270 CCArrayExt<CCSprite*> letters = line->getChildren ();
272271 for (auto letter : letters) {
273272 letter->setVisible (false );
274273 }
275274 }
275+ textArea->removeFromParent ();
276276 m_mainLayer->addChild (star);
277277 if (!noShadow) m_mainLayer->addChild (starShadow);
278278 auto rect = CCLayerColor::create ({ 0 ,0 ,0 ,0 }, bg->getContentWidth (), bg->getContentHeight () - 20 );
@@ -289,12 +289,12 @@ void DeltaruneAlertLayer::changeText() {
289289 m_fields->gradientOverlay = newDescGrad;
290290 m_fields->shadow = newDescShad;
291291 double pause = Mod::get ()->getSettingValue <double >(" textRollingPause" );
292-
292+
293293 m_fields->linesProgressed += emptyLinesAmount ();
294294 textArea->setPositionY (textArea->getPositionY () + m_fields->textSize * m_fields->linesProgressed );
295295 if (newDescGrad) newDescGrad->setPositionY (textArea->getPositionY ());
296296 if (newDescShad) newDescShad->setPositionY (textArea->getPositionY () - 1 );
297-
297+
298298 schedule (schedule_selector (DeltaruneAlertLayer::rollText), pause / 30 );
299299}
300300
0 commit comments