Improvements to Custom Kaleido Menu (#5997)
* Use game over textures instead of save textures * Improves custom kaleido menu. Specifically: 1. Changes textures to the Game Over screen textures, which look the same but doesn't have "SAVE" at the top. 2. Adds a cursor on the left, doesn't currently do anything other than make it slightly clearer that you can move up and down and scroll, but opens the door for more menu-ing/toggling capabilities later. * Add fishing rod to kaleido menu * Adds skeleton key to kaleido menu with placeholder icon * More condensing of kaleido menu + add overworld keys * clang-format
This commit is contained in:
committed by
GitHub
parent
b649f5ed52
commit
280455db42
@@ -1,5 +1,7 @@
|
|||||||
#include "kaleido.h"
|
#include "kaleido.h"
|
||||||
|
|
||||||
|
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||||
|
#include "soh/Enhancements/randomizer/randomizerTypes.h"
|
||||||
#include "soh/frame_interpolation.h"
|
#include "soh/frame_interpolation.h"
|
||||||
#include "soh/ShipUtils.h"
|
#include "soh/ShipUtils.h"
|
||||||
|
|
||||||
@@ -45,7 +47,7 @@ void KaleidoEntryIcon::LoadIconTex(std::vector<Gfx>* mEntryDl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KaleidoEntry::KaleidoEntry(int16_t x, int16_t y, std::string text) : mX(x), mY(y), mText(std::move(text)) {
|
KaleidoEntry::KaleidoEntry(std::string text) : mText(std::move(text)) {
|
||||||
mHeight = 0;
|
mHeight = 0;
|
||||||
mWidth = 0;
|
mWidth = 0;
|
||||||
vtx = nullptr;
|
vtx = nullptr;
|
||||||
@@ -55,7 +57,12 @@ void KaleidoEntry::SetYOffset(int yOffset) {
|
|||||||
mY = yOffset;
|
mY = yOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KaleidoEntry::SetSelected(bool val) {
|
||||||
|
mSelected = val;
|
||||||
|
}
|
||||||
|
|
||||||
void KaleidoEntryIcon::Draw(PlayState* play, std::vector<Gfx>* mEntryDl) {
|
void KaleidoEntryIcon::Draw(PlayState* play, std::vector<Gfx>* mEntryDl) {
|
||||||
|
PauseContext* pauseCtx = &play->pauseCtx;
|
||||||
if (vtx == nullptr) {
|
if (vtx == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -74,13 +81,24 @@ void KaleidoEntryIcon::Draw(PlayState* play, std::vector<Gfx>* mEntryDl) {
|
|||||||
mEntryDl->push_back(gsSPMatrix(Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
mEntryDl->push_back(gsSPMatrix(Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
||||||
G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW));
|
G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW));
|
||||||
|
|
||||||
|
// cursor (if selected)
|
||||||
|
if (mSelected) {
|
||||||
|
mEntryDl->push_back(gsDPSetPrimColor(0, 0, 255, 255, 255, 255));
|
||||||
|
mEntryDl->push_back(gsSPVertex(vtx, 4, 0));
|
||||||
|
Gfx cursorIconTex[] = { gsDPLoadTextureBlock(gArrowCursorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 0,
|
||||||
|
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
|
||||||
|
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD) };
|
||||||
|
mEntryDl->insert(mEntryDl->end(), std::begin(cursorIconTex), std::end(cursorIconTex));
|
||||||
|
mEntryDl->push_back(gsSP1Quadrangle(0, 2, 3, 1, 0));
|
||||||
|
}
|
||||||
|
|
||||||
// icon
|
// icon
|
||||||
if (!mAchieved) {
|
if (!mAchieved) {
|
||||||
mEntryDl->push_back(gsDPSetGrayscaleColor(109, 109, 109, 255));
|
mEntryDl->push_back(gsDPSetGrayscaleColor(109, 109, 109, 255));
|
||||||
mEntryDl->push_back(gsSPGrayscale(true));
|
mEntryDl->push_back(gsSPGrayscale(true));
|
||||||
}
|
}
|
||||||
mEntryDl->push_back(gsDPSetPrimColor(0, 0, mIconColor.r, mIconColor.g, mIconColor.b, mIconColor.a));
|
mEntryDl->push_back(gsDPSetPrimColor(0, 0, mIconColor.r, mIconColor.g, mIconColor.b, mIconColor.a));
|
||||||
mEntryDl->push_back(gsSPVertex(vtx, 4, 0));
|
mEntryDl->push_back(gsSPVertex(&vtx[4], 4, 0));
|
||||||
LoadIconTex(mEntryDl);
|
LoadIconTex(mEntryDl);
|
||||||
mEntryDl->push_back(gsSP1Quadrangle(0, 2, 3, 1, 0));
|
mEntryDl->push_back(gsSP1Quadrangle(0, 2, 3, 1, 0));
|
||||||
mEntryDl->push_back(gsSPGrayscale(false));
|
mEntryDl->push_back(gsSPGrayscale(false));
|
||||||
@@ -90,10 +108,10 @@ void KaleidoEntryIcon::Draw(PlayState* play, std::vector<Gfx>* mEntryDl) {
|
|||||||
for (size_t i = 0, vtxGroup = 0; i < numChar; i++) {
|
for (size_t i = 0, vtxGroup = 0; i < numChar; i++) {
|
||||||
// A maximum of 64 Vtx can be loaded at once by gSPVertex, or basically 16 characters
|
// A maximum of 64 Vtx can be loaded at once by gSPVertex, or basically 16 characters
|
||||||
// handle loading groups of 16 chars at a time until there are no more left to load.
|
// handle loading groups of 16 chars at a time until there are no more left to load.
|
||||||
// By this point 4 vertices have already been loaded for the preceding icon.
|
// By this point 8 vertices have already been loaded for the preceding icon and cursor.
|
||||||
if (i % 16 == 0) {
|
if (i % 16 == 0) {
|
||||||
size_t numVtxToLoad = std::min<size_t>(numChar - i, 16) * 4;
|
size_t numVtxToLoad = std::min<size_t>(numChar - i, 16) * 4;
|
||||||
mEntryDl->push_back(gsSPVertex(&vtx[4 + (vtxGroup * 16 * 4)], numVtxToLoad, 0));
|
mEntryDl->push_back(gsSPVertex(&vtx[8 + (vtxGroup * 16 * 4)], numVtxToLoad, 0));
|
||||||
vtxGroup++;
|
vtxGroup++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,22 +129,29 @@ void KaleidoEntryIcon::Draw(PlayState* play, std::vector<Gfx>* mEntryDl) {
|
|||||||
|
|
||||||
Kaleido::Kaleido() {
|
Kaleido::Kaleido() {
|
||||||
const auto ctx = Rando::Context::GetInstance();
|
const auto ctx = Rando::Context::GetInstance();
|
||||||
int yOffset = 2;
|
int yOffset = 0;
|
||||||
mEntries.push_back(std::make_shared<KaleidoEntryIconFlag>(
|
mEntries.push_back(std::make_shared<KaleidoEntryIconFlag>(
|
||||||
gRupeeCounterIconTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, Color_RGBA8{ 0xC8, 0xFF, 0x64, 255 },
|
gRupeeCounterIconTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, Color_RGBA8{ 0xC8, 0xFF, 0x64, 255 },
|
||||||
FlagType::FLAG_RANDOMIZER_INF, static_cast<int>(RAND_INF_GREG_FOUND), 0, yOffset, "Greg"));
|
FlagType::FLAG_RANDOMIZER_INF, static_cast<int>(RAND_INF_GREG_FOUND), "Greg"));
|
||||||
yOffset += 18;
|
if (ctx->GetOption(RSK_SHUFFLE_FISHING_POLE)) {
|
||||||
|
mEntries.push_back(std::make_shared<KaleidoEntryIconFlag>(
|
||||||
|
gItemIconFishingPoleTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, Color_RGBA8{ 255, 255, 255, 255 },
|
||||||
|
FlagType::FLAG_RANDOMIZER_INF, static_cast<int>(RAND_INF_FISHING_POLE_FOUND), "Fishing Pole"));
|
||||||
|
}
|
||||||
if (ctx->GetOption(RSK_TRIFORCE_HUNT)) {
|
if (ctx->GetOption(RSK_TRIFORCE_HUNT)) {
|
||||||
mEntries.push_back(std::make_shared<KaleidoEntryIconCountRequired>(
|
mEntries.push_back(std::make_shared<KaleidoEntryIconCountRequired>(
|
||||||
gTriforcePieceTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, Color_RGBA8{ 255, 255, 255, 255 }, 0, yOffset,
|
gTriforcePieceTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, Color_RGBA8{ 255, 255, 255, 255 },
|
||||||
reinterpret_cast<int*>(&gSaveContext.ship.quest.data.randomizer.triforcePiecesCollected),
|
reinterpret_cast<int*>(&gSaveContext.ship.quest.data.randomizer.triforcePiecesCollected),
|
||||||
ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_REQUIRED).Get() + 1,
|
ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_REQUIRED).Get() + 1,
|
||||||
ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_TOTAL).Get() + 1));
|
ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_TOTAL).Get() + 1));
|
||||||
yOffset += 18;
|
}
|
||||||
|
if (ctx->GetOption(RSK_SKELETON_KEY)) {
|
||||||
|
mEntries.push_back(std::make_shared<KaleidoEntryIconFlag>(
|
||||||
|
gSmallKeyCounterIconTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, Color_RGBA8{ 255, 255, 255, 255 },
|
||||||
|
FlagType::FLAG_RANDOMIZER_INF, static_cast<int>(RAND_INF_HAS_SKELETON_KEY), "Skeleton Key"));
|
||||||
}
|
}
|
||||||
if (ctx->GetOption(RSK_SHUFFLE_OCARINA_BUTTONS)) {
|
if (ctx->GetOption(RSK_SHUFFLE_OCARINA_BUTTONS)) {
|
||||||
mEntries.push_back(std::make_shared<KaleidoEntryOcarinaButtons>(0, yOffset));
|
mEntries.push_back(std::make_shared<KaleidoEntryOcarinaButtons>());
|
||||||
yOffset += 18;
|
|
||||||
}
|
}
|
||||||
if (ctx->GetOption(RSK_SHUFFLE_BOSS_SOULS).IsNot(RO_BOSS_SOULS_OFF)) {
|
if (ctx->GetOption(RSK_SHUFFLE_BOSS_SOULS).IsNot(RO_BOSS_SOULS_OFF)) {
|
||||||
static const char* bossSoulNames[] = {
|
static const char* bossSoulNames[] = {
|
||||||
@@ -136,15 +161,22 @@ Kaleido::Kaleido() {
|
|||||||
for (int i = RAND_INF_GOHMA_SOUL; i < RAND_INF_GANON_SOUL; i++) {
|
for (int i = RAND_INF_GOHMA_SOUL; i < RAND_INF_GANON_SOUL; i++) {
|
||||||
mEntries.push_back(std::make_shared<KaleidoEntryIconFlag>(
|
mEntries.push_back(std::make_shared<KaleidoEntryIconFlag>(
|
||||||
gBossSoulTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, Color_RGBA8{ 255, 255, 255, 255 },
|
gBossSoulTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, Color_RGBA8{ 255, 255, 255, 255 },
|
||||||
FlagType::FLAG_RANDOMIZER_INF, i, 0, yOffset, bossSoulNames[i - RAND_INF_GOHMA_SOUL]));
|
FlagType::FLAG_RANDOMIZER_INF, i, bossSoulNames[i - RAND_INF_GOHMA_SOUL]));
|
||||||
yOffset += 18;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ctx->GetOption(RSK_SHUFFLE_BOSS_SOULS).Is(RO_BOSS_SOULS_ON_PLUS_GANON)) {
|
if (ctx->GetOption(RSK_SHUFFLE_BOSS_SOULS).Is(RO_BOSS_SOULS_ON_PLUS_GANON)) {
|
||||||
mEntries.push_back(std::make_shared<KaleidoEntryIconFlag>(
|
mEntries.push_back(std::make_shared<KaleidoEntryIconFlag>(
|
||||||
gBossSoulTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, Color_RGBA8{ 255, 255, 255, 255 },
|
gBossSoulTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, Color_RGBA8{ 255, 255, 255, 255 },
|
||||||
FlagType::FLAG_RANDOMIZER_INF, RAND_INF_GANON_SOUL, 0, yOffset, "Ganon's Soul"));
|
FlagType::FLAG_RANDOMIZER_INF, RAND_INF_GANON_SOUL, "Ganon's Soul"));
|
||||||
yOffset += 18;
|
}
|
||||||
|
if (ctx->GetOption(RSK_LOCK_OVERWORLD_DOORS)) {
|
||||||
|
int rg = RG_GUARD_HOUSE_KEY;
|
||||||
|
for (int i = RAND_INF_GUARD_HOUSE_KEY_OBTAINED; i <= RAND_INF_FISHING_HOLE_KEY_OBTAINED; i += 2, rg++) {
|
||||||
|
mEntries.push_back(std::make_shared<KaleidoEntryIconFlag>(
|
||||||
|
gSmallKeyCounterIconTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, Color_RGBA8{ 255, 255, 255, 255 },
|
||||||
|
FlagType::FLAG_RANDOMIZER_INF, i,
|
||||||
|
Rando::StaticData::RetrieveItem(static_cast<RandomizerGet>(rg)).GetName().english));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,6 +194,7 @@ void Kaleido::Draw(PlayState* play) {
|
|||||||
mEntryDl.clear();
|
mEntryDl.clear();
|
||||||
OPEN_DISPS(play->state.gfxCtx);
|
OPEN_DISPS(play->state.gfxCtx);
|
||||||
mEntryDl.push_back(gsDPPipeSync());
|
mEntryDl.push_back(gsDPPipeSync());
|
||||||
|
Gfx_SetupDL_39Opa(play->state.gfxCtx);
|
||||||
Gfx_SetupDL_42Opa(play->state.gfxCtx);
|
Gfx_SetupDL_42Opa(play->state.gfxCtx);
|
||||||
mEntryDl.push_back(gsDPSetCombineMode(G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM));
|
mEntryDl.push_back(gsDPSetCombineMode(G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM));
|
||||||
|
|
||||||
@@ -179,13 +212,23 @@ void Kaleido::Draw(PlayState* play) {
|
|||||||
if (!((pauseCtx->state != 6) || ((pauseCtx->stickRelX == 0) && (pauseCtx->stickRelY == 0)))) {
|
if (!((pauseCtx->state != 6) || ((pauseCtx->stickRelX == 0) && (pauseCtx->stickRelY == 0)))) {
|
||||||
if (pauseCtx->cursorSpecialPos == 0) {
|
if (pauseCtx->cursorSpecialPos == 0) {
|
||||||
if ((pauseCtx->stickRelY > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DUP))) {
|
if ((pauseCtx->stickRelY > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DUP))) {
|
||||||
if (mTopIndex > 0) {
|
if (mCursorPos > 0) {
|
||||||
mTopIndex--;
|
mCursorPos--;
|
||||||
|
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||||
|
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||||
|
}
|
||||||
|
if (mCursorPos < mTopIndex) {
|
||||||
|
mTopIndex = mCursorPos;
|
||||||
shouldScroll = true;
|
shouldScroll = true;
|
||||||
}
|
}
|
||||||
} else if ((pauseCtx->stickRelY < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DDOWN))) {
|
} else if ((pauseCtx->stickRelY < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DDOWN))) {
|
||||||
if (mTopIndex + mNumVisible < mEntries.size()) {
|
if (mCursorPos < mEntries.size() - 1) {
|
||||||
mTopIndex++;
|
mCursorPos++;
|
||||||
|
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||||
|
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||||
|
}
|
||||||
|
if (mCursorPos >= mTopIndex + mNumVisible && mTopIndex + mNumVisible < mEntries.size()) {
|
||||||
|
mTopIndex = mCursorPos - mNumVisible + 1;
|
||||||
shouldScroll = true;
|
shouldScroll = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -213,16 +256,14 @@ void Kaleido::Draw(PlayState* play) {
|
|||||||
pauseCtx->cursorSpecialPos = 0;
|
pauseCtx->cursorSpecialPos = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int yOffset = 2;
|
int yOffset = 1;
|
||||||
for (int i = mTopIndex; i < (mTopIndex + mNumVisible) && i < mEntries.size(); i++) {
|
for (int i = mTopIndex; i < (mTopIndex + mNumVisible) && i < mEntries.size(); i++) {
|
||||||
auto& entry = mEntries[i];
|
auto& entry = mEntries[i];
|
||||||
if (shouldScroll) {
|
|
||||||
entry->SetYOffset(yOffset);
|
entry->SetYOffset(yOffset);
|
||||||
yOffset += 18;
|
yOffset += 9;
|
||||||
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
|
||||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
|
||||||
}
|
|
||||||
Matrix_Push();
|
Matrix_Push();
|
||||||
|
entry->SetSelected((i == mCursorPos) && !(pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT ||
|
||||||
|
pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT));
|
||||||
entry->Draw(play, &mEntryDl);
|
entry->Draw(play, &mEntryDl);
|
||||||
Matrix_Pop();
|
Matrix_Pop();
|
||||||
}
|
}
|
||||||
@@ -252,9 +293,9 @@ extern "C" void RandoKaleido_UpdateMiscCollectibles(int16_t inDungeonScene) {
|
|||||||
|
|
||||||
KaleidoEntryIconFlag::KaleidoEntryIconFlag(const char* iconResourceName, int iconFormat, int iconSize, int iconWidth,
|
KaleidoEntryIconFlag::KaleidoEntryIconFlag(const char* iconResourceName, int iconFormat, int iconSize, int iconWidth,
|
||||||
int iconHeight, Color_RGBA8 iconColor, FlagType flagType, int flag,
|
int iconHeight, Color_RGBA8 iconColor, FlagType flagType, int flag,
|
||||||
int16_t x, int16_t y, std::string name)
|
std::string name)
|
||||||
: mFlagType(flagType), mFlag(flag), KaleidoEntryIcon(iconResourceName, iconFormat, iconSize, iconWidth, iconHeight,
|
: mFlagType(flagType), mFlag(flag),
|
||||||
iconColor, x, y, std::move(name)) {
|
KaleidoEntryIcon(iconResourceName, iconFormat, iconSize, iconWidth, iconHeight, iconColor, std::move(name)) {
|
||||||
BuildVertices();
|
BuildVertices();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,9 +305,9 @@ void KaleidoEntryIconFlag::Update(PlayState* play) {
|
|||||||
|
|
||||||
KaleidoEntryIconCountRequired::KaleidoEntryIconCountRequired(const char* iconResourceName, int iconFormat, int iconSize,
|
KaleidoEntryIconCountRequired::KaleidoEntryIconCountRequired(const char* iconResourceName, int iconFormat, int iconSize,
|
||||||
int iconWidth, int iconHeight, Color_RGBA8 iconColor,
|
int iconWidth, int iconHeight, Color_RGBA8 iconColor,
|
||||||
int16_t x, int16_t y, int* watch, int required, int total)
|
int* watch, int required, int total)
|
||||||
: mWatch(watch), mRequired(required), mTotal(total),
|
: mWatch(watch), mRequired(required), mTotal(total),
|
||||||
KaleidoEntryIcon(iconResourceName, iconFormat, iconSize, iconWidth, iconHeight, iconColor, x, y) {
|
KaleidoEntryIcon(iconResourceName, iconFormat, iconSize, iconWidth, iconHeight, iconColor) {
|
||||||
mCount = *mWatch;
|
mCount = *mWatch;
|
||||||
BuildText();
|
BuildText();
|
||||||
BuildVertices();
|
BuildVertices();
|
||||||
@@ -287,31 +328,54 @@ void KaleidoEntryIconCountRequired::BuildText() {
|
|||||||
void KaleidoEntryIcon::BuildVertices() {
|
void KaleidoEntryIcon::BuildVertices() {
|
||||||
int offsetY = 0;
|
int offsetY = 0;
|
||||||
int offsetX = 0;
|
int offsetX = 0;
|
||||||
// 4 vertices per character, plus one for the preceding icon.
|
// 4 vertices per character, plus one for the preceding icon, plus one for the cursor.
|
||||||
Vtx* vertices = (Vtx*)calloc(sizeof(Vtx[4]), mText.length() + 1);
|
Vtx* vertices = (Vtx*)calloc(sizeof(Vtx[4]), mText.length() + 2);
|
||||||
|
// Vertex for the cursor.
|
||||||
|
Ship_CreateQuadVertexGroup(vertices, offsetX, offsetY, 16, 24, 0);
|
||||||
|
offsetX += 18;
|
||||||
// Vertex for the preceding icon.
|
// Vertex for the preceding icon.
|
||||||
Ship_CreateQuadVertexGroup(vertices, offsetX, offsetY, mIconWidth, mIconHeight, 0);
|
Ship_CreateQuadVertexGroup(&vertices[4], offsetX, offsetY, mIconWidth, mIconHeight, 0);
|
||||||
offsetX += 18;
|
offsetX += 18;
|
||||||
for (size_t i = 0; i < mText.length(); i++) {
|
for (size_t i = 0; i < mText.length(); i++) {
|
||||||
int charWidth = static_cast<int>(Ship_GetCharFontWidth(mText[i]));
|
int charWidth = static_cast<int>(Ship_GetCharFontWidth(mText[i]));
|
||||||
Ship_CreateQuadVertexGroup(&(vertices)[(i + 1) * 4], offsetX, offsetY, charWidth, 16, 0);
|
Ship_CreateQuadVertexGroup(&(vertices)[((i + 1) * 4) + 4], offsetX, offsetY, charWidth, 16, 0);
|
||||||
offsetX += charWidth;
|
offsetX += charWidth;
|
||||||
}
|
}
|
||||||
offsetY += FONT_CHAR_TEX_HEIGHT;
|
offsetY += FONT_CHAR_TEX_HEIGHT;
|
||||||
mWidth = static_cast<int16_t>(offsetX);
|
// mWidth = static_cast<int16_t>(offsetX);
|
||||||
mHeight = static_cast<int16_t>(offsetY);
|
// mHeight = static_cast<int16_t>(offsetY);
|
||||||
|
|
||||||
|
vertices[1].v.ob[0] = 15; // top-right x
|
||||||
|
vertices[2].v.ob[1] = 15; // bottom-left y
|
||||||
|
vertices[3].v.ob[0] = 15; // bottom-right x
|
||||||
|
vertices[3].v.ob[1] = 15; // bottom-right y
|
||||||
|
vertices[5].v.ob[0] = 32; // top-right x
|
||||||
|
vertices[6].v.ob[1] = 16; // bottom-left-y
|
||||||
|
vertices[7].v.ob[0] = 32; // bottom-right x
|
||||||
|
vertices[7].v.ob[1] = 16; // bottom-right y
|
||||||
|
|
||||||
|
for (size_t i = 0; i < mText.length() + 2; i++) {
|
||||||
|
size_t j = i * 4;
|
||||||
|
vertices[j].v.ob[0] = vertices[j].v.ob[0] / 2;
|
||||||
|
vertices[j].v.ob[1] = vertices[j].v.ob[1] / 2;
|
||||||
|
vertices[j + 1].v.ob[0] = vertices[j + 1].v.ob[0] / 2;
|
||||||
|
vertices[j + 1].v.ob[1] = vertices[j + 1].v.ob[1] / 2;
|
||||||
|
vertices[j + 2].v.ob[0] = vertices[j + 2].v.ob[0] / 2;
|
||||||
|
vertices[j + 2].v.ob[1] = vertices[j + 2].v.ob[1] / 2;
|
||||||
|
vertices[j + 3].v.ob[0] = vertices[j + 3].v.ob[0] / 2;
|
||||||
|
vertices[j + 3].v.ob[1] = vertices[j + 3].v.ob[1] / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
mWidth = static_cast<int16_t>(offsetX / 2);
|
||||||
|
mHeight = static_cast<int16_t>(8);
|
||||||
|
|
||||||
vertices[1].v.ob[0] = 16;
|
|
||||||
vertices[2].v.ob[1] = 16;
|
|
||||||
vertices[3].v.ob[0] = 16;
|
|
||||||
vertices[3].v.ob[1] = 16;
|
|
||||||
vtx = vertices;
|
vtx = vertices;
|
||||||
}
|
}
|
||||||
|
|
||||||
KaleidoEntryIcon::KaleidoEntryIcon(const char* iconResourceName, int iconFormat, int iconSize, int iconWidth,
|
KaleidoEntryIcon::KaleidoEntryIcon(const char* iconResourceName, int iconFormat, int iconSize, int iconWidth,
|
||||||
int iconHeight, Color_RGBA8 iconColor, int16_t x, int16_t y, std::string text)
|
int iconHeight, Color_RGBA8 iconColor, std::string text)
|
||||||
: mIconResourceName(iconResourceName), mIconFormat(iconFormat), mIconSize(iconSize), mIconWidth(iconWidth),
|
: mIconResourceName(iconResourceName), mIconFormat(iconFormat), mIconSize(iconSize), mIconWidth(iconWidth),
|
||||||
mIconHeight(iconHeight), mIconColor(iconColor), KaleidoEntry(x, y, std::move(text)) {
|
mIconHeight(iconHeight), mIconColor(iconColor), KaleidoEntry(std::move(text)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void KaleidoEntryIcon::RebuildVertices() {
|
void KaleidoEntryIcon::RebuildVertices() {
|
||||||
@@ -329,9 +393,9 @@ void KaleidoEntryIconCountRequired::Update(PlayState* play) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KaleidoEntryOcarinaButtons::KaleidoEntryOcarinaButtons(int16_t x, int16_t y)
|
KaleidoEntryOcarinaButtons::KaleidoEntryOcarinaButtons()
|
||||||
: KaleidoEntryIcon(gItemIconOcarinaOfTimeTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32,
|
: KaleidoEntryIcon(gItemIconOcarinaOfTimeTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32,
|
||||||
Color_RGBA8{ 255, 255, 255, 255 }, x, y, "\x9F\xA5\xA6\xA7\xA8") {
|
Color_RGBA8{ 255, 255, 255, 255 }, "\x9F\xA5\xA6\xA7\xA8") {
|
||||||
CalculateColors();
|
CalculateColors();
|
||||||
BuildVertices();
|
BuildVertices();
|
||||||
}
|
}
|
||||||
@@ -405,13 +469,24 @@ void KaleidoEntryOcarinaButtons::Draw(PlayState* play, std::vector<Gfx>* mEntryD
|
|||||||
mEntryDl->push_back(gsSPMatrix(Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
mEntryDl->push_back(gsSPMatrix(Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
||||||
G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW));
|
G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW));
|
||||||
|
|
||||||
|
// cursor (if selected)
|
||||||
|
if (mSelected) {
|
||||||
|
mEntryDl->push_back(gsDPSetPrimColor(0, 0, 255, 255, 255, 255));
|
||||||
|
mEntryDl->push_back(gsSPVertex(vtx, 4, 0));
|
||||||
|
Gfx cursorIconTex[] = { gsDPLoadTextureBlock(gArrowCursorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 0,
|
||||||
|
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
|
||||||
|
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD) };
|
||||||
|
mEntryDl->insert(mEntryDl->end(), std::begin(cursorIconTex), std::end(cursorIconTex));
|
||||||
|
mEntryDl->push_back(gsSP1Quadrangle(0, 2, 3, 1, 0));
|
||||||
|
}
|
||||||
|
|
||||||
// icon
|
// icon
|
||||||
if (!mAchieved) {
|
if (!mAchieved) {
|
||||||
mEntryDl->push_back(gsDPSetGrayscaleColor(109, 109, 109, 255));
|
mEntryDl->push_back(gsDPSetGrayscaleColor(109, 109, 109, 255));
|
||||||
mEntryDl->push_back(gsSPGrayscale(true));
|
mEntryDl->push_back(gsSPGrayscale(true));
|
||||||
}
|
}
|
||||||
mEntryDl->push_back(gsDPSetPrimColor(0, 0, mIconColor.r, mIconColor.g, mIconColor.b, mIconColor.a));
|
mEntryDl->push_back(gsDPSetPrimColor(0, 0, mIconColor.r, mIconColor.g, mIconColor.b, mIconColor.a));
|
||||||
mEntryDl->push_back(gsSPVertex(vtx, 4, 0));
|
mEntryDl->push_back(gsSPVertex(&vtx[4], 4, 0));
|
||||||
LoadIconTex(mEntryDl);
|
LoadIconTex(mEntryDl);
|
||||||
mEntryDl->push_back(gsSP1Quadrangle(0, 2, 3, 1, 0));
|
mEntryDl->push_back(gsSP1Quadrangle(0, 2, 3, 1, 0));
|
||||||
mEntryDl->push_back(gsSPGrayscale(false));
|
mEntryDl->push_back(gsSPGrayscale(false));
|
||||||
@@ -426,7 +501,7 @@ void KaleidoEntryOcarinaButtons::Draw(PlayState* play, std::vector<Gfx>* mEntryD
|
|||||||
// By this point 4 vertices have already been loaded for the preceding icon.
|
// By this point 4 vertices have already been loaded for the preceding icon.
|
||||||
if (i % 16 == 0) {
|
if (i % 16 == 0) {
|
||||||
size_t numVtxToLoad = std::min<size_t>(numChar - i, 16) * 4;
|
size_t numVtxToLoad = std::min<size_t>(numChar - i, 16) * 4;
|
||||||
mEntryDl->push_back(gsSPVertex(&vtx[4 + (vtxGroup * 16 * 4)], numVtxToLoad, 0));
|
mEntryDl->push_back(gsSPVertex(&vtx[8 + (vtxGroup * 16 * 4)], numVtxToLoad, 0));
|
||||||
vtxGroup++;
|
vtxGroup++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,18 +26,20 @@ class KaleidoEntry {
|
|||||||
* @param text the initial value of the line of text. Can be omitted for an
|
* @param text the initial value of the line of text. Can be omitted for an
|
||||||
* empty string.
|
* empty string.
|
||||||
*/
|
*/
|
||||||
KaleidoEntry(int16_t x, int16_t y, std::string text = "");
|
KaleidoEntry(std::string text = "");
|
||||||
virtual void Draw(PlayState* play, std::vector<Gfx>* mEntryDl) = 0;
|
virtual void Draw(PlayState* play, std::vector<Gfx>* mEntryDl) = 0;
|
||||||
virtual void Update(PlayState* play) = 0;
|
virtual void Update(PlayState* play) = 0;
|
||||||
void SetYOffset(int yOffset);
|
void SetYOffset(int yOffset);
|
||||||
|
void SetSelected(bool val);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int16_t mX;
|
int16_t mX = 0;
|
||||||
int16_t mY;
|
int16_t mY = 0;
|
||||||
int16_t mHeight;
|
int16_t mHeight;
|
||||||
int16_t mWidth;
|
int16_t mWidth;
|
||||||
Vtx* vtx;
|
Vtx* vtx;
|
||||||
std::string mText;
|
std::string mText;
|
||||||
|
bool mSelected = false;
|
||||||
bool mAchieved = false;
|
bool mAchieved = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -59,7 +61,7 @@ class KaleidoEntryIcon : public KaleidoEntry {
|
|||||||
* @param text text to draw to the right of the icon.
|
* @param text text to draw to the right of the icon.
|
||||||
*/
|
*/
|
||||||
KaleidoEntryIcon(const char* iconResourceName, int iconFormat, int iconSize, int iconWidth, int iconHeight,
|
KaleidoEntryIcon(const char* iconResourceName, int iconFormat, int iconSize, int iconWidth, int iconHeight,
|
||||||
Color_RGBA8 iconColor, int16_t x, int16_t y, std::string text = "");
|
Color_RGBA8 iconColor, std::string text = "");
|
||||||
void Draw(PlayState* play, std::vector<Gfx>* mEntryDl) override;
|
void Draw(PlayState* play, std::vector<Gfx>* mEntryDl) override;
|
||||||
void RebuildVertices();
|
void RebuildVertices();
|
||||||
|
|
||||||
@@ -95,8 +97,7 @@ class KaleidoEntryIconFlag : public KaleidoEntryIcon {
|
|||||||
* @param mName name to draw to the right of the icon. Leave blank to omit.
|
* @param mName name to draw to the right of the icon. Leave blank to omit.
|
||||||
*/
|
*/
|
||||||
KaleidoEntryIconFlag(const char* iconResourceName, int iconFormat, int iconSize, int iconWidth, int iconHeight,
|
KaleidoEntryIconFlag(const char* iconResourceName, int iconFormat, int iconSize, int iconWidth, int iconHeight,
|
||||||
Color_RGBA8 iconColor, FlagType flagType, int flag, int16_t x, int16_t y,
|
Color_RGBA8 iconColor, FlagType flagType, int flag, std::string name = "");
|
||||||
std::string name = "");
|
|
||||||
void Update(PlayState* play) override;
|
void Update(PlayState* play) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -128,8 +129,7 @@ class KaleidoEntryIconCountRequired : public KaleidoEntryIcon {
|
|||||||
* @param total The amount of this collectible available in the seed. Set to 0 to not render.
|
* @param total The amount of this collectible available in the seed. Set to 0 to not render.
|
||||||
*/
|
*/
|
||||||
KaleidoEntryIconCountRequired(const char* iconResourceName, int iconFormat, int iconSize, int iconWidth,
|
KaleidoEntryIconCountRequired(const char* iconResourceName, int iconFormat, int iconSize, int iconWidth,
|
||||||
int iconHeight, Color_RGBA8 iconColor, int16_t x, int16_t y, int* watch,
|
int iconHeight, Color_RGBA8 iconColor, int* watch, int required = 0, int total = 0);
|
||||||
int required = 0, int total = 0);
|
|
||||||
void Update(PlayState* play) override;
|
void Update(PlayState* play) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -143,7 +143,7 @@ class KaleidoEntryIconCountRequired : public KaleidoEntryIcon {
|
|||||||
|
|
||||||
class KaleidoEntryOcarinaButtons : public KaleidoEntryIcon {
|
class KaleidoEntryOcarinaButtons : public KaleidoEntryIcon {
|
||||||
public:
|
public:
|
||||||
KaleidoEntryOcarinaButtons(int16_t x, int16_t y);
|
KaleidoEntryOcarinaButtons();
|
||||||
void Update(PlayState* play) override;
|
void Update(PlayState* play) override;
|
||||||
void Draw(PlayState* play, std::vector<Gfx>* mEntryDl) override;
|
void Draw(PlayState* play, std::vector<Gfx>* mEntryDl) override;
|
||||||
|
|
||||||
@@ -164,7 +164,8 @@ class Kaleido {
|
|||||||
std::vector<std::shared_ptr<KaleidoEntry>> mEntries;
|
std::vector<std::shared_ptr<KaleidoEntry>> mEntries;
|
||||||
std::vector<Gfx> mEntryDl;
|
std::vector<Gfx> mEntryDl;
|
||||||
int mTopIndex = 0;
|
int mTopIndex = 0;
|
||||||
int mNumVisible = 7;
|
int mCursorPos = 0;
|
||||||
|
int mNumVisible = 14;
|
||||||
};
|
};
|
||||||
} // namespace Rando
|
} // namespace Rando
|
||||||
|
|
||||||
|
|||||||
@@ -1633,8 +1633,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
|
|||||||
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||||
|
|
||||||
if (pauseCtx->randoQuestMode) {
|
if (pauseCtx->randoQuestMode) {
|
||||||
POLY_OPA_DISP =
|
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->saveVtx, sGameOverTexs);
|
||||||
KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->saveVtx, sSaveTexs[gSaveContext.language]);
|
|
||||||
RandoKaleido_DrawMiscCollectibles(play);
|
RandoKaleido_DrawMiscCollectibles(play);
|
||||||
} else {
|
} else {
|
||||||
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->questPageVtx,
|
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->questPageVtx,
|
||||||
@@ -1729,8 +1728,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
|
|||||||
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||||
|
|
||||||
if (pauseCtx->randoQuestMode) {
|
if (pauseCtx->randoQuestMode) {
|
||||||
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->saveVtx,
|
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->saveVtx, sGameOverTexs);
|
||||||
sSaveTexs[gSaveContext.language]);
|
|
||||||
RandoKaleido_DrawMiscCollectibles(play);
|
RandoKaleido_DrawMiscCollectibles(play);
|
||||||
} else {
|
} else {
|
||||||
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->questPageVtx,
|
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->questPageVtx,
|
||||||
|
|||||||
Reference in New Issue
Block a user