From 41adadd85d4d528bf99a4bc8934eabec9be06b3b Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Tue, 15 Jul 2025 06:10:34 +0100 Subject: [PATCH 1/6] Pause docs: UIOverlay L/R buttons details (#2650) --- include/regs.h | 4 + src/code/z_construct.c | 6 +- .../misc/ovl_kaleido_scope/z_kaleido_scope.c | 145 +++++++++--------- 3 files changed, 80 insertions(+), 75 deletions(-) diff --git a/include/regs.h b/include/regs.h index 187939cf5..a59e059ab 100644 --- a/include/regs.h +++ b/include/regs.h @@ -126,6 +126,7 @@ struct PlayState; #define R_EPONAS_SONG_PLAYED DREG(53) #define R_MAGIC_FILL_COLOR(i) ZREG(0 + (i)) #define R_PAUSE_PAGE_SWITCH_FRAME_ADVANCE_ON ZREG(13) +#define R_PAUSE_BUTTON_L_R_SELECTED_PRIM_TIMER ZREG(28) #define R_C_BTN_COLOR(i) ZREG(39 + (i)) #define R_B_BTN_COLOR(i) ZREG(43 + (i)) #if OOT_NTSC @@ -192,6 +193,7 @@ struct PlayState; #define R_B_LABEL_DD WREG(0) #define R_PAUSE_PAGES_Y_ORIGIN_2 WREG(2) // Complements PauseContext.pagesYOrigin1 #define R_PAUSE_DEPTH_OFFSET WREG(3) // Offset position of all pages away from the camera +#define R_PAUSE_UI_ANIMS_DURATION WREG(6) #if OOT_NTSC #define R_B_LABEL_SCALE(i) WREG(8 + (i)) #define R_B_LABEL_X(i) WREG(10 + (i)) @@ -201,6 +203,8 @@ struct PlayState; #define R_PAUSE_BUTTON_LEFT_X WREG(16) #define R_PAUSE_BUTTON_RIGHT_X WREG(17) #define R_PAUSE_BUTTON_LEFT_RIGHT_Y WREG(18) +#define R_PAUSE_BUTTON_LEFT_MOVE_OFFSET_X WREG(25) +#define R_PAUSE_BUTTON_RIGHT_MOVE_OFFSET_X WREG(26) #define R_OW_MINIMAP_X WREG(29) #define R_OW_MINIMAP_Y WREG(30) #define R_MINIMAP_DISABLED WREG(31) diff --git a/src/code/z_construct.c b/src/code/z_construct.c index 92c84de00..179012b43 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -352,7 +352,7 @@ void Regs_InitDataImpl(void) { ZREG(25) = 4; ZREG(26) = 20; ZREG(27) = 10; - ZREG(28) = 20; + R_PAUSE_BUTTON_L_R_SELECTED_PRIM_TIMER = 20; ZREG(29) = 4; ZREG(30) = 20; ZREG(31) = 10; @@ -557,8 +557,8 @@ void Regs_InitDataImpl(void) { WREG(22) = -32; WREG(23) = -38; WREG(24) = -36; - WREG(25) = 40; - WREG(26) = -40; + R_PAUSE_BUTTON_LEFT_MOVE_OFFSET_X = 40; + R_PAUSE_BUTTON_RIGHT_MOVE_OFFSET_X = -40; WREG(27) = 0; WREG(28) = 0; R_OW_MINIMAP_X = 238; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index c7b704224..f43b3d627 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -1684,22 +1684,23 @@ void KaleidoScope_DrawUIOverlay(PlayState* play) { static u16 sToPlayMelodyTextWidths[] = LANGUAGE_ARRAY(gPauseToPlayMelodyJPNTex_WIDTH, gPauseToPlayMelodyENGTex_WIDTH, gPauseToPlayMelodyGERTex_WIDTH, gPauseToPlayMelodyFRATex_WIDTH); - static s16 D_8082ADF0[][4] = { + static s16 sLRSelectedPrimColors[][4] = { { 180, 210, 255, 220 }, { 100, 100, 150, 220 }, }; - static s16 D_8082AE00 = 20; - static s16 D_8082AE04 = 0; + static s16 sLRSelectedPrimTimer = 20; + static s16 sLRSelectedPrimState = 0; static s16 D_8082AE08[] = { 10, 16, 16, 17, 12, 13, 18, 17, 17, 19, 13, 21, 20, 21, 14, 15, 15, 15, 11, 14, }; static s16 D_8082AE30[] = { 21, 20, 19, 18, 11, 14, 10, 15, 16, 13, 12, 17, }; - static s16 D_808321A0; - static s16 D_808321A2; - static s16 D_808321A4; - static s16 D_808321A6; + static s16 sLRSelectedPrimR; + static s16 sLRSelectedPrimG; + static s16 sLRSelectedPrimB; + static s16 sLRSelectedPrimA; + PauseContext* pauseCtx = &play->pauseCtx; s16 stepR; s16 stepG; @@ -1711,39 +1712,39 @@ void KaleidoScope_DrawUIOverlay(PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 1676); - stepR = ABS(D_808321A0 - D_8082ADF0[D_8082AE04][0]) / D_8082AE00; - stepG = ABS(D_808321A2 - D_8082ADF0[D_8082AE04][1]) / D_8082AE00; - stepB = ABS(D_808321A4 - D_8082ADF0[D_8082AE04][2]) / D_8082AE00; - stepA = ABS(D_808321A6 - D_8082ADF0[D_8082AE04][3]) / D_8082AE00; - if (D_808321A0 >= D_8082ADF0[D_8082AE04][0]) { - D_808321A0 -= stepR; + stepR = ABS(sLRSelectedPrimR - sLRSelectedPrimColors[sLRSelectedPrimState][0]) / sLRSelectedPrimTimer; + stepG = ABS(sLRSelectedPrimG - sLRSelectedPrimColors[sLRSelectedPrimState][1]) / sLRSelectedPrimTimer; + stepB = ABS(sLRSelectedPrimB - sLRSelectedPrimColors[sLRSelectedPrimState][2]) / sLRSelectedPrimTimer; + stepA = ABS(sLRSelectedPrimA - sLRSelectedPrimColors[sLRSelectedPrimState][3]) / sLRSelectedPrimTimer; + if (sLRSelectedPrimR >= sLRSelectedPrimColors[sLRSelectedPrimState][0]) { + sLRSelectedPrimR -= stepR; } else { - D_808321A0 += stepR; + sLRSelectedPrimR += stepR; } - if (D_808321A2 >= D_8082ADF0[D_8082AE04][1]) { - D_808321A2 -= stepG; + if (sLRSelectedPrimG >= sLRSelectedPrimColors[sLRSelectedPrimState][1]) { + sLRSelectedPrimG -= stepG; } else { - D_808321A2 += stepG; + sLRSelectedPrimG += stepG; } - if (D_808321A4 >= D_8082ADF0[D_8082AE04][2]) { - D_808321A4 -= stepB; + if (sLRSelectedPrimB >= sLRSelectedPrimColors[sLRSelectedPrimState][2]) { + sLRSelectedPrimB -= stepB; } else { - D_808321A4 += stepB; + sLRSelectedPrimB += stepB; } - if (D_808321A6 >= D_8082ADF0[D_8082AE04][3]) { - D_808321A6 -= stepA; + if (sLRSelectedPrimA >= sLRSelectedPrimColors[sLRSelectedPrimState][3]) { + sLRSelectedPrimA -= stepA; } else { - D_808321A6 += stepA; + sLRSelectedPrimA += stepA; } - D_8082AE00--; - if (D_8082AE00 == 0) { - D_808321A0 = D_8082ADF0[D_8082AE04][0]; - D_808321A2 = D_8082ADF0[D_8082AE04][1]; - D_808321A4 = D_8082ADF0[D_8082AE04][2]; - D_808321A6 = D_8082ADF0[D_8082AE04][3]; - D_8082AE00 = ZREG(28); - D_8082AE04 ^= 1; + sLRSelectedPrimTimer--; + if (sLRSelectedPrimTimer == 0) { + sLRSelectedPrimR = sLRSelectedPrimColors[sLRSelectedPrimState][0]; + sLRSelectedPrimG = sLRSelectedPrimColors[sLRSelectedPrimState][1]; + sLRSelectedPrimB = sLRSelectedPrimColors[sLRSelectedPrimState][2]; + sLRSelectedPrimA = sLRSelectedPrimColors[sLRSelectedPrimState][3]; + sLRSelectedPrimTimer = R_PAUSE_BUTTON_L_R_SELECTED_PRIM_TIMER; + sLRSelectedPrimState ^= 1; } y = pauseCtx->infoPanelOffsetY - 76; @@ -1853,7 +1854,7 @@ void KaleidoScope_DrawUIOverlay(PlayState* play) { gSPDisplayList(POLY_OPA_DISP++, gInfoPanelBgDL); if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, D_808321A0, D_808321A2, D_808321A4, D_808321A6); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sLRSelectedPrimR, sLRSelectedPrimG, sLRSelectedPrimB, sLRSelectedPrimA); } // Draw UI_OVERLAY_QUAD_BUTTON_LEFT @@ -1862,14 +1863,14 @@ void KaleidoScope_DrawUIOverlay(PlayState* play) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 180, 210, 255, 220); if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, D_808321A0, D_808321A2, D_808321A4, D_808321A6); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sLRSelectedPrimR, sLRSelectedPrimG, sLRSelectedPrimB, sLRSelectedPrimA); } // Draw UI_OVERLAY_QUAD_BUTTON_RIGHT gSPDisplayList(POLY_OPA_DISP++, gRButtonIconDL); if (pauseCtx->cursorSpecialPos != 0) { - j = (pauseCtx->cursorSpecialPos - 8) * 4; + j = (pauseCtx->cursorSpecialPos - PAUSE_CURSOR_PAGE_LEFT + UI_OVERLAY_QUAD_BUTTON_LEFT) * 4; pauseCtx->cursorVtx[0].v.ob[0] = pauseCtx->uiOverlayVtx[j].v.ob[0]; pauseCtx->cursorVtx[0].v.ob[1] = pauseCtx->uiOverlayVtx[j].v.ob[1]; KaleidoScope_DrawCursor(play, pauseCtx->pageIndex); @@ -2233,11 +2234,11 @@ void KaleidoScope_UpdatePageSwitch(PlayState* play, Input* input) { if (pauseCtx->nextPageMode) {} if (pauseCtx->pageSwitchTimer < ((4 * PAGE_SWITCH_NSTEPS) / 2)) { - R_PAUSE_BUTTON_LEFT_X -= WREG(25) / WREG(6); - R_PAUSE_BUTTON_RIGHT_X -= WREG(26) / WREG(6); + R_PAUSE_BUTTON_LEFT_X -= R_PAUSE_BUTTON_LEFT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; + R_PAUSE_BUTTON_RIGHT_X -= R_PAUSE_BUTTON_RIGHT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; } else { - R_PAUSE_BUTTON_LEFT_X += WREG(25) / WREG(6); - R_PAUSE_BUTTON_RIGHT_X += WREG(26) / WREG(6); + R_PAUSE_BUTTON_LEFT_X += R_PAUSE_BUTTON_LEFT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; + R_PAUSE_BUTTON_RIGHT_X += R_PAUSE_BUTTON_RIGHT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; } pauseCtx->pageSwitchTimer += 4; @@ -4088,13 +4089,13 @@ void KaleidoScope_Update(PlayState* play) { } pauseCtx->itemPagePitch = pauseCtx->equipPagePitch = pauseCtx->mapPagePitch = pauseCtx->questPagePitch -= - 160.0f / WREG(6); - pauseCtx->infoPanelOffsetY += 40 / WREG(6); - interfaceCtx->startAlpha += 255 / WREG(6); - R_PAUSE_BUTTON_LEFT_X += WREG(25) / WREG(6); - R_PAUSE_BUTTON_RIGHT_X += WREG(26) / WREG(6); - XREG(5) += 150 / WREG(6); - pauseCtx->alpha += (u16)(255 / (WREG(6) + WREG(4))); + 160.0f / R_PAUSE_UI_ANIMS_DURATION; + pauseCtx->infoPanelOffsetY += 40 / R_PAUSE_UI_ANIMS_DURATION; + interfaceCtx->startAlpha += 255 / R_PAUSE_UI_ANIMS_DURATION; + R_PAUSE_BUTTON_LEFT_X += R_PAUSE_BUTTON_LEFT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; + R_PAUSE_BUTTON_RIGHT_X += R_PAUSE_BUTTON_RIGHT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; + XREG(5) += 150 / R_PAUSE_UI_ANIMS_DURATION; + pauseCtx->alpha += (u16)(255 / (R_PAUSE_UI_ANIMS_DURATION + WREG(4))); if (pauseCtx->itemPagePitch == 0) { interfaceCtx->startAlpha = 255; @@ -4249,9 +4250,9 @@ void KaleidoScope_Update(PlayState* play) { case PAUSE_STATE_SAVE_PROMPT: switch (pauseCtx->savePromptState) { case PAUSE_SAVE_PROMPT_STATE_APPEARING: - pauseCtx->promptPitch -= 314.0f / WREG(6); - R_PAUSE_BUTTON_LEFT_X -= WREG(25) / WREG(6); - R_PAUSE_BUTTON_RIGHT_X -= WREG(26) / WREG(6); + pauseCtx->promptPitch -= 314.0f / R_PAUSE_UI_ANIMS_DURATION; + R_PAUSE_BUTTON_LEFT_X -= R_PAUSE_BUTTON_LEFT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; + R_PAUSE_BUTTON_RIGHT_X -= R_PAUSE_BUTTON_RIGHT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; if (pauseCtx->promptPitch <= -628.0f) { pauseCtx->promptPitch = -628.0f; @@ -4320,9 +4321,9 @@ void KaleidoScope_Update(PlayState* play) { case PAUSE_SAVE_PROMPT_STATE_RETURN_TO_MENU: case PAUSE_SAVE_PROMPT_STATE_RETURN_TO_MENU_2: - pauseCtx->promptPitch += 314.0f / WREG(6); - R_PAUSE_BUTTON_LEFT_X += WREG(25) / WREG(6); - R_PAUSE_BUTTON_RIGHT_X += WREG(26) / WREG(6); + pauseCtx->promptPitch += 314.0f / R_PAUSE_UI_ANIMS_DURATION; + R_PAUSE_BUTTON_LEFT_X += R_PAUSE_BUTTON_LEFT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; + R_PAUSE_BUTTON_RIGHT_X += R_PAUSE_BUTTON_RIGHT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; if (pauseCtx->promptPitch >= -314.0f) { pauseCtx->state = PAUSE_STATE_MAIN; @@ -4337,13 +4338,13 @@ void KaleidoScope_Update(PlayState* play) { case PAUSE_SAVE_PROMPT_STATE_CLOSING_AFTER_SAVED: if (pauseCtx->promptPitch != (YREG(8) + 160.0f)) { pauseCtx->itemPagePitch = pauseCtx->equipPagePitch = pauseCtx->mapPagePitch = - pauseCtx->questPagePitch += 160.0f / WREG(6); - pauseCtx->promptPitch += 160.0f / WREG(6); - pauseCtx->infoPanelOffsetY -= 40 / WREG(6); - R_PAUSE_BUTTON_LEFT_X -= WREG(25) / WREG(6); - R_PAUSE_BUTTON_RIGHT_X -= WREG(26) / WREG(6); - XREG(5) -= 150 / WREG(6); - pauseCtx->alpha -= (u16)(255 / WREG(6)); + pauseCtx->questPagePitch += 160.0f / R_PAUSE_UI_ANIMS_DURATION; + pauseCtx->promptPitch += 160.0f / R_PAUSE_UI_ANIMS_DURATION; + pauseCtx->infoPanelOffsetY -= 40 / R_PAUSE_UI_ANIMS_DURATION; + R_PAUSE_BUTTON_LEFT_X -= R_PAUSE_BUTTON_LEFT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; + R_PAUSE_BUTTON_RIGHT_X -= R_PAUSE_BUTTON_RIGHT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; + XREG(5) -= 150 / R_PAUSE_UI_ANIMS_DURATION; + pauseCtx->alpha -= (u16)(255 / R_PAUSE_UI_ANIMS_DURATION); if (pauseCtx->promptPitch == (YREG(8) + 160.0f)) { pauseCtx->alpha = 0; } @@ -4507,14 +4508,14 @@ void KaleidoScope_Update(PlayState* play) { case PAUSE_STATE_GAME_OVER_SHOW_WINDOW: pauseCtx->itemPagePitch = pauseCtx->equipPagePitch = pauseCtx->mapPagePitch = pauseCtx->questPagePitch = - pauseCtx->promptPitch -= 160.0f / WREG(6); - pauseCtx->infoPanelOffsetY += 40 / WREG(6); - interfaceCtx->startAlpha += 255 / WREG(6); + pauseCtx->promptPitch -= 160.0f / R_PAUSE_UI_ANIMS_DURATION; + pauseCtx->infoPanelOffsetY += 40 / R_PAUSE_UI_ANIMS_DURATION; + interfaceCtx->startAlpha += 255 / R_PAUSE_UI_ANIMS_DURATION; VREG(88) -= 3; - R_PAUSE_BUTTON_LEFT_X += WREG(25) / WREG(6); - R_PAUSE_BUTTON_RIGHT_X += WREG(26) / WREG(6); - XREG(5) += 150 / WREG(6); - pauseCtx->alpha += (u16)(255 / (WREG(6) + WREG(4))); + R_PAUSE_BUTTON_LEFT_X += R_PAUSE_BUTTON_LEFT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; + R_PAUSE_BUTTON_RIGHT_X += R_PAUSE_BUTTON_RIGHT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; + XREG(5) += 150 / R_PAUSE_UI_ANIMS_DURATION; + pauseCtx->alpha += (u16)(255 / (R_PAUSE_UI_ANIMS_DURATION + WREG(4))); if (pauseCtx->promptPitch < -628.0f) { pauseCtx->promptPitch = -628.0f; interfaceCtx->startAlpha = 255; @@ -4676,13 +4677,13 @@ void KaleidoScope_Update(PlayState* play) { case PAUSE_STATE_CLOSING: if (pauseCtx->itemPagePitch != 160.0f) { pauseCtx->itemPagePitch = pauseCtx->equipPagePitch = pauseCtx->mapPagePitch = - pauseCtx->questPagePitch += 160.0f / WREG(6); - pauseCtx->infoPanelOffsetY -= 40 / WREG(6); - interfaceCtx->startAlpha -= 255 / WREG(6); - R_PAUSE_BUTTON_LEFT_X -= WREG(25) / WREG(6); - R_PAUSE_BUTTON_RIGHT_X -= WREG(26) / WREG(6); - XREG(5) -= 150 / WREG(6); - pauseCtx->alpha -= (u16)(255 / WREG(6)); + pauseCtx->questPagePitch += 160.0f / R_PAUSE_UI_ANIMS_DURATION; + pauseCtx->infoPanelOffsetY -= 40 / R_PAUSE_UI_ANIMS_DURATION; + interfaceCtx->startAlpha -= 255 / R_PAUSE_UI_ANIMS_DURATION; + R_PAUSE_BUTTON_LEFT_X -= R_PAUSE_BUTTON_LEFT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; + R_PAUSE_BUTTON_RIGHT_X -= R_PAUSE_BUTTON_RIGHT_MOVE_OFFSET_X / R_PAUSE_UI_ANIMS_DURATION; + XREG(5) -= 150 / R_PAUSE_UI_ANIMS_DURATION; + pauseCtx->alpha -= (u16)(255 / R_PAUSE_UI_ANIMS_DURATION); if (pauseCtx->itemPagePitch == 160.0f) { pauseCtx->alpha = 0; } From 7158775cea70824bdae64822286f01f841c43806 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Tue, 15 Jul 2025 06:31:41 +0100 Subject: [PATCH 2/6] Finish rename scene lists (#2652) --- include/scene.h | 12 ++++++------ src/code/z_scene.c | 4 ++-- .../extase_oot64/scene_commands_resource.py | 16 ++++++++-------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/scene.h b/include/scene.h index 8e5b1a100..5aafc4016 100644 --- a/include/scene.h +++ b/include/scene.h @@ -400,13 +400,13 @@ typedef enum NaviQuestHintFileId { // Scene commands typedef enum SceneCommandTypeID { - /* 0x00 */ SCENE_CMD_ID_SPAWN_LIST, + /* 0x00 */ SCENE_CMD_ID_PLAYER_ENTRY_LIST, /* 0x01 */ SCENE_CMD_ID_ACTOR_LIST, /* 0x02 */ SCENE_CMD_ID_UNUSED_2, /* 0x03 */ SCENE_CMD_ID_COLLISION_HEADER, /* 0x04 */ SCENE_CMD_ID_ROOM_LIST, /* 0x05 */ SCENE_CMD_ID_WIND_SETTINGS, - /* 0x06 */ SCENE_CMD_ID_ENTRANCE_LIST, + /* 0x06 */ SCENE_CMD_ID_SPAWN_LIST, /* 0x07 */ SCENE_CMD_ID_SPECIAL_FILES, /* 0x08 */ SCENE_CMD_ID_ROOM_BEHAVIOR, /* 0x09 */ SCENE_CMD_ID_UNDEFINED_9, @@ -429,8 +429,8 @@ typedef enum SceneCommandTypeID { /* 0x1A */ SCENE_CMD_ID_MAX } SceneCommandTypeID; -#define SCENE_CMD_SPAWN_LIST(numSpawns, spawnList) \ - { SCENE_CMD_ID_SPAWN_LIST, numSpawns, CMD_PTR(spawnList) } +#define SCENE_CMD_PLAYER_ENTRY_LIST(length, playerEntryList) \ + { SCENE_CMD_ID_PLAYER_ENTRY_LIST, length, CMD_PTR(playerEntryList) } #define SCENE_CMD_ACTOR_LIST(numActors, actorList) \ { SCENE_CMD_ID_ACTOR_LIST, numActors, CMD_PTR(actorList) } @@ -447,8 +447,8 @@ typedef enum SceneCommandTypeID { #define SCENE_CMD_WIND_SETTINGS(xDir, yDir, zDir, strength) \ { SCENE_CMD_ID_WIND_SETTINGS, 0, CMD_BBBB(xDir, yDir, zDir, strength) } -#define SCENE_CMD_ENTRANCE_LIST(entranceList) \ - { SCENE_CMD_ID_ENTRANCE_LIST, 0, CMD_PTR(entranceList) } +#define SCENE_CMD_SPAWN_LIST(spawnList) \ + { SCENE_CMD_ID_SPAWN_LIST, 0, CMD_PTR(spawnList) } #define SCENE_CMD_SPECIAL_FILES(naviQuestHintFileId, keepObjectId) \ { SCENE_CMD_ID_SPECIAL_FILES, naviQuestHintFileId, CMD_W(keepObjectId) } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index a3182a2f8..38323e6c7 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -531,13 +531,13 @@ void Scene_SetTransitionForNextEntrance(PlayState* play) { } SceneCmdHandlerFunc sSceneCmdHandlers[SCENE_CMD_ID_MAX] = { - Scene_CommandPlayerEntryList, // SCENE_CMD_ID_SPAWN_LIST + Scene_CommandPlayerEntryList, // SCENE_CMD_ID_PLAYER_ENTRY_LIST Scene_CommandActorEntryList, // SCENE_CMD_ID_ACTOR_LIST Scene_CommandUnused2, // SCENE_CMD_ID_UNUSED_2 Scene_CommandCollisionHeader, // SCENE_CMD_ID_COLLISION_HEADER Scene_CommandRoomList, // SCENE_CMD_ID_ROOM_LIST Scene_CommandWindSettings, // SCENE_CMD_ID_WIND_SETTINGS - Scene_CommandSpawnList, // SCENE_CMD_ID_ENTRANCE_LIST + Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST Scene_CommandSpecialFiles, // SCENE_CMD_ID_SPECIAL_FILES Scene_CommandRoomBehavior, // SCENE_CMD_ID_ROOM_BEHAVIOR Scene_CommandUndefined9, // SCENE_CMD_ID_UNDEFINED_9 diff --git a/tools/assets/extract/extase_oot64/scene_commands_resource.py b/tools/assets/extract/extase_oot64/scene_commands_resource.py index 57f2cbf44..aa6da2bc4 100644 --- a/tools/assets/extract/extase_oot64/scene_commands_resource.py +++ b/tools/assets/extract/extase_oot64/scene_commands_resource.py @@ -44,13 +44,13 @@ VERBOSE_NOT_FULLY_PARSED_SCENECMD = False class SceneCmdId(enum.Enum): # keep the SCENE_CMD_ID_ prefix for grepability - SCENE_CMD_ID_SPAWN_LIST = 0 + SCENE_CMD_ID_PLAYER_ENTRY_LIST = 0 SCENE_CMD_ID_ACTOR_LIST = enum.auto() SCENE_CMD_ID_UNUSED_2 = enum.auto() SCENE_CMD_ID_COLLISION_HEADER = enum.auto() SCENE_CMD_ID_ROOM_LIST = enum.auto() SCENE_CMD_ID_WIND_SETTINGS = enum.auto() - SCENE_CMD_ID_ENTRANCE_LIST = enum.auto() + SCENE_CMD_ID_SPAWN_LIST = enum.auto() SCENE_CMD_ID_SPECIAL_FILES = enum.auto() SCENE_CMD_ID_ROOM_BEHAVIOR = enum.auto() SCENE_CMD_ID_UNDEFINED_9 = enum.auto() @@ -73,13 +73,13 @@ class SceneCmdId(enum.Enum): scene_cmd_macro_name_by_cmd_id = { - SceneCmdId.SCENE_CMD_ID_SPAWN_LIST: "SCENE_CMD_SPAWN_LIST", + SceneCmdId.SCENE_CMD_ID_PLAYER_ENTRY_LIST: "SCENE_CMD_PLAYER_ENTRY_LIST", SceneCmdId.SCENE_CMD_ID_ACTOR_LIST: "SCENE_CMD_ACTOR_LIST", SceneCmdId.SCENE_CMD_ID_UNUSED_2: "SCENE_CMD_UNUSED_02", SceneCmdId.SCENE_CMD_ID_COLLISION_HEADER: "SCENE_CMD_COL_HEADER", SceneCmdId.SCENE_CMD_ID_ROOM_LIST: "SCENE_CMD_ROOM_LIST", SceneCmdId.SCENE_CMD_ID_WIND_SETTINGS: "SCENE_CMD_WIND_SETTINGS", - SceneCmdId.SCENE_CMD_ID_ENTRANCE_LIST: "SCENE_CMD_ENTRANCE_LIST", + SceneCmdId.SCENE_CMD_ID_SPAWN_LIST: "SCENE_CMD_SPAWN_LIST", SceneCmdId.SCENE_CMD_ID_SPECIAL_FILES: "SCENE_CMD_SPECIAL_FILES", SceneCmdId.SCENE_CMD_ID_ROOM_BEHAVIOR: "SCENE_CMD_ROOM_BEHAVIOR", SceneCmdId.SCENE_CMD_ID_UNDEFINED_9: "SCENE_CMD_UNK_09", @@ -220,7 +220,7 @@ class SceneCommandsResource(Resource, can_size_be_unknown=True): ) ) - if cmd_id == SceneCmdId.SCENE_CMD_ID_ENTRANCE_LIST: + if cmd_id == SceneCmdId.SCENE_CMD_ID_SPAWN_LIST: assert data1 == 0 resource = memory_context.report_resource_at_segmented( self, @@ -250,7 +250,7 @@ class SceneCommandsResource(Resource, can_size_be_unknown=True): ) ) - if cmd_id == SceneCmdId.SCENE_CMD_ID_SPAWN_LIST: + if cmd_id == SceneCmdId.SCENE_CMD_ID_PLAYER_ENTRY_LIST: self.player_entry_list_length = data1 resource = memory_context.report_resource_at_segmented( self, @@ -439,7 +439,7 @@ class SceneCommandsResource(Resource, can_size_be_unknown=True): f.write(" " * 4) f.write(scene_cmd_macro_name_by_cmd_id[cmd_id]) f.write("(") - if cmd_id == SceneCmdId.SCENE_CMD_ID_SPAWN_LIST: + if cmd_id == SceneCmdId.SCENE_CMD_ID_PLAYER_ENTRY_LIST: address = data2_I f.write( memory_context.get_c_expression_length_at_segmented(address) @@ -474,7 +474,7 @@ class SceneCommandsResource(Resource, can_size_be_unknown=True): zDir = data2_B2 strength = data2_B3 f.write(f"{xDir}, {yDir}, {zDir}, {strength}") - if cmd_id == SceneCmdId.SCENE_CMD_ID_ENTRANCE_LIST: + if cmd_id == SceneCmdId.SCENE_CMD_ID_SPAWN_LIST: assert data1 == 0 address = data2_I f.write(memory_context.get_c_reference_at_segmented(address)) From 4c2a451b9ca9e125873cea5c5bc21f790432c158 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Tue, 15 Jul 2025 06:52:22 +0100 Subject: [PATCH 3/6] Add `ENV_LIGHT_SETTINGS_BLEND_RATE_AND_FOG_NEAR_PACK`, fix extracted negative `blendRate` (#2653) * Add ENV_LIGHT_SETTINGS_BLEND_RATE_AND_FOG_NEAR_PACK, fix extracted negative blendRate * -> BLEND_RATE_AND_FOG_NEAR --- include/environment.h | 4 +++- tools/assets/extract/extase_oot64/scene_rooms_resources.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/environment.h b/include/environment.h index 6c23dfb33..1c820ffeb 100644 --- a/include/environment.h +++ b/include/environment.h @@ -155,8 +155,10 @@ typedef struct CurrentEnvLightSettings { // The blendRate determines how fast the current light settings fade to the next one // (under LIGHT_MODE_SETTINGS, otherwise unused). +#define BLEND_RATE_AND_FOG_NEAR(blendRate, fogNear) (s16)((((blendRate) / 4) << 10) | (fogNear)) + // Get blend rate from `EnvLightSettings.blendRateAndFogNear` in 0-255 range -#define ENV_LIGHT_SETTINGS_BLEND_RATE_U8(blendRateAndFogNear) (((blendRateAndFogNear) >> 10) * 4) +#define ENV_LIGHT_SETTINGS_BLEND_RATE_U8(blendRateAndFogNear) (u8)(((blendRateAndFogNear) >> 10) * 4) #define ENV_LIGHT_SETTINGS_FOG_NEAR(blendRateAndFogNear) ((blendRateAndFogNear) & 0x3FF) typedef struct EnvLightSettings { diff --git a/tools/assets/extract/extase_oot64/scene_rooms_resources.py b/tools/assets/extract/extase_oot64/scene_rooms_resources.py index d3b8903f2..3b632604c 100644 --- a/tools/assets/extract/extase_oot64/scene_rooms_resources.py +++ b/tools/assets/extract/extase_oot64/scene_rooms_resources.py @@ -293,8 +293,10 @@ class EnvLightSettingsListResource(CDataArrayNamedLengthResource): def write_blendRateAndFogNear(v): blendRate = (v >> 10) * 4 + if blendRate < 0: + blendRate += 0x100 fogNear = v & 0x3FF - return f"(({blendRate} / 4) << 10) | {fogNear}" + return f"BLEND_RATE_AND_FOG_NEAR({blendRate}, {fogNear})" elem_cdata_ext = CDataExt_Struct( ( From 6ecb84097c1a9a8426f3815c84aa6a5d49ad5804 Mon Sep 17 00:00:00 2001 From: cadmic Date: Sat, 16 Aug 2025 10:25:04 -0700 Subject: [PATCH 4/6] Fix macOS build for clang 17 (#2657) --- src/libgcc/longlong.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libgcc/longlong.h b/src/libgcc/longlong.h index fb6ebb15e..9590da9af 100644 --- a/src/libgcc/longlong.h +++ b/src/libgcc/longlong.h @@ -92,8 +92,8 @@ __asm__("multu %2,%3\n\t" \ "mflo %0\n\t" \ "mfhi %1" \ - : "=d"(w0), "=d"(w1) \ - : "d"((USItype)(u)), "d"((USItype)(v))) + : "=r"(w0), "=r"(w1) \ + : "r"((USItype)(u)), "r"((USItype)(v))) #endif #define udiv_qrnnd(q, r, n1, n0, d) \ From b204d6c089a0c8c64c180f40436682be3848f0e9 Mon Sep 17 00:00:00 2001 From: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> Date: Wed, 20 Aug 2025 10:30:08 +0200 Subject: [PATCH 5/6] =?UTF-8?q?Document=20Damp=C3=A9's=20ghost=20(#2656)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Document Dampé * Format * Address review * Format --- .../actors/ovl_En_Po_Relay/z_en_po_relay.c | 143 +++++++++++------- .../actors/ovl_En_Po_Relay/z_en_po_relay.h | 13 +- 2 files changed, 93 insertions(+), 63 deletions(-) diff --git a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c index b1f81b70d..b4add2965 100644 --- a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c +++ b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c @@ -22,8 +22,7 @@ #include "play_state.h" #include "player.h" #include "save.h" - -#include "assets/objects/object_tk/object_tk.h" +#include "array_count.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ @@ -42,7 +41,7 @@ void EnPoRelay_Talk2(EnPoRelay* this, PlayState* play); void EnPoRelay_DisappearAndReward(EnPoRelay* this, PlayState* play); void EnPoRelay_SetupIdle(EnPoRelay* this); -static Vec3s D_80AD8C30[] = { +static Vec3s sPathPoints[] = { { 0xFFC4, 0xFDEE, 0xF47A }, { 0x0186, 0xFE0C, 0xF47A }, { 0x0186, 0xFE0C, 0xF0F6 }, { 0x00D2, 0xFDEE, 0xF0F6 }, { 0x00D2, 0xFD9E, 0xEEDA }, { 0x023A, 0xFDC6, 0xEEDA }, { 0x023A, 0xFDC6, 0xED18 }, { 0x00D2, 0xFDC6, 0xED18 }, { 0x00D2, 0xFDC6, 0xEBCE }, { 0x00D2, 0xFDC6, 0xEAA2 }, { 0x023A, 0xFDC6, 0xEAA2 }, { 0x023A, 0xFDC6, 0xEBB0 }, @@ -84,23 +83,31 @@ static ColliderCylinderInit sCylinderInit = { { 30, 52, 0, { 0, 0, 0 } }, }; -static s32 D_80AD8D24 = 0; +static s32 sAlreadySpawned = false; static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_DAMPES_GHOST, ICHAIN_CONTINUE), ICHAIN_F32(lockOnArrowOffset, 1500, ICHAIN_STOP), }; -static Vec3f D_80AD8D30 = { 0.0f, 1.5f, 0.0f }; +static Vec3f sDisappearParticlesVelocity = { 0.0f, 1.5f, 0.0f }; -static Vec3f D_80AD8D3C = { 0.0f, 0.0f, 0.0f }; +static Vec3f sDisappearParticlesAccel = { 0.0f, 0.0f, 0.0f }; -static Vec3f D_80AD8D48 = { 0.0f, 1200.0f, 0.0f }; +// the offset (in model space) from the position of the lantern limb and the position of the actual light +static Vec3f sLanternLightOffset = { 0.0f, 1200.0f, 0.0f }; + +typedef enum DampeEyes { + /* 0 */ DAMPE_EYES_FULLY_OPEN, + /* 1 */ DAMPE_EYES_HALF_OPEN, + /* 2 */ DAMPE_EYES_CLOSED, + /* 3 */ DAMPE_EYES_MAX +} DampeEyes; static void* sEyesTextures[] = { - gDampeEyeOpenTex, - gDampeEyeHalfTex, - gDampeEyeClosedTex, + gDampeEyeOpenTex, // DAMPE_EYES_FULLY_OPEN + gDampeEyeHalfTex, // DAMPE_EYES_HALF_OPEN + gDampeEyeClosedTex, // DAMPE_EYES_CLOSED }; void EnPoRelay_Init(Actor* thisx, PlayState* play) { @@ -109,18 +116,19 @@ void EnPoRelay_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 42.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gDampeSkel, &gDampeFloatAnim, this->jointTable, this->morphTable, 18); + SkelAnime_InitFlex(play, &this->skelAnime, &gDampeSkel, &gDampeFloatAnim, this->jointTable, this->morphTable, + LIMB_OBJECT_TK_00BE40_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 255, 255, 255, 200); this->lightColor.a = 255; - temp = 1; - if (D_80AD8D24 != 0) { + temp = true; + if (sAlreadySpawned) { Actor_Kill(&this->actor); } else { - D_80AD8D24 = temp; + sAlreadySpawned = temp; Actor_SetTextWithPrefix(play, &this->actor, 65); this->textId = this->actor.textId; EnPoRelay_SetupIdle(this); @@ -136,9 +144,12 @@ void EnPoRelay_Destroy(Actor* thisx, PlayState* play) { } void EnPoRelay_SetupIdle(EnPoRelay* this) { - this->unk_195 = 32; - this->pathIndex = 0; + this->bobTimer = 32; + this->pathPoint = 0; + + // does not despawn upon room transitions this->actor.room = -1; + this->actor.shape.rot.y = 0; this->actor.world.rot.y = -0x8000; this->actor.colChkInfo.mass = MASS_HEAVY; @@ -154,11 +165,11 @@ void EnPoRelay_Vec3sToVec3f(Vec3f* dest, Vec3s* src) { void EnPoRelay_SetupRace(EnPoRelay* this) { Vec3f vec; - EnPoRelay_Vec3sToVec3f(&vec, &D_80AD8C30[this->pathIndex]); + EnPoRelay_Vec3sToVec3f(&vec, &sPathPoints[this->pathPoint]); this->actionTimer = ((s16)(this->actor.shape.rot.y - this->actor.world.rot.y - 0x8000) >> 0xB) % 32U; Interface_SetTimer(0); this->hookshotSlotFull = INV_CONTENT(ITEM_HOOKSHOT) != ITEM_NONE; - this->unk_19A = Actor_WorldYawTowardPoint(&this->actor, &vec); + this->yawTowardsPathPoint = Actor_WorldYawTowardPoint(&this->actor, &vec); this->actor.flags |= ACTOR_FLAG_LOCK_ON_DISABLED; Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH); this->actionFunc = EnPoRelay_Race; @@ -172,8 +183,12 @@ void EnPoRelay_SetupEndRace(EnPoRelay* this) { } void EnPoRelay_CorrectY(EnPoRelay* this) { - Math_StepToF(&this->actor.home.pos.y, D_80AD8C30[(this->pathIndex >= 28) ? 27 : this->pathIndex].y + 45.0f, 2.0f); - this->actor.world.pos.y = Math_SinS(this->unk_195 * 0x800) * 8.0f + this->actor.home.pos.y; + Math_StepToF( + &this->actor.home.pos.y, + sPathPoints[(this->pathPoint >= ARRAY_COUNT(sPathPoints)) ? ARRAY_COUNT(sPathPoints) - 1 : this->pathPoint].y + + 45.0f, + 2.0f); + this->actor.world.pos.y = Math_SinS(this->bobTimer * 0x800) * 8.0f + this->actor.home.pos.y; } void EnPoRelay_Idle(EnPoRelay* this, PlayState* play) { @@ -208,9 +223,12 @@ void EnPoRelay_Race(EnPoRelay* this, PlayState* play) { if (this->actionTimer != 0) { this->actionTimer--; } + + // 3% chance of throwing a flame every 32 frames (1.6 seconds), if it fails + // it checks again the next frame without waiting the 32 frames if (this->actionTimer == 0 && Rand_ZeroOne() < 0.03f) { this->actionTimer = 32; - if (this->pathIndex < 23) { + if (this->pathPoint < 23) { speedXZ = Rand_ZeroOne() * 3.0f; if (speedXZ < 1.0f) { multiplier = 1.0f; @@ -221,14 +239,19 @@ void EnPoRelay_Race(EnPoRelay* this, PlayState* play) { } speedXZ = 30.0f * multiplier; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HONOTRAP, - Math_CosS(this->unk_19A) * speedXZ + this->actor.world.pos.x, this->actor.world.pos.y, - Math_SinS(this->unk_19A) * speedXZ + this->actor.world.pos.z, 0, - (this->unk_19A + 0x8000) - (0x2000 * multiplier), 0, HONOTRAP_TYPE_FLAME_DROP); + Math_CosS(this->yawTowardsPathPoint) * speedXZ + this->actor.world.pos.x, + this->actor.world.pos.y, + Math_SinS(this->yawTowardsPathPoint) * speedXZ + this->actor.world.pos.z, 0, + (this->yawTowardsPathPoint + 0x8000) - (0x2000 * multiplier), 0, HONOTRAP_TYPE_FLAME_DROP); } } - Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_19A, 2, 0x1000, 0x100); + Math_SmoothStepToS(&this->actor.world.rot.y, this->yawTowardsPathPoint, 2, 0x1000, 0x100); this->actor.shape.rot.y = this->actor.world.rot.y + (this->actionTimer * 0x800) + 0x8000; - if (this->pathIndex < 23) { + if (this->pathPoint < 23) { + //! @bug Dampé's speed is directly proportional to the player's speed when less than 300 units away from the + //! player and not in the branching paths, so if the player's speed is negative (by HESSing or similar), + //! Dampé will also move backwards, away from the next path point rather than towards it + // If the player travels along a different path to Dampé that converges later if ((Math3D_PointInSquare2D(660.0f, 840.0f, -4480.0f, -3760.0f, player->actor.world.pos.x, player->actor.world.pos.z) != 0) || @@ -253,21 +276,21 @@ void EnPoRelay_Race(EnPoRelay* this, PlayState* play) { } else { Math_ApproachF(&this->actor.speed, 3.5f, 0.5f, 1.5f); } - EnPoRelay_Vec3sToVec3f(&vec, &D_80AD8C30[this->pathIndex]); + EnPoRelay_Vec3sToVec3f(&vec, &sPathPoints[this->pathPoint]); if (Actor_WorldDistXZToPoint(&this->actor, &vec) < 40.0f) { - this->pathIndex++; - EnPoRelay_Vec3sToVec3f(&vec, &D_80AD8C30[this->pathIndex]); - if (this->pathIndex == 28) { + this->pathPoint++; + EnPoRelay_Vec3sToVec3f(&vec, &sPathPoints[this->pathPoint]); + if (this->pathPoint == ARRAY_COUNT(sPathPoints)) { EnPoRelay_SetupEndRace(this); - } else if (this->pathIndex == 9) { + } else if (this->pathPoint == 9) { // first door Flags_SetSwitch(play, 0x35); - } else if (this->pathIndex == 17) { + } else if (this->pathPoint == 17) { // second door Flags_SetSwitch(play, 0x36); - } else if (this->pathIndex == 25) { + } else if (this->pathPoint == 25) { // third door Flags_SetSwitch(play, 0x37); } } - this->unk_19A = Actor_WorldYawTowardPoint(&this->actor, &vec); + this->yawTowardsPathPoint = Actor_WorldYawTowardPoint(&this->actor, &vec); Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); } @@ -289,7 +312,7 @@ void EnPoRelay_Talk2(EnPoRelay* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x100); if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) { if (Message_ShouldAdvance(play)) { - if (this->hookshotSlotFull != 0) { + if (this->hookshotSlotFull) { Actor_SetTextWithPrefix(play, &this->actor, 0x2E); } else { Actor_SetTextWithPrefix(play, &this->actor, 0x2D); @@ -324,35 +347,36 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, PlayState* play) { vec.x = (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f) + this->actor.world.pos.x; vec.z = (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f) + this->actor.world.pos.z; } - EffectSsDeadDb_Spawn(play, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, - 0, 0, 255, 1, 9, true); + EffectSsDeadDb_Spawn(play, &vec, &sDisappearParticlesVelocity, &sDisappearParticlesAccel, + this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); vec.x = (this->actor.world.pos.x + this->actor.world.pos.x) - vec.x; vec.z = (this->actor.world.pos.z + this->actor.world.pos.z) - vec.z; - EffectSsDeadDb_Spawn(play, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, - 0, 0, 255, 1, 9, true); + EffectSsDeadDb_Spawn(play, &vec, &sDisappearParticlesVelocity, &sDisappearParticlesAccel, + this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); vec.x = this->actor.world.pos.x; vec.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(play, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, - 0, 0, 255, 1, 9, true); + EffectSsDeadDb_Spawn(play, &vec, &sDisappearParticlesVelocity, &sDisappearParticlesAccel, + this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); if (this->actionTimer == 1) { Actor_PlaySfx(&this->actor, NA_SE_EN_EXTINCT); } } if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.001f) != 0) { - if (this->hookshotSlotFull != 0) { - Vec3f sp60; + if (this->hookshotSlotFull) { + Vec3f posAtGround; s32 pad1; - sp60.x = this->actor.world.pos.x; - sp60.y = this->actor.floorHeight; - sp60.z = this->actor.world.pos.z; + posAtGround.x = this->actor.world.pos.x; + posAtGround.y = this->actor.floorHeight; + posAtGround.z = this->actor.world.pos.z; if (gSaveContext.timerSeconds < HIGH_SCORE(HS_DAMPE_RACE)) { HIGH_SCORE(HS_DAMPE_RACE) = gSaveContext.timerSeconds; } if (!Flags_GetCollectible(play, this->actor.params) && (gSaveContext.timerSeconds <= 60)) { - Item_DropCollectible2(play, &sp60, (this->actor.params << 8) + (0x4000 | ITEM00_HEART_PIECE)); + Item_DropCollectible2(play, &posAtGround, (this->actor.params << 8) + (0x4000 | ITEM00_HEART_PIECE)); } else { - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, sp60.x, sp60.y, sp60.z, 0, 0, 0, 2); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, posAtGround.x, posAtGround.y, posAtGround.z, 0, 0, + 0, 2); } } else { Flags_SetTempClear(play, 4); @@ -377,27 +401,30 @@ void EnPoRelay_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_SetFocus(&this->actor, 50.0f); - if (this->unk_195 != 0) { - this->unk_195 -= 1; + if (this->bobTimer != 0) { + this->bobTimer -= 1; } - if (this->unk_195 == 0) { - this->unk_195 = 32; + if (this->bobTimer == 0) { + this->bobTimer = 32; } this->eyeTextureIdx++; - if (this->eyeTextureIdx == 3) { - this->eyeTextureIdx = 0; + if (this->eyeTextureIdx == DAMPE_EYES_MAX) { + this->eyeTextureIdx = DAMPE_EYES_FULLY_OPEN; } } void EnPoRelay_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnPoRelay* this = (EnPoRelay*)thisx; - if (limbIndex == 14) { + // lantern + if (limbIndex == LIMB_OBJECT_TK_00BDCC) { f32 rand; Vec3f vec; OPEN_DISPS(play->state.gfxCtx, "../z_en_po_relay.c", 885); rand = Rand_ZeroOne(); + + // lantern can be from a light orange to pure white this->lightColor.r = (s16)(rand * 30.0f) + 225; this->lightColor.g = (s16)(rand * 100.0f) + 155; this->lightColor.b = (s16)(rand * 160.0f) + 95; @@ -405,10 +432,12 @@ void EnPoRelay_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* gDPSetEnvColor(POLY_OPA_DISP++, this->lightColor.r, this->lightColor.g, this->lightColor.b, 128); gSPDisplayList(POLY_OPA_DISP++, gDampeLanternDL); CLOSE_DISPS(play->state.gfxCtx, "../z_en_po_relay.c", 901); - Matrix_MultVec3f(&D_80AD8D48, &vec); + Matrix_MultVec3f(&sLanternLightOffset, &vec); Lights_PointNoGlowSetInfo(&this->lightInfo, vec.x, vec.y, vec.z, this->lightColor.r, this->lightColor.g, this->lightColor.b, 200); - } else if (limbIndex == 8) { + + // halo + } else if (limbIndex == LIMB_OBJECT_TK_00BD84) { OPEN_DISPS(play->state.gfxCtx, "../z_en_po_relay.c", 916); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_po_relay.c", 918); gSPDisplayList(POLY_OPA_DISP++, gDampeHaloDL); diff --git a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h index 483208f9f..2fa053688 100644 --- a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h +++ b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h @@ -4,6 +4,7 @@ #include "ultra64.h" #include "actor.h" #include "light.h" +#include "assets/objects/object_tk/object_tk.h" struct EnPoRelay; @@ -14,14 +15,14 @@ typedef struct EnPoRelay { /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnPoRelayActionFunc actionFunc; /* 0x0194 */ u8 hookshotSlotFull; - /* 0x0195 */ u8 unk_195; + /* 0x0195 */ u8 bobTimer; // used for the up & down bobbing /* 0x0196 */ s16 actionTimer; - /* 0x0198 */ s16 pathIndex; - /* 0x019A */ s16 unk_19A; - /* 0x019C */ u16 textId; + /* 0x0198 */ s16 pathPoint; // current (upcoming) path point + /* 0x019A */ s16 yawTowardsPathPoint; // yaw towards the current (upcoming) path point + /* 0x019C */ u16 textId; // mirrors actor.textId /* 0x019E */ u16 eyeTextureIdx; - /* 0x01A0 */ Vec3s jointTable[18]; - /* 0x020C */ Vec3s morphTable[18]; + /* 0x01A0 */ Vec3s jointTable[LIMB_OBJECT_TK_00BE40_MAX]; + /* 0x020C */ Vec3s morphTable[LIMB_OBJECT_TK_00BE40_MAX]; /* 0x0278 */ Color_RGBA8 lightColor; /* 0x027C */ LightNode* lightNode; /* 0x0280 */ LightInfo lightInfo; From 9f5ddc518aacd38fe077818a8526c19c1da59c5e Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Sun, 19 Oct 2025 16:30:16 +0100 Subject: [PATCH 6/6] Explicitly align gfxprint texture data to 8 bytes (#2663) --- src/libu64/gfxprint.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libu64/gfxprint.c b/src/libu64/gfxprint.c index c47d52a3a..1131dc510 100644 --- a/src/libu64/gfxprint.c +++ b/src/libu64/gfxprint.c @@ -1,9 +1,10 @@ #include "libc64/aprintf.h" #include "libu64/gfxprint.h" +#include "alignment.h" #include "attributes.h" #include "translation.h" -u16 sGfxPrintFontTLUT[64] = { +ALIGNED(8) u16 sGfxPrintFontTLUT[64] = { 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, @@ -11,14 +12,14 @@ u16 sGfxPrintFontTLUT[64] = { 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, }; -u16 sGfxPrintRainbowTLUT[16] = { +ALIGNED(8) u16 sGfxPrintRainbowTLUT[16] = { 0xF801, 0xFBC1, 0xFFC1, 0x07C1, 0x0421, 0x003F, 0x803F, 0xF83F, 0xF801, 0xFBC1, 0xFFC1, 0x07C1, 0x0421, 0x003F, 0x803F, 0xF83F, }; -u8 sGfxPrintRainbowData[8] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 }; +ALIGNED(8) u8 sGfxPrintRainbowData[8] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 }; -u8 sGfxPrintFontData[(16 * 256) / 2] = { +ALIGNED(8) u8 sGfxPrintFontData[(16 * 256) / 2] = { 0x00, 0xDF, 0xFD, 0x00, 0x0A, 0xEE, 0xFF, 0xA0, 0x0D, 0xF2, 0x2D, 0xD0, 0x06, 0x61, 0x1D, 0xC0, 0x01, 0x12, 0x2D, 0xD0, 0x06, 0x71, 0x99, 0x00, 0x01, 0x1E, 0xED, 0x10, 0x07, 0x7E, 0xF7, 0x00, 0x01, 0x56, 0x29, 0x90, 0x05, 0x58, 0x97, 0x60, 0x0D, 0xD2, 0x29, 0x90, 0x05, 0x59, 0x97, 0x70, 0x04, 0xDF, 0xFD, 0x40, 0x02, 0x6E, 0xF7, 0x00, 0x00,