2020-10-03 15:22:44 +00:00
|
|
|
|
#include "global.h"
|
2024-08-15 02:05:41 +00:00
|
|
|
|
#if PLATFORM_N64
|
|
|
|
|
#include "n64dd.h"
|
|
|
|
|
#endif
|
2020-06-17 19:23:42 +00:00
|
|
|
|
|
2024-05-23 20:56:10 +00:00
|
|
|
|
/*
|
|
|
|
|
* The following three arrays are effectively unused.
|
|
|
|
|
* They are partly equivalent to the `sKaleidoSetupRightPage*` arrays below,
|
|
|
|
|
* but make each page correspond to the opposite page instead of the page to the right.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
s16 sKaleidoSetupUnusedPageIndex[] = {
|
|
|
|
|
PAUSE_QUEST, // PAUSE_ITEM
|
|
|
|
|
PAUSE_EQUIP, // PAUSE_MAP
|
|
|
|
|
PAUSE_ITEM, // PAUSE_QUEST
|
|
|
|
|
PAUSE_MAP, // PAUSE_EQUIP
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
f32 sKaleidoSetupUnusedEyeX[] = {
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_QUEST_X, // PAUSE_ITEM
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_EQUIP_X, // PAUSE_MAP
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_ITEM_X, // PAUSE_QUEST
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_MAP_X, // PAUSE_EQUIP
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
f32 sKaleidoSetupUnusedEyeZ[] = {
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_QUEST_Z, // PAUSE_ITEM
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_EQUIP_Z, // PAUSE_MAP
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_ITEM_Z, // PAUSE_QUEST
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_MAP_Z, // PAUSE_EQUIP
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* The following three arrays are used when opening the pause menu to set up a page switch such that scrolling left
|
|
|
|
|
* brings to the initial page.
|
|
|
|
|
* For example to open the menu on page PAUSE_ITEM, the menu would open on PAUSE_MAP and scroll left to PAUSE_ITEM.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
s16 sKaleidoSetupRightPageIndex[] = {
|
|
|
|
|
PAUSE_MAP, // PAUSE_ITEM
|
|
|
|
|
PAUSE_QUEST, // PAUSE_MAP
|
|
|
|
|
PAUSE_EQUIP, // PAUSE_QUEST
|
|
|
|
|
PAUSE_ITEM, // PAUSE_EQUIP
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
f32 sKaleidoSetupRightPageEyeX[] = {
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_MAP_X, // PAUSE_ITEM
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_QUEST_X, // PAUSE_MAP
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_EQUIP_X, // PAUSE_QUEST
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_ITEM_X, // PAUSE_EQUIP
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
f32 sKaleidoSetupRightPageEyeZ[] = {
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_MAP_Z, // PAUSE_ITEM
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_QUEST_Z, // PAUSE_MAP
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_EQUIP_Z, // PAUSE_QUEST
|
|
|
|
|
PAUSE_EYE_DIST * -PAUSE_ITEM_Z, // PAUSE_EQUIP
|
|
|
|
|
};
|
2020-06-17 19:23:42 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void KaleidoSetup_Update(PlayState* play) {
|
|
|
|
|
PauseContext* pauseCtx = &play->pauseCtx;
|
|
|
|
|
Input* input = &play->state.input[0];
|
2024-08-15 02:05:41 +00:00
|
|
|
|
#if PLATFORM_N64
|
|
|
|
|
s32 pad;
|
|
|
|
|
#endif
|
2020-06-17 19:23:42 +00:00
|
|
|
|
|
2023-09-06 15:14:15 +00:00
|
|
|
|
if (!IS_PAUSED(pauseCtx) && play->gameOverCtx.state == GAMEOVER_INACTIVE &&
|
2022-05-21 18:23:43 +00:00
|
|
|
|
play->transitionTrigger == TRANS_TRIGGER_OFF && play->transitionMode == TRANS_MODE_OFF &&
|
2023-08-13 19:24:26 +00:00
|
|
|
|
gSaveContext.save.cutsceneIndex < 0xFFF0 && gSaveContext.nextCutsceneIndex < 0xFFF0 && !Play_InCsMode(play) &&
|
2022-05-23 16:52:01 +00:00
|
|
|
|
play->shootingGalleryStatus <= 1 && gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY &&
|
|
|
|
|
gSaveContext.magicState != MAGIC_STATE_FILL &&
|
2022-11-26 21:15:41 +00:00
|
|
|
|
(play->sceneId != SCENE_BOMBCHU_BOWLING_ALLEY || !Flags_GetSwitch(play, 0x38))) {
|
2020-06-17 19:23:42 +00:00
|
|
|
|
|
2020-10-03 15:22:44 +00:00
|
|
|
|
if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
|
2024-02-08 13:40:08 +00:00
|
|
|
|
if (OOT_DEBUG && BREG(0)) {
|
2021-05-02 23:15:16 +00:00
|
|
|
|
pauseCtx->debugState = 3;
|
2020-06-17 19:23:42 +00:00
|
|
|
|
}
|
2020-10-03 15:22:44 +00:00
|
|
|
|
} else if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
|
2023-09-06 15:14:15 +00:00
|
|
|
|
// The start button was pressed, pause
|
2022-11-22 03:01:44 +00:00
|
|
|
|
gSaveContext.prevHudVisibilityMode = gSaveContext.hudVisibilityMode;
|
2021-05-02 23:15:16 +00:00
|
|
|
|
|
|
|
|
|
WREG(16) = -175;
|
|
|
|
|
WREG(17) = 155;
|
|
|
|
|
|
2024-05-23 20:56:10 +00:00
|
|
|
|
pauseCtx->pageSwitchTimer = 0;
|
|
|
|
|
|
|
|
|
|
// Setting mainState here is irrelevant, mainState is only used under PAUSE_STATE_MAIN,
|
|
|
|
|
// which isn't involved in the initial pause menu opening page scrolling animation.
|
|
|
|
|
// mainState is also overwritten later before being used.
|
|
|
|
|
pauseCtx->mainState = PAUSE_MAIN_STATE_SWITCHING_PAGE;
|
2021-05-02 23:15:16 +00:00
|
|
|
|
|
2024-07-17 22:52:38 +00:00
|
|
|
|
//! @bug REG collision, ZREG(48) is also R_START_LABEL_SCALE for NTSC and R_START_LABEL_DD(0) for PAL
|
|
|
|
|
if (ZREG(48) == 0) {
|
2024-05-23 20:56:10 +00:00
|
|
|
|
// Never reached, unused, and the data would be wrong anyway
|
|
|
|
|
// (scrolling left from this would not bring to the initial page)
|
|
|
|
|
pauseCtx->eye.x = sKaleidoSetupUnusedEyeX[pauseCtx->pageIndex];
|
|
|
|
|
pauseCtx->eye.z = sKaleidoSetupUnusedEyeZ[pauseCtx->pageIndex];
|
|
|
|
|
pauseCtx->pageIndex = sKaleidoSetupUnusedPageIndex[pauseCtx->pageIndex];
|
2020-06-17 19:23:42 +00:00
|
|
|
|
} else {
|
2024-05-23 20:56:10 +00:00
|
|
|
|
// Set eye position and pageIndex such that scrolling left brings to the desired page
|
|
|
|
|
pauseCtx->eye.x = sKaleidoSetupRightPageEyeX[pauseCtx->pageIndex];
|
|
|
|
|
pauseCtx->eye.z = sKaleidoSetupRightPageEyeZ[pauseCtx->pageIndex];
|
|
|
|
|
pauseCtx->pageIndex = sKaleidoSetupRightPageIndex[pauseCtx->pageIndex];
|
2020-06-17 19:23:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-23 20:56:10 +00:00
|
|
|
|
// Set next page mode to scroll left
|
|
|
|
|
pauseCtx->nextPageMode = (u16)(pauseCtx->pageIndex * 2) + 1;
|
2023-09-06 15:14:15 +00:00
|
|
|
|
pauseCtx->state = PAUSE_STATE_WAIT_LETTERBOX;
|
2021-05-02 23:15:16 +00:00
|
|
|
|
|
2024-05-23 20:56:10 +00:00
|
|
|
|
PRINTF("Mode=%d eye.x=%f, eye.z=%f kscp_pos=%d\n", pauseCtx->nextPageMode, pauseCtx->eye.x,
|
|
|
|
|
pauseCtx->eye.z, pauseCtx->pageIndex);
|
2020-06-17 19:23:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-06 15:14:15 +00:00
|
|
|
|
if (pauseCtx->state == PAUSE_STATE_WAIT_LETTERBOX) {
|
2021-05-02 23:15:16 +00:00
|
|
|
|
WREG(2) = -6240;
|
2020-06-17 19:23:42 +00:00
|
|
|
|
R_UPDATE_RATE = 2;
|
2021-05-02 23:15:16 +00:00
|
|
|
|
|
2022-08-15 13:39:06 +00:00
|
|
|
|
if (Letterbox_GetSizeTarget() != 0) {
|
|
|
|
|
Letterbox_SetSizeTarget(0);
|
2020-06-17 19:23:42 +00:00
|
|
|
|
}
|
2021-05-02 23:15:16 +00:00
|
|
|
|
|
2020-06-17 19:23:42 +00:00
|
|
|
|
func_800F64E0(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void KaleidoSetup_Init(PlayState* play) {
|
|
|
|
|
PauseContext* pauseCtx = &play->pauseCtx;
|
2020-08-23 21:50:30 +00:00
|
|
|
|
|
2023-09-06 15:14:15 +00:00
|
|
|
|
pauseCtx->state = PAUSE_STATE_OFF;
|
2021-05-02 23:15:16 +00:00
|
|
|
|
pauseCtx->debugState = 0;
|
2024-02-08 13:40:08 +00:00
|
|
|
|
|
|
|
|
|
pauseCtx->eye.x = pauseCtx->eye.y = 0.0f;
|
2020-06-17 19:23:42 +00:00
|
|
|
|
pauseCtx->eye.z = 64.0f;
|
|
|
|
|
pauseCtx->unk_1F0 = 936.0f;
|
2024-02-08 13:40:08 +00:00
|
|
|
|
pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 = 160.0f;
|
|
|
|
|
|
|
|
|
|
pauseCtx->alpha = 0;
|
|
|
|
|
|
|
|
|
|
// mainState = PAUSE_MAIN_STATE_IDLE , pageIndex = PAUSE_ITEM
|
2024-05-23 20:56:10 +00:00
|
|
|
|
pauseCtx->pageSwitchTimer = pauseCtx->mainState = pauseCtx->nextPageMode = pauseCtx->pageIndex = 0;
|
2024-02-08 13:40:08 +00:00
|
|
|
|
|
2020-06-17 19:23:42 +00:00
|
|
|
|
pauseCtx->unk_204 = -314.0f;
|
2021-05-02 23:15:16 +00:00
|
|
|
|
|
|
|
|
|
pauseCtx->cursorPoint[PAUSE_ITEM] = 0;
|
|
|
|
|
pauseCtx->cursorPoint[PAUSE_MAP] = VREG(30) + 3;
|
|
|
|
|
pauseCtx->cursorPoint[PAUSE_QUEST] = 0;
|
|
|
|
|
pauseCtx->cursorPoint[PAUSE_EQUIP] = 1;
|
|
|
|
|
pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 10;
|
|
|
|
|
|
|
|
|
|
pauseCtx->cursorX[PAUSE_ITEM] = 0;
|
|
|
|
|
pauseCtx->cursorY[PAUSE_ITEM] = 0;
|
|
|
|
|
pauseCtx->cursorX[PAUSE_MAP] = 0;
|
|
|
|
|
pauseCtx->cursorY[PAUSE_MAP] = 0;
|
2024-02-08 13:40:08 +00:00
|
|
|
|
pauseCtx->cursorX[PAUSE_QUEST] = 0;
|
|
|
|
|
pauseCtx->cursorY[PAUSE_QUEST] = 0;
|
2021-05-02 23:15:16 +00:00
|
|
|
|
pauseCtx->cursorX[PAUSE_EQUIP] = 1;
|
|
|
|
|
pauseCtx->cursorY[PAUSE_EQUIP] = 0;
|
|
|
|
|
|
|
|
|
|
pauseCtx->cursorItem[PAUSE_ITEM] = PAUSE_ITEM_NONE;
|
|
|
|
|
pauseCtx->cursorItem[PAUSE_MAP] = VREG(30) + 3;
|
|
|
|
|
pauseCtx->cursorItem[PAUSE_QUEST] = PAUSE_ITEM_NONE;
|
|
|
|
|
pauseCtx->cursorItem[PAUSE_EQUIP] = ITEM_SWORD_KOKIRI;
|
|
|
|
|
|
|
|
|
|
pauseCtx->cursorSlot[PAUSE_ITEM] = 0;
|
|
|
|
|
pauseCtx->cursorSlot[PAUSE_MAP] = VREG(30) + 3;
|
|
|
|
|
pauseCtx->cursorSlot[PAUSE_QUEST] = 0;
|
|
|
|
|
pauseCtx->cursorSlot[PAUSE_EQUIP] = pauseCtx->cursorPoint[PAUSE_EQUIP];
|
|
|
|
|
|
|
|
|
|
pauseCtx->infoPanelOffsetY = -40;
|
|
|
|
|
pauseCtx->nameDisplayTimer = 0;
|
|
|
|
|
pauseCtx->nameColorSet = 0;
|
|
|
|
|
pauseCtx->cursorColorSet = 4;
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
|
pauseCtx->ocarinaSongIdx = -1;
|
2021-05-02 23:15:16 +00:00
|
|
|
|
pauseCtx->cursorSpecialPos = 0;
|
2020-08-23 21:50:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
View_Init(&pauseCtx->view, play->state.gfxCtx);
|
2024-08-15 02:05:41 +00:00
|
|
|
|
|
|
|
|
|
#if PLATFORM_N64
|
2024-09-04 18:56:24 +00:00
|
|
|
|
if ((B_80121220 != NULL) && (B_80121220->unk_3C != NULL)) {
|
|
|
|
|
B_80121220->unk_3C();
|
2024-08-15 02:05:41 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
2020-06-17 19:23:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void KaleidoSetup_Destroy(PlayState* play) {
|
2024-08-15 02:05:41 +00:00
|
|
|
|
#if PLATFORM_N64
|
2024-09-04 18:56:24 +00:00
|
|
|
|
if ((B_80121220 != NULL) && (B_80121220->unk_40 != NULL)) {
|
|
|
|
|
B_80121220->unk_40();
|
2024-08-15 02:05:41 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
2020-06-17 19:23:42 +00:00
|
|
|
|
}
|