mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-07-13 16:43:11 -07:00
Move some boss rush stuff from z_file_choose.c
This commit is contained in:
parent
39b7f3af21
commit
b529bb93c9
4 changed files with 186 additions and 166 deletions
|
@ -1522,7 +1522,7 @@ typedef struct {
|
|||
/* 0x34 */ s32 isEnabled;
|
||||
} StickDirectionPrompt;
|
||||
|
||||
typedef struct {
|
||||
typedef struct FileChooseContext {
|
||||
/* 0x00000 */ GameState state;
|
||||
/* 0x000A4 */ Vtx* windowVtx;
|
||||
/* 0x000A8 */ u8* staticSegment;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
#include "soh_assets.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
@ -14,12 +16,17 @@ extern "C" {
|
|||
#include "src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h"
|
||||
#include "src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h"
|
||||
#include "src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h"
|
||||
extern PlayState* gPlayState;
|
||||
|
||||
Gfx* KaleidoScope_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, u16 point);
|
||||
#include "src/overlays/gamestates/ovl_file_choose/file_choose.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
#include "textures/icon_item_nes_static/icon_item_nes_static.h"
|
||||
#include "textures/icon_item_ger_static/icon_item_ger_static.h"
|
||||
#include "textures/icon_item_fra_static/icon_item_fra_static.h"
|
||||
|
||||
extern PlayState* gPlayState;
|
||||
|
||||
Gfx* KaleidoScope_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, u16 point);
|
||||
void FileChoose_UpdateStickDirectionPromptAnim(GameState* thisx);
|
||||
void FileChoose_DrawTextRec(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a, f32 x, f32 y, f32 z, s32 s, s32 t, f32 dx, f32 dy);
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
|
@ -181,6 +188,174 @@ u8 BossRush_GetSettingOptionsAmount(u8 optionIndex) {
|
|||
return static_cast<u8>(BossRushOptions[optionIndex].choices.size());
|
||||
}
|
||||
|
||||
void FileChoose_UpdateBossRushMenu(GameState* gameState) {
|
||||
static s8 sLastBossRushOptionIndex = -1;
|
||||
static s8 sLastBossRushOptionValue = -1;
|
||||
|
||||
FileChoose_UpdateStickDirectionPromptAnim(gameState);
|
||||
FileChooseContext* fileChooseContext = (FileChooseContext*)gameState;
|
||||
Input* input = &fileChooseContext->state.input[0];
|
||||
bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0);
|
||||
|
||||
// Fade in elements after opening Boss Rush options menu
|
||||
fileChooseContext->bossRushUIAlpha += 25;
|
||||
if (fileChooseContext->bossRushUIAlpha > 255) {
|
||||
fileChooseContext->bossRushUIAlpha = 255;
|
||||
}
|
||||
|
||||
// Animate up/down arrows.
|
||||
fileChooseContext->bossRushArrowOffset += 1;
|
||||
if (fileChooseContext->bossRushArrowOffset >= 30) {
|
||||
fileChooseContext->bossRushArrowOffset = 0;
|
||||
}
|
||||
|
||||
// Move menu selection up or down.
|
||||
if (ABS(fileChooseContext->stickRelY) > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN | BTN_DUP))) {
|
||||
// Move down
|
||||
if (fileChooseContext->stickRelY < -30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN))) {
|
||||
// When selecting past the last option, cycle back to the first option.
|
||||
if ((fileChooseContext->bossRushIndex + 1) > BR_OPTIONS_MAX - 1) {
|
||||
fileChooseContext->bossRushIndex = 0;
|
||||
fileChooseContext->bossRushOffset = 0;
|
||||
} else {
|
||||
fileChooseContext->bossRushIndex++;
|
||||
// When last visible option is selected when moving down, offset the list down by one.
|
||||
if (fileChooseContext->bossRushIndex - fileChooseContext->bossRushOffset > BOSSRUSH_MAX_OPTIONS_ON_SCREEN - 1) {
|
||||
fileChooseContext->bossRushOffset++;
|
||||
}
|
||||
}
|
||||
} else if (fileChooseContext->stickRelY > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DUP))) {
|
||||
// When selecting past the first option, cycle back to the last option and offset the list to view it
|
||||
// properly.
|
||||
if ((fileChooseContext->bossRushIndex - 1) < 0) {
|
||||
fileChooseContext->bossRushIndex = BR_OPTIONS_MAX - 1;
|
||||
fileChooseContext->bossRushOffset = fileChooseContext->bossRushIndex - BOSSRUSH_MAX_OPTIONS_ON_SCREEN + 1;
|
||||
} else {
|
||||
// When first visible option is selected when moving up, offset the list up by one.
|
||||
if (fileChooseContext->bossRushIndex - fileChooseContext->bossRushOffset == 0) {
|
||||
fileChooseContext->bossRushOffset--;
|
||||
}
|
||||
fileChooseContext->bossRushIndex--;
|
||||
}
|
||||
}
|
||||
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
}
|
||||
|
||||
// Cycle through choices for currently selected option.
|
||||
if (ABS(fileChooseContext->stickRelX) > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DLEFT | BTN_DRIGHT))) {
|
||||
if (fileChooseContext->stickRelX > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DRIGHT))) {
|
||||
// If exceeding the amount of choices for the selected option, cycle back to the first.
|
||||
if ((gSaveContext.ship.quest.data.bossRush.options[fileChooseContext->bossRushIndex] + 1) ==
|
||||
BossRush_GetSettingOptionsAmount(fileChooseContext->bossRushIndex)) {
|
||||
gSaveContext.ship.quest.data.bossRush.options[fileChooseContext->bossRushIndex] = 0;
|
||||
} else {
|
||||
gSaveContext.ship.quest.data.bossRush.options[fileChooseContext->bossRushIndex]++;
|
||||
}
|
||||
} else if (fileChooseContext->stickRelX < -30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DLEFT))) {
|
||||
// If cycling back when already at the first choice for the selected option, cycle back to the last choice.
|
||||
if ((gSaveContext.ship.quest.data.bossRush.options[fileChooseContext->bossRushIndex] - 1) < 0) {
|
||||
gSaveContext.ship.quest.data.bossRush.options[fileChooseContext->bossRushIndex] =
|
||||
BossRush_GetSettingOptionsAmount(fileChooseContext->bossRushIndex) - 1;
|
||||
} else {
|
||||
gSaveContext.ship.quest.data.bossRush.options[fileChooseContext->bossRushIndex]--;
|
||||
}
|
||||
}
|
||||
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
}
|
||||
|
||||
if (sLastBossRushOptionIndex != fileChooseContext->bossRushIndex ||
|
||||
sLastBossRushOptionValue != gSaveContext.ship.quest.data.bossRush.options[fileChooseContext->bossRushIndex]) {
|
||||
GameInteractor_ExecuteOnUpdateFileBossRushOptionSelection(
|
||||
fileChooseContext->bossRushIndex, gSaveContext.ship.quest.data.bossRush.options[fileChooseContext->bossRushIndex]);
|
||||
sLastBossRushOptionIndex = fileChooseContext->bossRushIndex;
|
||||
sLastBossRushOptionValue = gSaveContext.ship.quest.data.bossRush.options[fileChooseContext->bossRushIndex];
|
||||
}
|
||||
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
|
||||
fileChooseContext->configMode = CM_BOSS_RUSH_TO_QUEST;
|
||||
return;
|
||||
}
|
||||
|
||||
// Load into the game.
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_A)) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
fileChooseContext->buttonIndex = 0xFE;
|
||||
fileChooseContext->menuMode = FS_MENU_MODE_SELECT;
|
||||
fileChooseContext->selectMode = SM_FADE_OUT;
|
||||
fileChooseContext->prevConfigMode = fileChooseContext->configMode;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void FileChoose_DrawBossRushMenuWindowContents(FileChooseContext* fileChooseContext) {
|
||||
OPEN_DISPS(fileChooseContext->state.gfxCtx);
|
||||
|
||||
uint8_t language = (gSaveContext.language == LANGUAGE_JPN) ? LANGUAGE_ENG : gSaveContext.language;
|
||||
uint8_t listOffset = fileChooseContext->bossRushOffset;
|
||||
uint8_t textAlpha = fileChooseContext->bossRushUIAlpha;
|
||||
|
||||
// Draw arrows to indicate that the list can scroll up or down.
|
||||
// Arrow up
|
||||
if (listOffset > 0) {
|
||||
uint16_t arrowUpX = 140;
|
||||
uint16_t arrowUpY = 76 - (fileChooseContext->bossRushArrowOffset / 10);
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, gArrowUpTex, G_IM_FMT_IA, G_IM_SIZ_16b, 16, 16, 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);
|
||||
gSPWideTextureRectangle(POLY_OPA_DISP++, arrowUpX << 2, arrowUpY << 2, (arrowUpX + 8) << 2,
|
||||
(arrowUpY + 8) << 2, G_TX_RENDERTILE, 0, 0, (1 << 11), (1 << 11));
|
||||
}
|
||||
// Arrow down
|
||||
if (BR_OPTIONS_MAX - listOffset > BOSSRUSH_MAX_OPTIONS_ON_SCREEN) {
|
||||
uint16_t arrowDownX = 140;
|
||||
uint16_t arrowDownY = 181 + (fileChooseContext->bossRushArrowOffset / 10);
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, gArrowDownTex, G_IM_FMT_IA, G_IM_SIZ_16b, 16, 16, 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);
|
||||
gSPWideTextureRectangle(POLY_OPA_DISP++, arrowDownX << 2, arrowDownY << 2, (arrowDownX + 8) << 2,
|
||||
(arrowDownY + 8) << 2, G_TX_RENDERTILE, 0, 0, (1 << 11), (1 << 11));
|
||||
}
|
||||
|
||||
// Draw options. There's more options than what fits on the screen, so the visible options
|
||||
// depend on the current offset of the list. Currently selected option pulses in
|
||||
// color and has arrows surrounding the option.
|
||||
for (uint8_t i = listOffset; i - listOffset < BOSSRUSH_MAX_OPTIONS_ON_SCREEN; i++) {
|
||||
uint16_t textYOffset = (i - listOffset) * 16;
|
||||
|
||||
// Option name.
|
||||
Interface_DrawTextLine(fileChooseContext->state.gfxCtx, (char*)BossRush_GetSettingName(i, language), 65, (87 + textYOffset),
|
||||
255, 255, 80, textAlpha, 0.8f, true);
|
||||
|
||||
// Selected choice for option.
|
||||
uint16_t finalKerning = Interface_DrawTextLine(
|
||||
fileChooseContext->state.gfxCtx,
|
||||
(char*)BossRush_GetSettingChoiceName(i, gSaveContext.ship.quest.data.bossRush.options[i], language), 165,
|
||||
(87 + textYOffset), 255, 255, 255, textAlpha, 0.8f, true);
|
||||
|
||||
// Draw arrows around selected option.
|
||||
if (fileChooseContext->bossRushIndex == i) {
|
||||
Gfx_SetupDL_39Opa(fileChooseContext->state.gfxCtx);
|
||||
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, gArrowCursorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 0,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOMASK, G_TX_NOLOD,
|
||||
G_TX_NOLOD);
|
||||
FileChoose_DrawTextRec(fileChooseContext->state.gfxCtx, fileChooseContext->stickLeftPrompt.arrowColorR,
|
||||
fileChooseContext->stickLeftPrompt.arrowColorG, fileChooseContext->stickLeftPrompt.arrowColorB, textAlpha,
|
||||
160, (92 + textYOffset), 0.42f, 0, 0, -1.0f, 1.0f);
|
||||
FileChoose_DrawTextRec(fileChooseContext->state.gfxCtx, fileChooseContext->stickRightPrompt.arrowColorR,
|
||||
fileChooseContext->stickRightPrompt.arrowColorG, fileChooseContext->stickRightPrompt.arrowColorB,
|
||||
textAlpha, (171 + finalKerning), (92 + textYOffset), 0.42f, 0, 0, 1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
CLOSE_DISPS(fileChooseContext->state.gfxCtx);
|
||||
}
|
||||
|
||||
void BossRush_SpawnBlueWarps(PlayState* play) {
|
||||
|
||||
// Spawn blue warps in Chamber of Sages based on what bosses have been defeated.
|
||||
|
@ -383,7 +558,7 @@ void BossRush_HandleCompleteBoss(PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
void BossRush_InitSave() {
|
||||
extern "C" void BossRush_InitSave() {
|
||||
|
||||
// Set player name to Lonk for the few textboxes that show up during Boss Rush. Player can't input their own name.
|
||||
std::array<char, 8> brPlayerName = { 21, 50, 49, 46, 62, 62, 62, 62 };
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
struct GameState;
|
||||
struct FileChooseContext;
|
||||
|
||||
void FileChoose_UpdateBossRushMenu(struct GameState* gameState);
|
||||
void FileChoose_DrawBossRushMenuWindowContents(struct FileChooseContext* fileChooseContext);
|
||||
const char* BossRush_GetSettingName(u8 optionIndex, u8 language);
|
||||
const char* BossRush_GetSettingChoiceName(u8 optionIndex, u8 choiceIndex, u8 language);
|
||||
u8 BossRush_GetSettingOptionsAmount(u8 optionIndex);
|
||||
|
|
|
@ -1398,110 +1398,6 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) {
|
|||
}
|
||||
}
|
||||
|
||||
static s8 sLastBossRushOptionIndex = -1;
|
||||
static s8 sLastBossRushOptionValue = -1;
|
||||
|
||||
void FileChoose_UpdateBossRushMenu(GameState* thisx) {
|
||||
FileChoose_UpdateStickDirectionPromptAnim(thisx);
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
Input* input = &this->state.input[0];
|
||||
bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0);
|
||||
|
||||
// Fade in elements after opening Boss Rush options menu
|
||||
this->bossRushUIAlpha += 25;
|
||||
if (this->bossRushUIAlpha > 255) {
|
||||
this->bossRushUIAlpha = 255;
|
||||
}
|
||||
|
||||
// Animate up/down arrows.
|
||||
this->bossRushArrowOffset += 1;
|
||||
if (this->bossRushArrowOffset >= 30) {
|
||||
this->bossRushArrowOffset = 0;
|
||||
}
|
||||
|
||||
// Move menu selection up or down.
|
||||
if (ABS(this->stickRelY) > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN | BTN_DUP))) {
|
||||
// Move down
|
||||
if (this->stickRelY < -30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN))) {
|
||||
// When selecting past the last option, cycle back to the first option.
|
||||
if ((this->bossRushIndex + 1) > BR_OPTIONS_MAX - 1) {
|
||||
this->bossRushIndex = 0;
|
||||
this->bossRushOffset = 0;
|
||||
} else {
|
||||
this->bossRushIndex++;
|
||||
// When last visible option is selected when moving down, offset the list down by one.
|
||||
if (this->bossRushIndex - this->bossRushOffset > BOSSRUSH_MAX_OPTIONS_ON_SCREEN - 1) {
|
||||
this->bossRushOffset++;
|
||||
}
|
||||
}
|
||||
} else if (this->stickRelY > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DUP))) {
|
||||
// When selecting past the first option, cycle back to the last option and offset the list to view it
|
||||
// properly.
|
||||
if ((this->bossRushIndex - 1) < 0) {
|
||||
this->bossRushIndex = BR_OPTIONS_MAX - 1;
|
||||
this->bossRushOffset = this->bossRushIndex - BOSSRUSH_MAX_OPTIONS_ON_SCREEN + 1;
|
||||
} else {
|
||||
// When first visible option is selected when moving up, offset the list up by one.
|
||||
if (this->bossRushIndex - this->bossRushOffset == 0) {
|
||||
this->bossRushOffset--;
|
||||
}
|
||||
this->bossRushIndex--;
|
||||
}
|
||||
}
|
||||
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
}
|
||||
|
||||
// Cycle through choices for currently selected option.
|
||||
if (ABS(this->stickRelX) > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DLEFT | BTN_DRIGHT))) {
|
||||
if (this->stickRelX > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DRIGHT))) {
|
||||
// If exceeding the amount of choices for the selected option, cycle back to the first.
|
||||
if ((gSaveContext.ship.quest.data.bossRush.options[this->bossRushIndex] + 1) ==
|
||||
BossRush_GetSettingOptionsAmount(this->bossRushIndex)) {
|
||||
gSaveContext.ship.quest.data.bossRush.options[this->bossRushIndex] = 0;
|
||||
} else {
|
||||
gSaveContext.ship.quest.data.bossRush.options[this->bossRushIndex]++;
|
||||
}
|
||||
} else if (this->stickRelX < -30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DLEFT))) {
|
||||
// If cycling back when already at the first choice for the selected option, cycle back to the last choice.
|
||||
if ((gSaveContext.ship.quest.data.bossRush.options[this->bossRushIndex] - 1) < 0) {
|
||||
gSaveContext.ship.quest.data.bossRush.options[this->bossRushIndex] =
|
||||
BossRush_GetSettingOptionsAmount(this->bossRushIndex) - 1;
|
||||
} else {
|
||||
gSaveContext.ship.quest.data.bossRush.options[this->bossRushIndex]--;
|
||||
}
|
||||
}
|
||||
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
}
|
||||
|
||||
if (sLastBossRushOptionIndex != this->bossRushIndex ||
|
||||
sLastBossRushOptionValue != gSaveContext.ship.quest.data.bossRush.options[this->bossRushIndex]) {
|
||||
GameInteractor_ExecuteOnUpdateFileBossRushOptionSelection(
|
||||
this->bossRushIndex, gSaveContext.ship.quest.data.bossRush.options[this->bossRushIndex]);
|
||||
sLastBossRushOptionIndex = this->bossRushIndex;
|
||||
sLastBossRushOptionValue = gSaveContext.ship.quest.data.bossRush.options[this->bossRushIndex];
|
||||
}
|
||||
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
|
||||
this->configMode = CM_BOSS_RUSH_TO_QUEST;
|
||||
return;
|
||||
}
|
||||
|
||||
// Load into the game.
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_A)) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
this->buttonIndex = 0xFE;
|
||||
this->menuMode = FS_MENU_MODE_SELECT;
|
||||
this->selectMode = SM_FADE_OUT;
|
||||
this->prevConfigMode = this->configMode;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void FileChoose_UpdateRandomizerMenu(GameState* thisx) {
|
||||
FileChoose_UpdateStickDirectionPromptAnim(thisx);
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
|
@ -2590,63 +2486,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
|
|||
break;
|
||||
}
|
||||
} else if (this->configMode == CM_BOSS_RUSH_MENU) {
|
||||
uint8_t language = (gSaveContext.language == LANGUAGE_JPN) ? LANGUAGE_ENG : gSaveContext.language;
|
||||
uint8_t listOffset = this->bossRushOffset;
|
||||
uint8_t textAlpha = this->bossRushUIAlpha;
|
||||
|
||||
// Draw arrows to indicate that the list can scroll up or down.
|
||||
// Arrow up
|
||||
if (listOffset > 0) {
|
||||
uint16_t arrowUpX = 140;
|
||||
uint16_t arrowUpY = 76 - (this->bossRushArrowOffset / 10);
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, gArrowUpTex, G_IM_FMT_IA, G_IM_SIZ_16b, 16, 16, 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);
|
||||
gSPWideTextureRectangle(POLY_OPA_DISP++, arrowUpX << 2, arrowUpY << 2, (arrowUpX + 8) << 2,
|
||||
(arrowUpY + 8) << 2, G_TX_RENDERTILE, 0, 0, (1 << 11), (1 << 11));
|
||||
}
|
||||
// Arrow down
|
||||
if (BR_OPTIONS_MAX - listOffset > BOSSRUSH_MAX_OPTIONS_ON_SCREEN) {
|
||||
uint16_t arrowDownX = 140;
|
||||
uint16_t arrowDownY = 181 + (this->bossRushArrowOffset / 10);
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, gArrowDownTex, G_IM_FMT_IA, G_IM_SIZ_16b, 16, 16, 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);
|
||||
gSPWideTextureRectangle(POLY_OPA_DISP++, arrowDownX << 2, arrowDownY << 2, (arrowDownX + 8) << 2,
|
||||
(arrowDownY + 8) << 2, G_TX_RENDERTILE, 0, 0, (1 << 11), (1 << 11));
|
||||
}
|
||||
|
||||
// Draw options. There's more options than what fits on the screen, so the visible options
|
||||
// depend on the current offset of the list. Currently selected option pulses in
|
||||
// color and has arrows surrounding the option.
|
||||
for (uint8_t i = listOffset; i - listOffset < BOSSRUSH_MAX_OPTIONS_ON_SCREEN; i++) {
|
||||
uint16_t textYOffset = (i - listOffset) * 16;
|
||||
|
||||
// Option name.
|
||||
Interface_DrawTextLine(this->state.gfxCtx, BossRush_GetSettingName(i, language), 65, (87 + textYOffset),
|
||||
255, 255, 80, textAlpha, 0.8f, true);
|
||||
|
||||
// Selected choice for option.
|
||||
uint16_t finalKerning = Interface_DrawTextLine(
|
||||
this->state.gfxCtx,
|
||||
BossRush_GetSettingChoiceName(i, gSaveContext.ship.quest.data.bossRush.options[i], language), 165,
|
||||
(87 + textYOffset), 255, 255, 255, textAlpha, 0.8f, true);
|
||||
|
||||
// Draw arrows around selected option.
|
||||
if (this->bossRushIndex == i) {
|
||||
Gfx_SetupDL_39Opa(this->state.gfxCtx);
|
||||
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, gArrowCursorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 0,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOMASK, G_TX_NOLOD,
|
||||
G_TX_NOLOD);
|
||||
FileChoose_DrawTextRec(this->state.gfxCtx, this->stickLeftPrompt.arrowColorR,
|
||||
this->stickLeftPrompt.arrowColorG, this->stickLeftPrompt.arrowColorB, textAlpha,
|
||||
160, (92 + textYOffset), 0.42f, 0, 0, -1.0f, 1.0f);
|
||||
FileChoose_DrawTextRec(this->state.gfxCtx, this->stickRightPrompt.arrowColorR,
|
||||
this->stickRightPrompt.arrowColorG, this->stickRightPrompt.arrowColorB,
|
||||
textAlpha, (171 + finalKerning), (92 + textYOffset), 0.42f, 0, 0, 1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
FileChoose_DrawBossRushMenuWindowContents(this);
|
||||
} else if (this->configMode == CM_RANDOMIZER_SETTINGS_MENU) {
|
||||
uint8_t language = (gSaveContext.language == LANGUAGE_JPN) ? LANGUAGE_ENG : gSaveContext.language;
|
||||
uint8_t textAlpha = this->randomizerUIAlpha;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue