Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
ALSO: Zoom in camera using circle pad, in character menu
  • Loading branch information
RocketRobz committed Dec 25, 2019
1 parent 1911946 commit 8dadd1a
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 25 deletions.
1 change: 1 addition & 0 deletions include/gui.hpp
Expand Up @@ -63,6 +63,7 @@ namespace Gui {

void sprite(int key, float x, float y);
void spriteScale(int key, float x, float y, float scaleX, float scaleY);
void charSprite(int key, float x, float y);

void Draw_ImageBlend(int key, float x, float y, u32 color);
}
Expand Down
Binary file modified romfs/character/Styling Star/Fall/Robz.chr
Binary file not shown.
Binary file modified romfs/character/Styling Star/Spring/Robz.chr
Binary file not shown.
72 changes: 47 additions & 25 deletions source/charchange.cpp
Expand Up @@ -87,6 +87,8 @@ extern void drawCursor(void);

extern u32 hDown;

static int zoomIn = 0;

static int cheatKeys[10] = {0};
static int cheatKeyPosition = 0;

Expand Down Expand Up @@ -261,7 +263,19 @@ void changeCharacter(void) {
Gui::clearTextBufs();
set_screen(top);

Gui::sprite(sprites_blue_bg_idx, 0, 0);
switch (zoomIn) {
case 0:
default:
Gui::sprite(sprites_blue_bg_idx, 0, 0);
break;
case 1:
Gui::spriteScale(sprites_blue_bg_idx, -100, 0, 1.50, 1.50);
break;
case 2:
Gui::spriteScale(sprites_blue_bg_idx, -150, 0, 1.75, 1.75);
break;
}
//Gui::charSprite(0, 0+(400*zoomIn), 0-(240*seasonNo));

if (messageNo == 4) {
Draw_Text(8, 210, 0.50, WHITE, removeBags ? " Keep bags" : " Remove bags");
Expand Down Expand Up @@ -415,6 +429,14 @@ void changeCharacter(void) {
Draw_EndFrame();

if (!fadein && !fadeout) {
if (hDown & KEY_CPAD_UP) {
zoomIn++;
if (zoomIn > 2) zoomIn = 2;
}
if (hDown & KEY_CPAD_DOWN) {
zoomIn--;
if (zoomIn < 0) zoomIn = 0;
}
if (showMessage) {
if (messageNo == 4) {
if (hDown & KEY_A) {
Expand Down Expand Up @@ -457,25 +479,25 @@ void changeCharacter(void) {
cheatKeys[cheatKeyPosition] = hDown;
cheatKeyPosition++;
}
robzAction = ((cheatKeys[0] & KEY_UP)
&& (cheatKeys[1] & KEY_UP)
&& (cheatKeys[2] & KEY_DOWN)
&& (cheatKeys[3] & KEY_DOWN)
&& (cheatKeys[4] & KEY_LEFT)
&& (cheatKeys[5] & KEY_RIGHT)
&& (cheatKeys[6] & KEY_LEFT)
&& (cheatKeys[7] & KEY_RIGHT)
robzAction = ((cheatKeys[0] & KEY_DUP)
&& (cheatKeys[1] & KEY_DUP)
&& (cheatKeys[2] & KEY_DDOWN)
&& (cheatKeys[3] & KEY_DDOWN)
&& (cheatKeys[4] & KEY_DLEFT)
&& (cheatKeys[5] & KEY_DRIGHT)
&& (cheatKeys[6] & KEY_DLEFT)
&& (cheatKeys[7] & KEY_DRIGHT)
&& (cheatKeys[8] & KEY_B)
&& (cheatKeys[9] & KEY_A));
if (cheatKeyPosition==10
|| ((cheatKeys[0] != 0) && !(cheatKeys[0] & KEY_UP))
|| ((cheatKeys[1] != 0) && !(cheatKeys[1] & KEY_UP))
|| ((cheatKeys[2] != 0) && !(cheatKeys[2] & KEY_DOWN))
|| ((cheatKeys[3] != 0) && !(cheatKeys[3] & KEY_DOWN))
|| ((cheatKeys[4] != 0) && !(cheatKeys[4] & KEY_LEFT))
|| ((cheatKeys[5] != 0) && !(cheatKeys[5] & KEY_RIGHT))
|| ((cheatKeys[6] != 0) && !(cheatKeys[6] & KEY_LEFT))
|| ((cheatKeys[7] != 0) && !(cheatKeys[7] & KEY_RIGHT))
|| ((cheatKeys[0] != 0) && !(cheatKeys[0] & KEY_DUP))
|| ((cheatKeys[1] != 0) && !(cheatKeys[1] & KEY_DUP))
|| ((cheatKeys[2] != 0) && !(cheatKeys[2] & KEY_DDOWN))
|| ((cheatKeys[3] != 0) && !(cheatKeys[3] & KEY_DDOWN))
|| ((cheatKeys[4] != 0) && !(cheatKeys[4] & KEY_DLEFT))
|| ((cheatKeys[5] != 0) && !(cheatKeys[5] & KEY_DRIGHT))
|| ((cheatKeys[6] != 0) && !(cheatKeys[6] & KEY_DLEFT))
|| ((cheatKeys[7] != 0) && !(cheatKeys[7] & KEY_DRIGHT))
|| ((cheatKeys[8] != 0) && !(cheatKeys[8] & KEY_B))
|| ((cheatKeys[9] != 0) && !(cheatKeys[9] & KEY_A))) {
for (int i= 0; i < 10; i++) {
Expand All @@ -484,7 +506,7 @@ void changeCharacter(void) {
cheatKeyPosition = 0;
}
if (showCursor) {
if (hDown & KEY_UP) {
if (hDown & KEY_DUP) {
sndHighlight();
importCharacterList_cursorPosition--;
importCharacterList_cursorPositionOnScreen--;
Expand All @@ -498,7 +520,7 @@ void changeCharacter(void) {
importCharacterList_cursorPositionOnScreen = 0;
}
}
if (hDown & KEY_DOWN) {
if (hDown & KEY_DDOWN) {
sndHighlight();
importCharacterList_cursorPosition++;
importCharacterList_cursorPositionOnScreen++;
Expand Down Expand Up @@ -624,7 +646,7 @@ void changeCharacter(void) {
showMessage = true;
}
}
if (hDown & KEY_LEFT) {
if (hDown & KEY_DLEFT) {
sndHighlight();
import_highlightedGame--;
if (import_highlightedGame < 0) import_highlightedGame = 4;
Expand All @@ -635,7 +657,7 @@ void changeCharacter(void) {
getExportedCharacterContents();
}
}
if (hDown & KEY_RIGHT) {
if (hDown & KEY_DRIGHT) {
sndHighlight();
import_highlightedGame++;
if (import_highlightedGame > 4) import_highlightedGame = 0;
Expand Down Expand Up @@ -664,7 +686,7 @@ void changeCharacter(void) {
}
} else if (subScreenMode == 1) {
if (showCursor) {
if (hDown & KEY_UP) {
if (hDown & KEY_DUP) {
sndHighlight();
characterChangeMenu_cursorPosition--;
characterChangeMenu_cursorPositionOnScreen--;
Expand All @@ -678,7 +700,7 @@ void changeCharacter(void) {
characterChangeMenu_cursorPositionOnScreen = 0;
}
}
if (hDown & KEY_DOWN) {
if (hDown & KEY_DDOWN) {
sndHighlight();
characterChangeMenu_cursorPosition++;
characterChangeMenu_cursorPositionOnScreen++;
Expand Down Expand Up @@ -730,7 +752,7 @@ void changeCharacter(void) {
}
} else {
if (showCursor) {
if ((hDown & KEY_UP) && (highlightedGame > 1)) {
if ((hDown & KEY_DUP) && (highlightedGame > 1)) {
sndHighlight();
characterList_cursorPosition--;
characterList_cursorPositionOnScreen--;
Expand All @@ -744,7 +766,7 @@ void changeCharacter(void) {
characterList_cursorPositionOnScreen = 0;
}
}
if ((hDown & KEY_DOWN) && (highlightedGame > 1)) {
if ((hDown & KEY_DDOWN) && (highlightedGame > 1)) {
sndHighlight();
characterList_cursorPosition++;
characterList_cursorPositionOnScreen++;
Expand Down
10 changes: 10 additions & 0 deletions source/gui.cpp
Expand Up @@ -34,6 +34,7 @@ C3D_RenderTarget* top;
C3D_RenderTarget* bottom;

static C2D_SpriteSheet sprites;
static C2D_SpriteSheet chracterSprite;
C2D_TextBuf sizeBuf;
C2D_Font systemFont;

Expand All @@ -49,6 +50,7 @@ Result Gui::init(void) {
bottom = C2D_CreateScreenTarget(GFX_BOTTOM, GFX_LEFT);
sizeBuf = C2D_TextBufNew(4096);
sprites = C2D_SpriteSheetLoad("romfs:/gfx/sprites.t3x");
//chracterSprite = C2D_SpriteSheetLoad("romfs:/gfx/sprites_otherchars_ss4.t3x");
systemFont = C2D_FontLoadSystem(CFG_REGION_USA);
return 0;
}
Expand Down Expand Up @@ -82,6 +84,14 @@ void Gui::spriteScale(int key, float x, float y, float scaleX, float scaleY) {
}
}

void Gui::charSprite(int key, float x, float y) {
if (key == sprites_res_null_idx) {
return;
} else { // standard case
C2D_DrawImageAt(C2D_SpriteSheetGetImage(chracterSprite, key), x, y, 0.5f);
}
}

void Gui::Draw_ImageBlend(int key, float x, float y, u32 color) {
C2D_ImageTint tint;
C2D_SetImageTint(&tint, C2D_TopLeft, color, 1);
Expand Down

0 comments on commit 8dadd1a

Please sign in to comment.