diff --git a/src/Common/JSYSTEM/J2Dv1.ts b/src/Common/JSYSTEM/J2Dv1.ts index b85b355a1..5785bff27 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_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;