Skip to content

Commit 6354154

Browse files
committed
DSi theme: Add icon drop down effect during fade-in
1 parent 7a7211c commit 6354154

File tree

3 files changed

+82
-8
lines changed

3 files changed

+82
-8
lines changed

romsel_dsimenutheme/arm9/source/fileBrowse.cpp

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ extern bool arm7SCFGLocked;
6969
extern int consoleModel;
7070
extern bool isRegularDS;
7171

72+
extern bool dropDown;
73+
extern bool redoDropDown;
7274
extern bool showbubble;
7375
extern bool showSTARTborder;
7476

@@ -386,6 +388,15 @@ bool isTopLevel(const char *path)
386388
#endif
387389
}
388390

391+
void waitForFadeOut (void) {
392+
if (!dropDown && theme == 0) {
393+
dropDown = true;
394+
for (int i = 0; i < 60; i++) swiWaitForVBlank();
395+
} else {
396+
for (int i = 0; i < 25; i++) swiWaitForVBlank();
397+
}
398+
}
399+
389400
string browseForFile(const vector<string> extensionList, const char* username)
390401
{
391402
int pressed = 0;
@@ -471,14 +482,15 @@ string browseForFile(const vector<string> extensionList, const char* username)
471482
}
472483
}
473484

485+
whiteScreen = false;
486+
fadeType = true; // Fade in from white
487+
for (int i = 0; i < 5; i++) swiWaitForVBlank();
474488
if (!music) {
475489
mmEffectEx(&mus_menu);
476490
music = true;
477491
}
478-
whiteScreen = false;
479-
fadeType = true; // Fade in from white
480-
for (int i = 0; i < 30; i++) swiWaitForVBlank();
481-
492+
waitForFadeOut();
493+
482494
/* clearText(false);
483495
updatePath();
484496
TextPane *pane = &createTextPane(20, 3 + ENTRIES_START_ROW*FONT_SY, ENTRIES_PER_SCREEN);
@@ -711,6 +723,7 @@ string browseForFile(const vector<string> extensionList, const char* username)
711723
whiteScreen = true;
712724
if (showBoxArt) clearBoxArt(); // Clear box art
713725
boxArtLoaded = false;
726+
redoDropDown = true;
714727
shouldersRendered = false;
715728
showbubble = false;
716729
showSTARTborder = false;
@@ -881,6 +894,7 @@ string browseForFile(const vector<string> extensionList, const char* username)
881894
whiteScreen = true;
882895
if (showBoxArt) clearBoxArt(); // Clear box art
883896
boxArtLoaded = false;
897+
redoDropDown = true;
884898
shouldersRendered = false;
885899
showbubble = false;
886900
showSTARTborder = false;
@@ -900,6 +914,7 @@ string browseForFile(const vector<string> extensionList, const char* username)
900914
whiteScreen = true;
901915
if (showBoxArt) clearBoxArt(); // Clear box art
902916
boxArtLoaded = false;
917+
redoDropDown = true;
903918
shouldersRendered = false;
904919
showbubble = false;
905920
showSTARTborder = false;
@@ -937,12 +952,16 @@ string browseForFile(const vector<string> extensionList, const char* username)
937952
SaveSettings();
938953
settingsChanged = false;
939954
}
940-
shouldersRendered = false;
941955
whiteScreen = true;
956+
redoDropDown = true;
957+
shouldersRendered = false;
958+
showbubble = false;
959+
showSTARTborder = false;
942960
clearText();
943961
whiteScreen = false;
944962
fadeType = true; // Fade in from white
945-
for (int i = 0; i < 30; i++) swiWaitForVBlank();
963+
for (int i = 0; i < 5; i++) swiWaitForVBlank();
964+
waitForFadeOut();
946965
} else if (showDirectories) {
947966
// Go up a directory
948967
mmEffectEx(&snd_select);
@@ -955,6 +974,7 @@ string browseForFile(const vector<string> extensionList, const char* username)
955974
whiteScreen = true;
956975
if (showBoxArt) clearBoxArt(); // Clear box art
957976
boxArtLoaded = false;
977+
redoDropDown = true;
958978
shouldersRendered = false;
959979
showbubble = false;
960980
showSTARTborder = false;
@@ -1049,13 +1069,15 @@ string browseForFile(const vector<string> extensionList, const char* username)
10491069
whiteScreen = true;
10501070
if (showBoxArt) clearBoxArt(); // Clear box art
10511071
boxArtLoaded = false;
1072+
redoDropDown = true;
10521073
shouldersRendered = false;
10531074
showbubble = false;
10541075
showSTARTborder = false;
10551076
clearText();
10561077
whiteScreen = false;
10571078
fadeType = true; // Fade in from white
1058-
for (int i = 0; i < 30; i++) swiWaitForVBlank();
1079+
for (int i = 0; i < 5; i++) swiWaitForVBlank();
1080+
waitForFadeOut();
10591081
}
10601082

10611083
if ((pressed & KEY_SELECT) && !startMenu

romsel_dsimenutheme/arm9/source/graphics/graphics.cpp

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ extern int colorRvalue;
8585
extern int colorGvalue;
8686
extern int colorBvalue;
8787

88+
extern bool dropDown;
89+
extern bool redoDropDown;
90+
int dropTime = 0;
91+
int dropSeq = 0;
92+
int dropSpeed = 5;
93+
int dropSpeedChange = 0;
8894
extern bool showbubble;
8995
extern bool showSTARTborder;
9096

@@ -112,7 +118,7 @@ extern int startMenu_cursorPosition;
112118
extern int pagenum;
113119
int titleboxXpos;
114120
int startMenu_titleboxXpos;
115-
int titleboxYpos = 85;
121+
int titleboxYpos = -80; // 85, when dropped down
116122
int titlewindowXpos;
117123
int startMenu_titlewindowXpos;
118124

@@ -505,6 +511,50 @@ void vBlankHandler()
505511
}
506512
}
507513

514+
if (redoDropDown && theme == 0) {
515+
dropTime = 0;
516+
dropSeq = 0;
517+
dropSpeed = 5;
518+
dropSpeedChange = 0;
519+
titleboxYpos = -80; // 85, when dropped down
520+
dropDown = false;
521+
redoDropDown = false;
522+
}
523+
524+
if (dropDown && theme == 0) {
525+
if (dropSeq == 0) {
526+
titleboxYpos += dropSpeed;
527+
if (titleboxYpos > 85) dropSeq = 1;
528+
} else if (dropSeq == 1) {
529+
titleboxYpos -= dropSpeed;
530+
dropTime++;
531+
dropSpeedChange++;
532+
if (dropTime >= 15) {
533+
dropSpeedChange = -1;
534+
dropSeq = 2;
535+
}
536+
if (dropSpeedChange == 2) {
537+
dropSpeed--;
538+
if (dropSpeed < 0) dropSpeed = 0;
539+
dropSpeedChange = -1;
540+
}
541+
} else if (dropSeq == 2) {
542+
titleboxYpos += dropSpeed;
543+
if (titleboxYpos >= 85) {
544+
dropSeq = 3;
545+
titleboxYpos = 85;
546+
}
547+
dropSpeedChange++;
548+
if (dropSpeedChange == 1) {
549+
dropSpeed++;
550+
if (dropSpeed > 4) dropSpeed = 4;
551+
dropSpeedChange = -1;
552+
}
553+
} else if (dropSeq == 3) {
554+
titleboxYpos = 85;
555+
}
556+
}
557+
508558
//if (renderingTop)
509559
//{
510560
/*glBoxFilledGradient(0, -64, 256, 112,

romsel_dsimenutheme/arm9/source/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ bool useBootstrap = false;
308308

309309
using namespace std;
310310

311+
bool dropDown = false;
312+
bool redoDropDown = false;
311313
bool showbubble = false;
312314
bool showSTARTborder = false;
313315

0 commit comments

Comments
 (0)