From 8dadd1ad8f72b1b911de8aa999116a5f059aaf1d Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Tue, 24 Dec 2019 20:40:47 -0700 Subject: [PATCH] Bug fix ALSO: Zoom in camera using circle pad, in character menu --- include/gui.hpp | 1 + romfs/character/Styling Star/Fall/Robz.chr | Bin 62 -> 62 bytes romfs/character/Styling Star/Spring/Robz.chr | Bin 62 -> 62 bytes source/charchange.cpp | 72 ++++++++++++------- source/gui.cpp | 10 +++ 5 files changed, 58 insertions(+), 25 deletions(-) diff --git a/include/gui.hpp b/include/gui.hpp index 347c5de..fe8b012 100644 --- a/include/gui.hpp +++ b/include/gui.hpp @@ -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); } diff --git a/romfs/character/Styling Star/Fall/Robz.chr b/romfs/character/Styling Star/Fall/Robz.chr index 9ee77b8f0d9192d19c738c4b73fd52112a8d567f..a3da312fd1e555af66c2983f944434727ca2a6e9 100644 GIT binary patch delta 24 ZcmcDsV`gMxoXD)p#~CwUSlyEW3IHpa0@?ro delta 24 ZcmcDsV`gMxp2)1r*QYaISlyEW3IH&b12F&q diff --git a/romfs/character/Styling Star/Spring/Robz.chr b/romfs/character/Styling Star/Spring/Robz.chr index 47319386d38ae515ac781a04d4e873d78af6d2ac..6941cf9f68853e224af751e1523ff4aa35b050f5 100644 GIT binary patch delta 24 ZcmcDsV`gMxoXD)p#~CwUSlyEW3IHpa0@?ro delta 24 ZcmcDsV`gMxp2)1r*QYaISlyEW3IH&b12F&q diff --git a/source/charchange.cpp b/source/charchange.cpp index 19e03a5..56917fe 100644 --- a/source/charchange.cpp +++ b/source/charchange.cpp @@ -87,6 +87,8 @@ extern void drawCursor(void); extern u32 hDown; +static int zoomIn = 0; + static int cheatKeys[10] = {0}; static int cheatKeyPosition = 0; @@ -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"); @@ -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) { @@ -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++) { @@ -484,7 +506,7 @@ void changeCharacter(void) { cheatKeyPosition = 0; } if (showCursor) { - if (hDown & KEY_UP) { + if (hDown & KEY_DUP) { sndHighlight(); importCharacterList_cursorPosition--; importCharacterList_cursorPositionOnScreen--; @@ -498,7 +520,7 @@ void changeCharacter(void) { importCharacterList_cursorPositionOnScreen = 0; } } - if (hDown & KEY_DOWN) { + if (hDown & KEY_DDOWN) { sndHighlight(); importCharacterList_cursorPosition++; importCharacterList_cursorPositionOnScreen++; @@ -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; @@ -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; @@ -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--; @@ -678,7 +700,7 @@ void changeCharacter(void) { characterChangeMenu_cursorPositionOnScreen = 0; } } - if (hDown & KEY_DOWN) { + if (hDown & KEY_DDOWN) { sndHighlight(); characterChangeMenu_cursorPosition++; characterChangeMenu_cursorPositionOnScreen++; @@ -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--; @@ -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++; diff --git a/source/gui.cpp b/source/gui.cpp index fcbc65b..8360a88 100644 --- a/source/gui.cpp +++ b/source/gui.cpp @@ -34,6 +34,7 @@ C3D_RenderTarget* top; C3D_RenderTarget* bottom; static C2D_SpriteSheet sprites; +static C2D_SpriteSheet chracterSprite; C2D_TextBuf sizeBuf; C2D_Font systemFont; @@ -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; } @@ -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);