Add changing character shading for *Styling Star*

This commit is contained in:
RocketRobz 2023-02-21 12:54:11 -07:00
parent 9f13fddbb0
commit e9aa93e96f
7 changed files with 127 additions and 11 deletions

View File

@ -28,7 +28,7 @@ endif
#---------------------------------------------------------------------------------
VERSION_MAJOR := 3
VERSION_MINOR := 3
VERSION_MINOR := 4
VERSION_MICRO := 0
#---------------------------------------------------------------------------------
# TARGET is the name of the output

9
include/commonLut.hpp Normal file
View File

@ -0,0 +1,9 @@
#ifndef COMMONLUT_H
#define COMMONLUT_H
#include <3ds.h>
extern void loadCommonLut(int num);
#endif // COMMONLUT_H

View File

@ -89,6 +89,8 @@ private:
int importFromSave_cursorPosition = 0;
int importFromSave_cursorPositionOnScreen = 0;
int shadeChange_cursorPosition = 0;
int characterShownFirst = 0;
int import_characterShownFirst = 0;
int importFromSave_characterShownFirst = 0;

46
source/commonLut.cpp Normal file
View File

@ -0,0 +1,46 @@
#include <3ds.h>
#include <stdio.h>
#include <unistd.h> // access
#include "tonccpy.h"
extern u8 saveRegion[4];
char commonLutData[0x88F0];
void loadCommonLut(int num) {
const char* commonLutPath = "sdmc:/luma/titles/00040000001C2500/romfs/USA/Common/CommonLut.bch";
switch (saveRegion[3]) {
case CFG_REGION_EUR:
case CFG_REGION_AUS:
commonLutPath = "sdmc:/luma/titles/00040000001C2600/romfs/EUR/Common/CommonLut.bch";
break;
case CFG_REGION_JPN:
commonLutPath = "sdmc:/luma/titles/000400000019F600/romfs/JPN/Common/CommonLut.bch";
break;
}
const char* commonLutName = "";
switch (num) {
default:
remove(commonLutPath);
return;
case 1:
commonLutName = "No cel-shade";
break;
case 2:
commonLutName = "Fashion Dreamer";
break;
}
char commonLutSrc[80];
sprintf(commonLutSrc, "romfs:/character/Styling Star/CommonLut/%s.bch", commonLutName);
FILE* file = fopen(commonLutSrc, "rb");
fread(commonLutData, 1, (int)sizeof(commonLutData), file);
fclose(file);
file = fopen(commonLutPath, "wb");
fwrite(commonLutData, 1, (int)sizeof(commonLutData), file);
fclose(file);
}

View File

@ -2,6 +2,7 @@
#include "screenvars.h"
#include "whatToDo.hpp"
#include "commonLut.hpp"
#include "savedata.h"
#include "file_browse.h"
@ -629,7 +630,9 @@ void CharacterChange::drawMsg(void) const {
GFX::DrawSprite(sprites_msg_idx, 0, 8, 1, 1);
GFX::DrawSprite(sprites_msg_idx, 160, 8, -1, 1);
GFX::DrawSprite(messageNo == 4 ? sprites_icon_question_idx : sprites_icon_msg_idx, 132, -2);
if (messageNo == 6) {
if (messageNo == 7) {
Gui::DrawStringCentered(0, 94, 0.60, BLACK, "Shading has been applied.");
} else if (messageNo == 6) {
Gui::DrawStringCentered(0, 58, 0.60, BLACK, "Characters from the 1st, 2nd, and");
Gui::DrawStringCentered(0, 78, 0.60, BLACK, "4th games, will leave from the 3rd.");
Gui::DrawStringCentered(0, 104, 0.60, BLACK, "Characters part of downloaded");
@ -839,7 +842,22 @@ void CharacterChange::Draw(void) const {
}
cursorX = 248;
if (subScreenMode == 5) {
if (subScreenMode == 7) {
cursorY = 64+(48*shadeChange_cursorPosition);
Gui::DrawString(8, 8, 0.50, BLACK, "Select the shading to use for every character.");
int i2 = (highlightedGame == 3 ? 8 : 0);
i2 += 48;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Cel-shade (Original)");
i2 += 48;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "No cel-shade");
i2 += 48;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Fashion Dreamer");
} else if (subScreenMode == 5) {
cursorY = 64+(48*importWhereList_cursorPosition);
Gui::DrawString(8, 8, 0.50, BLACK, "Import from where?");
@ -981,8 +999,12 @@ void CharacterChange::Draw(void) const {
}
Gui::DrawString(292, 10, 0.50, currentCharPage==11 ? RED : (assistantChange ? HALF_BLACK : BLACK), "Ext.");
if (subScreenMode == 0 && highlightedGame == 2) {
Gui::DrawString(116, 210, 0.50, BLACK, ss3DLCharactersBackedUp ? "START: Remove contacts" : "START: Expand contacts");
if (subScreenMode == 0) {
if (highlightedGame == 3) {
Gui::DrawString(116, 210, 0.50, BLACK, "START: Change shading");
} else if (highlightedGame == 2) {
Gui::DrawString(116, 210, 0.50, BLACK, ss3DLCharactersBackedUp ? "START: Remove contacts" : "START: Expand contacts");
}
}
if (!displayNothing) {
@ -1270,6 +1292,38 @@ void CharacterChange::Logic(u32 hDown, u32 hDownRepeat, u32 hHeld, touchPosition
}
}
}
} else if (subScreenMode == 7) {
if (showCursor) {
if (hDown & KEY_DUP) {
sndHighlight();
shadeChange_cursorPosition--;
if (shadeChange_cursorPosition < 0) {
shadeChange_cursorPosition = 0;
}
}
if (hDown & KEY_DDOWN) {
sndHighlight();
shadeChange_cursorPosition++;
if (shadeChange_cursorPosition > 2) {
shadeChange_cursorPosition = 2;
}
}
}
if (hDown & KEY_A) {
sndSelect();
loadCommonLut(shadeChange_cursorPosition);
messageNo = 7;
showMessage = true;
subScreenMode = 0;
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
subScreenMode = 0;
}
} else if (subScreenMode == 6) {
if (showCursor) {
if ((hDownRepeat & KEY_DUP) && (importFromSave_highlightedGame > 1) && (importFromSave_characterPage[importFromSave_highlightedGame] > 0)) {
@ -2101,13 +2155,18 @@ void CharacterChange::Logic(u32 hDown, u32 hDownRepeat, u32 hHeld, touchPosition
}
}
if ((hDown & KEY_START) && (highlightedGame == 2)) {
sndSelect();
messageNo = ss3DLCharactersBackedUp ? 6 : 4;
if (!ss3DLCharactersBackedUp) {
peopleMetCount = false;
if (hDown & KEY_START) {
if (highlightedGame == 3) {
sndSelect();
subScreenMode = 7;
} else if (highlightedGame == 2) {
sndSelect();
messageNo = ss3DLCharactersBackedUp ? 6 : 4;
if (!ss3DLCharactersBackedUp) {
peopleMetCount = false;
}
showMessage = true;
}
showMessage = true;
}
}
}