Files
mm/src/code/z_kaleido_setup.c
T
Derek Hensley 9e72c240d9 Z_message (2 NON_MATCHINGS) (#1398)
* matched func_8014D62C

* matched func_8014D304

* matched func_80149048

* matched func_80159438 & func_8014CDF0

* matched Message_GetState

* matched func_80152CAC

* matched func_80149454

* matched func_801491DC

* matched func_80150A84

* matched func_801496C8

* matched func_80149C18

* func_8014995C progress

* matched 8014995C

* matched func_80153EF0

* fix MessageContext lottery guess array size to match func_801496C8

* matched 80148D64

* matched func_8014AAD0

* progress func_8014CFDC

* matched func_8014CFDC

* progress func_801514B0

* progress#2 func_801514B0

* matched func_801514B0

* progress func_8014C70C

* Progress on few functions

* fix some variables & func name

* change unk11F00 type and usages

* func_8014C70C matched

* match func_8015268c

* fix building

* format

* engi message WIP

* enums, cleanup

* missed one

* oops

* even more enums

* another oops

* func_8015E7EC NON_MATCHING

* cleanup Message_DrawTextCredits

* MSGMODE cleanup

* import sFontWidths

* Import z_message_nes data

* Message_DrawTextNES draft

* fix types in message_nes

* Message_DrawTextNES NON_EQUIVALENT

* Message_DrawTextNES improvement

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Import bss

* fixes

* Data clean up

* Delete Message_Decode m2c output

* Readd Message_Update data

* import data

* func declaration

* cleanup

* Language enum

* fix naming, some flags

* Update functions and variables related to the bombers notebook event queue.

* Update renamed variables.txt

* format

* attempt Message_DecodeCredits

* begin Message_DecodeNES

* decode cleanup

* incremental improvements on Message_DecodeNES

* oops

* more progress

* first attempt at Message_Decode

* cleanup Message_Decode

* Message_Decode progress

* good progress on decode loops

* more progress

* good Message_Decode progress, thank anon

* decode creep

* big improvements, thanks anon/hatal

* small nes improvement

* cleanup

* match Message_DrawTextDefault, big progress on Message_DrawTextNES

* namefixer for save structs

* Some cleanup/fix non-equivalencies in decodes

* cleanup

* Small cleanup

* func_80150A84

* TextBoxType enum usage

* Format

* match Message_DecodeCredit by Maide, small improvement in Message_DrawTextNES

* comments

* some docs

* cleanup, improve matches

* Some improvement

Co-Authored-By: Santiago <github-santaclose-noreplay@NA.com>

* Fixes

* Missed

* Match Message_DrawTextNES

* Move functions to z64message.h

* string macros

* Small cleanups

* 1 more small thing

* decompme scratches

* Cleanup

* Item enum

* PR

* SEGMENT_ROM_START

* PR

* format

* ocarina cleanup

---------

Co-authored-by: andzura <andzura@andzura.fr>
Co-authored-by: Angie <angheloalf95@gmail.com>
Co-authored-by: engineer124 <engineer124engineer124@gmail.com>
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
Co-authored-by: Zoey Zolotova <zoey.zolotova@gmail.com>
Co-authored-by: Santiago <github-santaclose-noreplay@NA.com>
2023-10-04 08:51:45 +11:00

169 lines
6.4 KiB
C

#include "global.h"
#include "z64rumble.h"
#include "z64shrink_window.h"
#include "z64view.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
s16 sKaleidoSetupRightPageIndex[] = {
PAUSE_MAP, // PAUSE_ITEM
PAUSE_QUEST, // PAUSE_MAP
PAUSE_MASK, // PAUSE_QUEST
PAUSE_ITEM, // PAUSE_MASK
};
f32 sKaleidoSetupRightPageEyeX[] = {
PAUSE_EYE_DIST * -PAUSE_MAP_X, // PAUSE_ITEM
PAUSE_EYE_DIST * -PAUSE_QUEST_X, // PAUSE_MAP
PAUSE_EYE_DIST * -PAUSE_MASK_X, // PAUSE_QUEST
PAUSE_EYE_DIST * -PAUSE_ITEM_X, // PAUSE_MASK
};
f32 sKaleidoSetupRightPageEyeZ[] = {
PAUSE_EYE_DIST * -PAUSE_MAP_Z, // PAUSE_ITEM
PAUSE_EYE_DIST * -PAUSE_QUEST_Z, // PAUSE_MAP
PAUSE_EYE_DIST * -PAUSE_MASK_Z, // PAUSE_QUEST
PAUSE_EYE_DIST * -PAUSE_ITEM_Z, // PAUSE_MASK
};
void func_800F4A10(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx;
s16 i;
Rumble_StateReset();
pauseCtx->switchPageTimer = 0;
pauseCtx->mainState = PAUSE_MAIN_STATE_SWITCHING_PAGE;
// 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];
pauseCtx->infoPanelOffsetY = -40;
for (i = 0; i < ARRAY_COUNT(pauseCtx->worldMapPoints); i++) {
pauseCtx->worldMapPoints[i] = false;
}
if (pauseCtx->state == PAUSE_STATE_OPENING_0) {
for (i = 0; i < REGION_MAX; i++) {
if ((gSaveContext.save.saveInfo.regionsVisited >> i) & 1) {
pauseCtx->worldMapPoints[i] = true;
}
}
} else {
for (i = OWL_WARP_STONE_TOWER; i >= OWL_WARP_GREAT_BAY_COAST; i--) {
if ((gSaveContext.save.saveInfo.playerData.owlActivationFlags >> i) & 1) {
pauseCtx->worldMapPoints[i] = true;
pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = i;
}
}
if ((gSaveContext.save.saveInfo.playerData.owlActivationFlags >> 4) & 1) {
pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 4;
}
}
YREG(11) = -0x00C8;
YREG(12) = -0x3840;
YREG(13) = 0x2710;
YREG(14) = 0x2710;
YREG(15) = 0x2710;
YREG(16) = -0x00BE;
YREG(17) = -0x06D6;
YREG(18) = -0x0B90;
YREG(19) = 0x06E0;
YREG(20) = 0;
YREG(21) = -0x0622;
YREG(22) = -0x0C44;
YREG(23) = 0x0622;
R_PAUSE_WORLD_MAP_YAW = -0x622;
R_PAUSE_WORLD_MAP_Y_OFFSET = -90;
R_PAUSE_WORLD_MAP_DEPTH = -14400;
}
void KaleidoSetup_Update(PlayState* play) {
Input* input = CONTROLLER1(&play->state);
MessageContext* msgCtx = &play->msgCtx;
Player* player = GET_PLAYER(play);
PauseContext* pauseCtx = &play->pauseCtx;
if (CHECK_BTN_ALL(input->cur.button, BTN_R)) {
if (msgCtx && msgCtx) {}
}
if ((pauseCtx->state == PAUSE_STATE_OFF) && (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) &&
(play->gameOverCtx.state == GAMEOVER_INACTIVE)) {
if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) {
if ((gSaveContext.save.cutsceneIndex < 0xFFF0) && (gSaveContext.nextCutsceneIndex < 0xFFF0)) {
if (!Play_InCsMode(play) || ((msgCtx->msgMode != MSGMODE_NONE) && (msgCtx->currentTextId == 0xFF))) {
if ((play->unk_1887C < 2) && (gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY) &&
(gSaveContext.magicState != MAGIC_STATE_FILL)) {
if (!CHECK_EVENTINF(EVENTINF_17) && !(player->stateFlags1 & PLAYER_STATE1_20)) {
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) &&
!(play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON)) {
if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) {
gSaveContext.prevHudVisibility = gSaveContext.hudVisibility;
pauseCtx->itemDescriptionOn = false;
pauseCtx->state = PAUSE_STATE_OPENING_0;
func_800F4A10(play);
// Set next page mode to scroll left
pauseCtx->nextPageMode = pauseCtx->pageIndex * 2 + 1;
func_801A3A7C(1);
}
if (pauseCtx->state == PAUSE_STATE_OPENING_0) {
GameState_SetFramerateDivisor(&play->state, 2);
if (ShrinkWindow_Letterbox_GetSizeTarget() != 0) {
ShrinkWindow_Letterbox_SetSizeTarget(0);
}
Audio_PlaySfx_PauseMenuOpenOrClose(SFX_PAUSE_MENU_OPEN);
}
}
}
}
}
}
}
}
}
void KaleidoSetup_Init(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx;
s32 pad[2];
bzero(pauseCtx, sizeof(PauseContext));
pauseCtx->pageIndex = PAUSE_ITEM;
pauseCtx->maskPageRoll = 160.0f;
pauseCtx->questPageRoll = 160.0f;
pauseCtx->mapPageRoll = 160.0f;
pauseCtx->itemPageRoll = 160.0f;
pauseCtx->eye.x = -64.0f;
pauseCtx->unk_20C = 936.0f;
pauseCtx->roll = -314.0f;
pauseCtx->cursorPoint[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1);
pauseCtx->cursorSpecialPos = PAUSE_CURSOR_PAGE_RIGHT;
pauseCtx->pageSwitchInputTimer = 0;
pauseCtx->cursorItem[PAUSE_ITEM] = PAUSE_ITEM_NONE;
pauseCtx->cursorItem[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1);
pauseCtx->cursorItem[PAUSE_QUEST] = PAUSE_ITEM_NONE;
pauseCtx->cursorItem[PAUSE_MASK] = PAUSE_ITEM_NONE;
pauseCtx->cursorSlot[PAUSE_ITEM] = 0;
pauseCtx->cursorSlot[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1);
pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_YELLOW;
pauseCtx->ocarinaSongIndex = -1;
pauseCtx->equipAnimScale = 320;
pauseCtx->equipAnimShrinkRate = 40;
pauseCtx->promptAlpha = 100;
View_Init(&pauseCtx->view, play->state.gfxCtx);
}
void KaleidoSetup_Destroy(PlayState* play) {
}