Skip to content

Commit 609a9f1

Browse files
committed
Got window working, but has a weird duplication of first tile
1 parent c969a40 commit 609a9f1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

core/graphics/pixelPipeline/pixelPipeline.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,17 @@ function _tryToFetchWindow(): boolean {
197197
let tileLine: i32 = Graphics.scanlineRegister - windowY;
198198
tileLine = tileLine & 7;
199199

200-
// Find the x/y coordinates of the tile on the 256x256 Bg map
201-
let pixelXPositionInMap = PixelFifo.currentIndex + windowX;
200+
// Find the x/y coordinates of the tile
201+
202+
// Get our Current X position of our pixel on the on the 160x144 camera
203+
// this is done by getting the current scroll X position,
204+
// and adding it do what X Value the scanline is drawing on the camera.
205+
let pixelXPositionInMap = PixelFifo.currentIndex - windowX;
202206
// This is to compensate wrapping
203207
if (pixelXPositionInMap >= 0x100) {
204208
pixelXPositionInMap -= 0x100;
205209
}
210+
// Get our current pixel y positon on the 160x144 camera (Row that the scanline draws across)
206211
let pixelYPositionInMap = Graphics.scanlineRegister - windowY;
207212

208213
// Get the location of our tileId on the tileMap

0 commit comments

Comments
 (0)