@@ -8,8 +8,8 @@ float randomNumberInAGivenRangeThatGetsAddedOrRemovedFromADifferentNumber(float
88}
99
1010void DeltaruneAlertLayer::initMaps () {
11- auto & nameToFile{ m_fields->nameToFile } ;
12- auto & nameToSound{ m_fields->nameToSound } ;
11+ auto & nameToFile = m_fields->nameToFile ;
12+ auto & nameToSound = m_fields->nameToSound ;
1313
1414 nameToFile[" Default" ] = " SND_TXT1" ;
1515 nameToFile[" Typewriter" ] = " SND_TXT2" ;
@@ -50,14 +50,14 @@ bool DeltaruneAlertLayer::init(FLAlertLayerProtocol* delegate, char const* title
5050 if (!FLAlertLayer::init (delegate, title, desc, btn1, btn2, width, scroll, height, textScale)) return false ;
5151
5252 NodeIDs::provideFor (this );
53- setID (" FLAlertLayer" );
53+ this -> setID (" FLAlertLayer" );
5454
5555 std::string_view descString = desc;
5656 bool const isEmpty = std::ranges::all_of (descString, [](unsigned char c) {
5757 return std::isspace (c);
5858 });
5959 bool const prismLoaded = Loader::get ()->isModLoaded (" firee.prism" );
60- std::string_view prismString{ " AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" } ; // probably the easiest way to detect a Prism Menu alert :3
60+ std::string_view prismString = " AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" ; // probably the easiest way to detect a Prism Menu alert :3
6161 if ((prismLoaded && desc == prismString) || isEmpty) {
6262 m_fields->incompatible = true ;
6363 return true ;
@@ -148,18 +148,18 @@ void DeltaruneAlertLayer::onBtn1(CCObject* sender) {
148148}
149149
150150int DeltaruneAlertLayer::getLinesLeft () {
151- auto & textArea{ m_fields->textArea } ;
151+ auto & textArea = m_fields->textArea ;
152152 if (!m_fields->textAreaClippingNode ) return 0 ;
153153 if (!textArea) return 0 ;
154154
155- auto bitmapFont{ textArea->getChildByType <MultilineBitmapFont>(0 ) } ;
156- CCArrayExt<CCLabelBMFont*> content{ bitmapFont->getChildren () } ;
155+ auto bitmapFont = textArea->getChildByType <MultilineBitmapFont>(0 );
156+ CCArrayExt<CCLabelBMFont*> content = bitmapFont->getChildren ();
157157 return content.size () - m_fields->linesProgressed ;
158158}
159159void DeltaruneAlertLayer::show () {
160- bool & showing{ m_fields->showing } ;
161- bool & incompatible{ m_fields->incompatible } ;
162- auto & titleNode{ m_fields->title } ;
160+ bool & showing = m_fields->showing ;
161+ bool & incompatible = m_fields->incompatible ;
162+ auto & titleNode = m_fields->title ;
163163
164164 FLAlertLayer::show ();
165165
@@ -173,9 +173,9 @@ void DeltaruneAlertLayer::show() {
173173 if (!m_mainLayer) return ;
174174
175175
176- auto title{ std::string_view ( titleNode->getString ()) } ;
176+ auto title = titleNode->getString ();
177177
178- if (Loader::get ()->isModLoaded (" user95401.geode-mod-comments" ) && (title == " Create Comment" || this ->getID () == " finish" )) {
178+ if (Loader::get ()->isModLoaded (" user95401.geode-mod-comments" ) && (strcmp ( title, " Create Comment" ) == 0 || this ->getID () == " finish" )) {
179179 this ->setVisible (false );
180180 Loader::get ()->queueInMainThread ([this ] {
181181 this ->setVisible (true );
@@ -192,16 +192,18 @@ void DeltaruneAlertLayer::show() {
192192 changeLook ();
193193}
194194void DeltaruneAlertLayer::setHeartPosition (CCMenuItemSpriteExtra* button) {
195- auto & heart{ m_fields->heart } ;
196- auto text{ button->getChildByType <ButtonSprite>(0 )->getChildByType <CCLabelBMFont>(0 ) } ;
195+ auto & heart = m_fields->heart ;
196+ auto text = button->getChildByType <ButtonSprite>(0 )->getChildByType <CCLabelBMFont>(0 );
197197
198198 if (!text) return ;
199199
200- heart->setPositionX (m_buttonMenu->getPositionX () + button->getPositionX () - text->getContentWidth () / 2 - heart->getContentWidth () / 2 - 5 );
200+ auto xPos = m_buttonMenu->getPositionX () + button->getPositionX () - text->getContentWidth () / 2 - heart->getContentWidth () / 2 - 5 ;
201+
202+ heart->setPositionX (xPos);
201203}
202204
203205void DeltaruneAlertLayer::clickedOnButton (CCMenuItemSpriteExtra* btn, ButtonSprite* buttonSprite, int btnSelected) {
204- auto label{ buttonSprite->getChildByType <CCLabelBMFont>(0 ) } ;
206+ auto label = buttonSprite->getChildByType <CCLabelBMFont>(0 );
205207 if (!label) return ;
206208 if (btn->isSelected ()) {
207209 label->setColor (ccColor3B{ 255 , 255 , 0 });
@@ -226,7 +228,7 @@ bool DeltaruneAlertLayer::ccTouchBegan(CCTouch* touch, CCEvent* event) {
226228
227229 if (!btn1 || !btn2) return ret;
228230 if (!btn1->isSelected () && !btn2->isSelected ()) return ret;
229-
231+
230232 clickedOnButton (btn1, m_button1, 1 );
231233 clickedOnButton (btn2, m_button2, 2 );
232234 return ret;
@@ -360,14 +362,14 @@ void DeltaruneAlertLayer::skipText() {
360362}
361363
362364int DeltaruneAlertLayer::emptyLinesAmount (int offset) {
363- auto & textArea{ m_fields->textArea } ;
364- auto & linesProgressed{ m_fields->linesProgressed } ;
365- auto fontNode{ textArea->getChildByType <MultilineBitmapFont>(0 ) } ;
366- int lines{ 0 } ;
365+ auto & textArea = m_fields->textArea ;
366+ auto & linesProgressed = m_fields->linesProgressed ;
367+ auto fontNode = textArea->getChildByType <MultilineBitmapFont>(0 );
368+ int lines = 0 ;
367369 while (true ) {
368370 if (linesProgressed + lines + offset >= fontNode->getChildrenCount ()) break ;
369371
370- auto topLine{ fontNode->getChildByType <CCLabelBMFont>(linesProgressed + lines + offset) } ;
372+ auto topLine = fontNode->getChildByType <CCLabelBMFont>(linesProgressed + lines + offset);
371373 if (!topLine) break ;
372374
373375 std::string_view topLineString = topLine->getString ();
@@ -378,8 +380,8 @@ int DeltaruneAlertLayer::emptyLinesAmount(int offset) {
378380
379381 lines++;
380382
381- auto star{ m_mainLayer->getChildByID (" star" _spr) } ;
382- auto starShadow{ m_mainLayer->getChildByID (" starShadow" _spr) } ;
383+ auto star = m_mainLayer->getChildByID (" star" _spr);
384+ auto starShadow = m_mainLayer->getChildByID (" starShadow" _spr);
383385
384386 if (star) star->setVisible (true );
385387 if (starShadow) starShadow->setVisible (true );
@@ -392,21 +394,21 @@ void DeltaruneAlertLayer::progressText() {
392394 if (!m_buttonMenu) return ;
393395 if (!m_fields->textAreaClippingNode ) return ;
394396
395- auto & textArea{ m_fields->textArea } ;
396- auto & btn1{ m_fields->btn1 } ;
397- auto & btn2{ m_fields->btn2 } ;
398- auto & shadow{ m_fields->shadow } ;
399- auto & gradientOverlay{ m_fields->gradientOverlay } ;
400- int & btnSelected{ m_fields->btnSelected } ;
401- int & linesProgressed{ m_fields->linesProgressed } ;
402- bool & done{ m_fields->done } ;
403- bool & noShadow{ m_fields->noShadow } ;
397+ auto & textArea = m_fields->textArea ;
398+ auto & btn1 = m_fields->btn1 ;
399+ auto & btn2 = m_fields->btn2 ;
400+ auto & shadow = m_fields->shadow ;
401+ auto & gradientOverlay = m_fields->gradientOverlay ;
402+ int & btnSelected = m_fields->btnSelected ;
403+ int & linesProgressed = m_fields->linesProgressed ;
404+ bool & done = m_fields->done ;
405+ bool & noShadow = m_fields->noShadow ;
404406
405407 if (!textArea) return ;
406408
407409 if (getLinesLeft () - emptyLinesAmount (3 ) <= 3 ) {
408410 if (!m_button2) {
409- auto dialogLayer{ m_fields->dialogLayer } ;
411+ auto & dialogLayer = m_fields->dialogLayer ;
410412 done = true ;
411413 if (m_fields->dialog && dialogLayer) {
412414 dialogLayer->keyBackClicked ();
@@ -490,15 +492,15 @@ void DeltaruneAlertLayer::progressText() {
490492}
491493
492494void DeltaruneAlertLayer::rollText (float dt) {
493- int & waitQueue{ m_fields->waitQueue } ;
494- int & linesProgressed{ m_fields->linesProgressed } ;
495- int & characterCount{ m_fields->characterCount } ;
496- int & rollingLine{ m_fields->rollingLine } ;
497- bool & playedSound{ m_fields->playedSound } ;
498- bool & doneRolling{ m_fields->doneRolling } ;
499- bool & rolledPage{ m_fields->rolledPage } ;
500- float & lostTime{ m_fields->lostTime } ;
501- double const pause{ Mod::get ()->getSettingValue <double >(" textRollingPause" ) / 30 } ;
495+ int & waitQueue = m_fields->waitQueue ;
496+ int & linesProgressed = m_fields->linesProgressed ;
497+ int & characterCount = m_fields->characterCount ;
498+ int & rollingLine = m_fields->rollingLine ;
499+ bool & playedSound = m_fields->playedSound ;
500+ bool & doneRolling = m_fields->doneRolling ;
501+ bool & rolledPage = m_fields->rolledPage ;
502+ float & lostTime = m_fields->lostTime ;
503+ double const pause = Mod::get ()->getSettingValue <double >(" textRollingPause" ) / 30 ;
502504
503505 if (dt - pause > pause)
504506 lostTime += dt - pause;
@@ -528,9 +530,9 @@ void DeltaruneAlertLayer::rollText(float dt) {
528530 CCArrayExt<CCLabelBMFont*> lines = textArea->getChildByType <MultilineBitmapFont>(0 )->getChildren ();
529531 int currentLine = linesProgressed + rollingLine;
530532 if (currentLine < lines.size () && currentLine < linesProgressed + 3 ) {
531- auto line{ lines[currentLine] } ;
532- CCArrayExt<CCNode*> letters{ line->getChildren () } ;
533- auto letter{ letters[characterCount] } ;
533+ auto line = lines[currentLine];
534+ CCArrayExt<CCNode*> letters = line->getChildren ();
535+ auto letter = letters[characterCount];
534536 if (letter->isVisible ()) {
535537 unschedule (schedule_selector (DeltaruneAlertLayer::rollText));
536538 doneRolling = true ;
@@ -577,26 +579,26 @@ void DeltaruneAlertLayer::rollText(float dt) {
577579 }
578580 auto & nameToFile = m_fields->nameToFile ;
579581 auto const textSound = m_fields->textSound ;
580- auto const resFolder = Mod::get ()->getResourcesDir (). string () ;
581- auto path = fmt::format (" {}/{} .wav" , resFolder , nameToFile[textSound]);
582+ auto const resFolder = Mod::get ()->getResourcesDir ();
583+ auto path = resFolder / fmt::format (" {}.wav" , nameToFile[textSound]);
582584
583585 if (nameToFile.find (textSound) == nameToFile.end ()) return ;
584586
585587 if (!playSound || playedSound) {
586588 playedSound = false ;
587589 return ;
588590 }
589- float pitch{ 1 .f } ;
591+ float pitch = 1 .f ;
590592 playedSound = true ;
591593
592- auto & system{ m_fields->system } ;
593- auto & channel{ m_fields->channel } ;
594- auto & sound{ m_fields->sound } ;
594+ auto & system = m_fields->system ;
595+ auto & channel = m_fields->channel ;
596+ auto & sound = m_fields->sound ;
595597
596598 if (textSound == " Queen" )
597599 pitch = 1 + randomNumberInAGivenRangeThatGetsAddedOrRemovedFromADifferentNumber (0 .2f );
598600
599- system->createSound (path.c_str (), FMOD_DEFAULT, nullptr , &sound);
601+ system->createSound (path.string (). c_str (), FMOD_DEFAULT, nullptr , &sound);
600602 system->playSound (sound, nullptr , false , &channel);
601603 channel->setPitch (pitch);
602604 channel->setVolume (FMODAudioEngine::sharedEngine ()->m_sfxVolume );
0 commit comments