@@ -91,14 +91,14 @@ void DeltaruneAlertLayer::changeButtons() {
9191 m_buttonMenu->setVisible (false );
9292
9393 if (!m_button2) return ;
94- auto & bg = m_fields->bg ;
95- float const positionStart = bg->getPositionX () - m_buttonMenu->getPositionX () - m_fields->screenSize / 2 ;
94+ auto & bg{ m_fields->bg } ;
95+ float const positionStart{ bg->getPositionX () - m_buttonMenu->getPositionX () - m_fields->screenSize / 2 } ;
9696 m_fields->btn1 ->setPositionX (positionStart + m_fields->screenSize / 4 );
9797 m_fields->btn2 ->setPositionX (positionStart + (m_fields->screenSize / 4 ) * 3 );
9898
99- CCArrayExt<CCNode*> buttons = m_buttonMenu->getChildren ();
99+ CCArrayExt<CCNode*> buttons{ m_buttonMenu->getChildren () } ;
100100
101- auto heart = CCSprite::create (" heart.png" _spr);
101+ auto heart{ CCSprite::create (" heart.png" _spr) } ;
102102 heart->setVisible (false );
103103 heart->setPositionY (m_buttonMenu->getPositionY ());
104104 heart->setPositionX (m_buttonMenu->getPositionX ());
@@ -111,38 +111,38 @@ void DeltaruneAlertLayer::changeButtons() {
111111}
112112
113113void DeltaruneAlertLayer::changeTitle () {
114- CCLabelBMFont* & title = m_fields->title ;
115- auto & bg = m_fields->bg ;
114+ auto & title{ m_fields->title } ;
115+ auto & bg{ m_fields->bg } ;
116116 title->setAnchorPoint (CCPoint{ 0 , 0 });
117117 title->setFntFile (" Determination.fnt" _spr);
118118 title->setPosition (CCPoint{ bg->getPositionX () - bg->getContentWidth () / 2 + 24 , 138 });
119119}
120120void DeltaruneAlertLayer::changeText () {
121- auto & textArea = m_fields->textArea ;
121+ auto & textArea{ m_fields->textArea } ;
122122 if (!textArea) return ;
123123 textArea->removeFromParent ();
124124
125- auto & sound = m_fields->textSound ;
126- auto & size = m_fields->textSize ;
127- auto & nameToSound = m_fields->nameToSound ;
128- bool & noShadow = m_fields->noShadow ;
125+ auto & sound{ m_fields->textSound } ;
126+ auto & size{ m_fields->textSize } ;
127+ auto & nameToSound{ m_fields->nameToSound } ;
128+ bool & noShadow{ m_fields->noShadow } ;
129129
130130
131131 noShadow = Mod::get ()->getSettingValue <bool >(" noShadow" ) || sound == " Sans" || sound == " Papyrus" ;
132132
133- CCLabelBMFont* star = CCLabelBMFont::create (" *" , " Determination.fnt" _spr);
134- CCLabelBMFont* starShadow = nullptr ;
133+ CCLabelBMFont* star{ CCLabelBMFont::create (" *" , " Determination.fnt" _spr) } ;
134+ CCLabelBMFont* starShadow{ nullptr } ;
135135 if (!noShadow) starShadow = CCLabelBMFont::create (" *" , " Determination.fnt" _spr);
136136
137- auto str = m_fields->text ;
138- auto screenSize = m_fields->screenSize ;
139- auto & bg = m_fields->bg ;
140- std::string titleString = m_fields->title ->getString ();
137+ auto str{ m_fields->text } ;
138+ auto screenSize{ m_fields->screenSize } ;
139+ auto & bg{ m_fields->bg } ;
140+ std::string_view titleString{ m_fields->title ->getString () } ;
141141
142142 int xOffset = star->getContentWidth ();
143143
144144 if (m_fields->dialog ) {
145- if (nameToSound.find (titleString. c_str () ) != nameToSound.end ())
145+ if (nameToSound.find (titleString) != nameToSound.end ())
146146 sound = nameToSound[titleString];
147147 else
148148 sound = " Default" ;
@@ -158,7 +158,7 @@ void DeltaruneAlertLayer::changeText() {
158158 starShadow->setPositionY (109 );
159159 starShadow->setZOrder (0 );
160160 starShadow->setID (" starShadow" _spr);
161- auto character = (CCSprite*) starShadow->getChildren ()-> objectAtIndex (0 );
161+ auto character{ starShadow->getChildByType <CCSprite> (0 ) } ;
162162 character->setColor ({ 15 , 15 , 127 });
163163 }
164164 std::string font = " Determination.fnt" _spr;
@@ -184,8 +184,8 @@ void DeltaruneAlertLayer::changeText() {
184184 newDesc->setZOrder (textArea->getZOrder ());
185185 newDesc->setID (" content-text-area" );
186186
187- TextArea* newDescGrad = nullptr ;
188- TextArea* newDescShad = nullptr ;
187+ TextArea* newDescGrad{ nullptr } ;
188+ TextArea* newDescShad{ nullptr } ;
189189 if (!Mod::get ()->getSettingValue <bool >(" noGradientOverlay" ) && sound != " Sans" && sound != " Papyrus" ) {
190190 newDescGrad = TextArea::create (
191191 str,
@@ -202,7 +202,7 @@ void DeltaruneAlertLayer::changeText() {
202202 newDescGrad->setZOrder (textArea->getZOrder () + 1 );
203203 newDescGrad->setID (" gradient-overlay" _spr);
204204
205- CCArrayExt<CCLabelBMFont*> linesGrad = static_cast <CCNode*>( newDescGrad->getChildren ()-> objectAtIndex (0 )) ->getChildren ();
205+ CCArrayExt<CCLabelBMFont*> linesGrad{ newDescGrad->getChildByType <MultilineBitmapFont> (0 )->getChildren () } ;
206206 for (auto line : linesGrad) {
207207 CCArrayExt<CCSprite*> letters = line->getChildren ();
208208 for (auto letter : letters) {
@@ -228,16 +228,16 @@ void DeltaruneAlertLayer::changeText() {
228228 newDescShad->setZOrder (textArea->getZOrder () - 1 );
229229 newDescShad->setID (" shadow" _spr);
230230
231- CCArrayExt<CCLabelBMFont*> linesShad = static_cast <CCNode*>( newDescShad->getChildren ()-> objectAtIndex ( 0 ) )->getChildren ();
231+ CCArrayExt<CCLabelBMFont*> linesShad = newDescShad->getChildByType <MultilineBitmapFont>( 0 )->getChildren ();
232232 int i = 0 ;
233233 for (auto line : linesShad) {
234234 CCArrayExt<CCSprite*> letters = line->getChildren ();
235235 int j = 0 ;
236236 for (auto letter : letters) {
237- auto origLinesParent = (CCNode*) newDesc->getChildren ()-> objectAtIndex (0 );
238- auto origLine = (CCLabelBMFont*) origLinesParent->getChildren ()-> objectAtIndex (i);
239- auto origChar = (CCSprite*) origLine->getChildren ()-> objectAtIndex (j);
240- auto color = origChar->getColor ();
237+ auto origLinesParent{ newDesc->getChildByType <MultilineBitmapFont> (0 ) } ;
238+ auto origLine{ origLinesParent->getChildByType <CCLabelBMFont> (i) } ;
239+ auto origChar{ origLine->getChildByType <CCSprite> (j) } ;
240+ auto color{ origChar->getColor () } ;
241241
242242 if (color == ccColor3B{ 255 ,255 ,255 }) letter->setColor ({ 15 , 15 , 127 });
243243 else if (color == ccColor3B{ 255 , 0 , 255 }) letter->setColor ({ 76 , 0 , 76 });
@@ -259,7 +259,7 @@ void DeltaruneAlertLayer::changeText() {
259259 i++;
260260 }
261261 }
262- CCArrayExt<CCLabelBMFont*> lines = static_cast <CCNode*>( newDesc->getChildren ()-> objectAtIndex (0 )) ->getChildren ();
262+ CCArrayExt<CCLabelBMFont*> lines{ newDesc->getChildByType <MultilineBitmapFont> (0 )->getChildren () } ;
263263
264264 for (auto line : lines) {
265265 CCArrayExt<CCSprite*> letters = line->getChildren ();
@@ -282,7 +282,7 @@ void DeltaruneAlertLayer::changeText() {
282282 textArea = newDesc;
283283 m_fields->gradientOverlay = newDescGrad;
284284 m_fields->shadow = newDescShad;
285- float pause = Mod::get ()->getSettingValue <double >(" textRollingPause" );
285+ double pause{ Mod::get ()->getSettingValue <double >(" textRollingPause" ) } ;
286286
287287 m_fields->linesProgressed += emptyLinesAmount ();
288288 textArea->setPositionY (textArea->getPositionY () + m_fields->textSize * m_fields->linesProgressed );
0 commit comments