SuperAllStarPhotoStudio/source/screens/whatToDo.cpp
StackZ 24b818c2b1 Add Screen classes for SavvyManager. (#6)
* Add Screen classes for SavvyManager.

* This should fix the character change.
2020-05-27 03:06:52 -06:00

200 lines
5.9 KiB
C++

#include "characterChange.hpp"
#include "emblemChange.hpp"
#include "gameSelect.hpp"
#include "musicChange.hpp"
#include "screenvars.h"
#include "whatToDo.hpp"
extern int ss1Logo;
extern int ss2Screenshot;
extern int ss2Logo;
extern int ss1LogoXpos;
extern int ssLogoXpos;
extern int ss3Logo;
extern int ss4Logo;
extern bool ss2SaveFound;
extern bool ss3SaveFound;
extern bool ss4SaveFound;
WhatToDo::WhatToDo() {
this->initialize();
}
void WhatToDo::initialize() {
if ((highlightedGame == 0)
|| (highlightedGame > 1 && this->whatToChange_cursorPosition == 1)
|| (highlightedGame < 2 && this->whatToChange_cursorPosition == 2)) {
this->whatToChange_cursorPosition = 0;
}
this->cursorChange();
}
void WhatToDo::Draw(void) const {
Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
GFX::DrawSprite(sprites_phone_bg_idx, -72+bg_xPos+w*72, bg_yPos+h*136);
}
}
switch(highlightedGame) {
case 0:
default:
GFX::DrawGameSelSprite(ss1Logo, 40+ss1LogoXpos, 56);
break;
case 1:
GFX::DrawGameSelSprite(ss2Logo, 40+ssLogoXpos, 56);
break;
case 2:
GFX::DrawGameSelSprite(ss3Logo, 40, 56);
break;
case 3:
GFX::DrawGameSelSprite(ss4Logo, 40+ssLogoXpos, 56);
break;
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
GFX::DrawSprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
}
}
Gui::DrawString(8, 8, 0.50, BLACK, "What do you want to change?");
int iconXpos = 64;
GFX::DrawSpriteBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
GFX::DrawSprite(sprites_icon_profile_idx, iconXpos, 80);
Gui::DrawString(iconXpos-2, 140, 0.50, RED, "Characters");
iconXpos += 64;
if (highlightedGame == 1) {
// Show music pack option for Trendsetters
GFX::DrawSpriteBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
GFX::DrawSprite(sprites_icon_music_idx, iconXpos, 80);
Gui::DrawString(iconXpos+14, 140, 0.50, RED, "Music");
}
iconXpos += 64;
if (highlightedGame > 1) {
// Show emblem option for Fashion Forward and Styling Star
GFX::DrawSpriteBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
GFX::DrawSprite(sprites_icon_emblem_idx, iconXpos, 80);
Gui::DrawString(iconXpos+8, 140, 0.50, RED, "Emblem");
}
GFX::DrawSprite(sprites_button_shadow_idx, 5, 199);
GFX::DrawSprite(sprites_button_red_idx, 5, 195);
GFX::DrawSprite(sprites_arrow_back_idx, 19, 195);
GFX::DrawSprite(sprites_button_b_idx, 44, 218);
/*GFX::DrawSprite(sprites_button_shadow_idx, 251, 199);
GFX::DrawSprite(sprites_button_blue_idx, 251, 195);*/
GFX::drawCursor(this->cursorX, this->cursorY);
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
}
void WhatToDo::cursorChange() {
switch (this->whatToChange_cursorPosition) {
case 0:
default:
this->cursorX = 80;
this->cursorY = 104;
break;
case 1:
this->cursorX = 148;
this->cursorY = 104;
break;
case 2:
this->cursorX = 212;
this->cursorY = 104;
break;
}
}
void WhatToDo::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (this->showMessage) {
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 115 && touch.px < 115+90 && touch.py >= 188 && touch.py < 188+47)) {
sndSelect();
this->showMessage = false;
}
} else {
if (highlightedGame > 0 && showCursor) {
if (hDown & KEY_LEFT) {
sndHighlight();
if (highlightedGame > 1) {
if (this->whatToChange_cursorPosition == 2) this->whatToChange_cursorPosition = 0;
else if (this->whatToChange_cursorPosition == 0) this->whatToChange_cursorPosition = 2;
this->cursorChange();
} else {
this->whatToChange_cursorPosition--;
if (this->whatToChange_cursorPosition < 0) this->whatToChange_cursorPosition = 1;
this->cursorChange();
}
} else if (hDown & KEY_RIGHT) {
sndHighlight();
if (highlightedGame > 1) {
if (this->whatToChange_cursorPosition == 0) this->whatToChange_cursorPosition = 2;
else if (this->whatToChange_cursorPosition == 2) this->whatToChange_cursorPosition = 0;
this->cursorChange();
} else {
whatToChange_cursorPosition++;
if (this->whatToChange_cursorPosition > 1) this->whatToChange_cursorPosition = 0;
this->cursorChange();
}
}
}
if (hDown & KEY_A) {
this->runSelection = true;
}
if ((hDown & KEY_TOUCH) && touch.px >= 71 && touch.px <= 248 && touch.py >= 91 && touch.py <= 136) {
if (touch.px < 120) {
this->whatToChange_cursorPosition = 0;
this->cursorChange();
this->runSelection = true;
}
if ((touch.px > 134) && (touch.px < 185) && highlightedGame==1) {
this->whatToChange_cursorPosition = 1;
this->cursorChange();
this->runSelection = true;
}
if ((touch.px > 198) && highlightedGame > 1) {
this->whatToChange_cursorPosition = 2;
this->cursorChange();
this->runSelection = true;
}
}
if (this->runSelection) {
sndSelect();
switch (this->whatToChange_cursorPosition) {
case 0:
if ((highlightedGame==1 && ss2SaveFound)
|| (highlightedGame==2 && ss3SaveFound)
|| (highlightedGame==3 && ss4SaveFound))
{
Gui::setScreen(std::make_unique<CharacterChange>(), true);
} else {
sndBack();
this->messageNo = 1;
this->showMessage = true;
}
break;
case 1:
Gui::setScreen(std::make_unique<MusicChange>(), true);
break;
case 2:
Gui::setScreen(std::make_unique<EmblemChange>(), true);
break;
}
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
Gui::setScreen(std::make_unique<GameSelect>(), true);
}
}
}