Skip to content

Commit

Permalink
Manual: Play "wrong" sound effect when end of page or page list is re…
Browse files Browse the repository at this point in the history
…ached
  • Loading branch information
RocketRobz committed Aug 22, 2024
1 parent f66e80e commit 8ebfd4c
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions manual/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ int manualScreen(void) {
int held = 0;
int repeat = 0;
int currentPage = 0, returnPage = -1;
bool isScrolling = false;
touchPosition touch;

while (1) {
Expand Down Expand Up @@ -295,11 +296,23 @@ int manualScreen(void) {
}
} else if (held & KEY_UP) {
pageYpos -= 4;
if (pageYpos < 0) pageYpos = 0;
if (pageYpos < 0) {
if ((pressed & KEY_UP) || isScrolling) mmEffectEx(&snd_wrong);
pageYpos = 0;
isScrolling = false;
} else {
isScrolling = true;
}
pageScroll();
} else if (held & KEY_DOWN) {
pageYpos += 4;
if (pageYpos > pageYsize-ySizeSub) pageYpos = pageYsize-ySizeSub;
if (pageYpos > pageYsize-ySizeSub) {
if ((pressed & KEY_DOWN) || isScrolling) mmEffectEx(&snd_wrong);
pageYpos = pageYsize-ySizeSub;
isScrolling = false;
} else {
isScrolling = true;
}
pageScroll();
} else if (repeat & KEY_LEFT) {
if (currentPage > 0) {
Expand All @@ -314,6 +327,8 @@ int manualScreen(void) {
printSmall(true, manPageTitleX, 0, manPageTitle, manPageTitleAlign);
updateText(true);
leaveTopBarIntact = false;
} else {
mmEffectEx(&snd_wrong);
}
} else if (repeat & KEY_RIGHT) {
if (currentPage < (int)manPagesList.size()-1) {
Expand All @@ -328,6 +343,8 @@ int manualScreen(void) {
printSmall(true, manPageTitleX, 0, manPageTitle, manPageTitleAlign);
updateText(true);
leaveTopBarIntact = false;
} else {
mmEffectEx(&snd_wrong);
}
} else if (pressed & KEY_TOUCH) {
touchPosition touchStart = touch;
Expand Down

0 comments on commit 8ebfd4c

Please sign in to comment.