diff --git a/src/Common/JSYSTEM/J2Dv1.ts b/src/Common/JSYSTEM/J2Dv1.ts index a62c4f97b..0deb1f2e3 100644 --- a/src/Common/JSYSTEM/J2Dv1.ts +++ b/src/Common/JSYSTEM/J2Dv1.ts @@ -181,9 +181,8 @@ function readPAN1Chunk(buffer: ArrayBufferSlice, parent: PAN1 | null): PAN1 { //#endregion Loading/J2Pane //#region Loading/J2Screen -export interface SCRN { - inf1: INF1; - panes: PAN1[]; +export interface SCRN extends PAN1 { + color: Color } export class BLO { @@ -194,7 +193,11 @@ export class BLO { const inf1 = readINF1Chunk(j2d.nextChunk('INF1')) const panes: PAN1[] = []; - let parentStack: (PAN1 | null)[] = [null]; + const screen: SCRN = { parent: null, type: 'SCRN', children: [], visible: true, + x: 0, y: 0, w: inf1.width, h: inf1.height, color: inf1.color, rot: 0, tag: '', basePos: 0, + alpha: inf1.color.a, inheritAlpha: false, offset: 0 }; + + let parentStack: (PAN1 | null)[] = [screen]; let shouldContinue = true; while (shouldContinue) { const magic = readString(buffer, j2d.offs, 4); @@ -226,7 +229,7 @@ export class BLO { } } - return { inf1, panes }; + return screen; } } @@ -453,8 +456,8 @@ export class J2DScreen extends J2DPane { public color: Color constructor(data: SCRN, cache: GfxRenderCache) { - super(data.panes[0], cache, null); - this.color = data.inf1.color; + super(data, cache, null); + this.color = data.color; } public override draw(renderInstManager: GfxRenderInstManager, viewerRenderInput: ViewerRenderInput, ctx2D: J2DGrafContext, offsetX?: number, offsetY?: number): void { diff --git a/src/ZeldaWindWaker/d_a.ts b/src/ZeldaWindWaker/d_a.ts index a66747894..4066ede2e 100644 --- a/src/ZeldaWindWaker/d_a.ts +++ b/src/ZeldaWindWaker/d_a.ts @@ -38,7 +38,7 @@ import { fopAcIt_JudgeByID, fopAcM_create, fopAcM_prm_class, fopAc_ac_c } from " import { cPhs__Status, fGlobals, fpcPf__Register, fpcSCtRq_Request, fpc_bs__Constructor } from "./framework.js"; import { mDoExt_McaMorf, mDoExt_bckAnm, mDoExt_brkAnm, mDoExt_btkAnm, mDoExt_btpAnm, mDoExt_modelEntryDL, mDoExt_modelUpdateDL } from "./m_do_ext.js"; import { MtxPosition, MtxTrans, calc_mtx, mDoMtx_XYZrotM, mDoMtx_XrotM, mDoMtx_YrotM, mDoMtx_YrotS, mDoMtx_ZXYrotM, mDoMtx_ZrotM, mDoMtx_ZrotS, quatM } from "./m_do_mtx.js"; -import { J2DGrafContext } from "../Common/JSYSTEM/J2Dv1.js"; +import { J2DGrafContext, J2DScreen } from "../Common/JSYSTEM/J2Dv1.js"; // Framework'd actors @@ -5761,6 +5761,7 @@ class d_a_title extends fopAc_ac_c { private modelShip: J3DModelInstance; private bckShip = new mDoExt_bckAnm(); private bpkShip = new mDoExt_brkAnm(); + private screen: J2DScreen; private anmFrameCounter = 0 private delayFrameCounter = 120; @@ -5835,10 +5836,27 @@ class d_a_title extends fopAc_ac_c { mat4.mul(globals.camera.clipFromWorldMatrix, globals.camera.clipFromViewMatrix, globals.camera.viewFromWorldMatrix); globals.camera.frustum.updateClipFrustum(globals.camera.clipFromWorldMatrix, globals.camera.clipSpaceNearZ); renderInstManager.popTemplate(); + + this.screen.draw(renderInstManager, viewerInput, globals.scnPlay.orthoGraf2D); } private proc_init2D(globals: dGlobals) { - + const screenData = globals.resCtrl.getObjectResByName(ResType.Blo, d_a_title.arcName, "title_logo_e.blo"); + assert(screenData !== null); + this.screen = new J2DScreen(screenData, globals.renderer.renderCache); + + // m0A0[2] = this.screen->search('pres'); + // m0A0[3] = this.screen->search('nint'); + // m0A0[0] = this.screen->search('zeld'); + // m0A0[1] = this.screen->search('zelj'); + // m0A0[4] = this.screen->search('eft1'); + // m0A0[5] = this.screen->search('eft2'); + + // for (s32 i = 0; i < (s32)ARRAY_SIZE(pane); i++) { + // fopMsgM_setPaneData(&pane[i], m0A0[i]); + // fopMsgM_setNowAlpha(&pane[i], 0.0f); + // fopMsgM_setAlpha(&pane[i]); + // } } private proc_init3D(globals: dGlobals) { diff --git a/src/ZeldaWindWaker/d_place_name.ts b/src/ZeldaWindWaker/d_place_name.ts index 412ff74c1..2f9a9a546 100644 --- a/src/ZeldaWindWaker/d_place_name.ts +++ b/src/ZeldaWindWaker/d_place_name.ts @@ -104,9 +104,9 @@ export class d_place_name extends msg_class { } this.screen = new J2DScreen(screen, globals.renderer.renderCache); - this.screen.children[0].data.visible = false; - this.screen.children[1].data.visible = false; - const pic = this.screen.children[2] as J2DPicture; + this.screen.children[0].children[0].data.visible = false; + this.screen.children[0].children[1].data.visible = false; + const pic = this.screen.children[0].children[2] as J2DPicture; pic.setTexture(img); return cPhs__Status.Complete;