Skip to navigation

Landscape: SmoothTileCorners (Part 4 of 4)

Name: SmoothTileCorners (Part 4 of 4) [Show more] Type: Subroutine Category: Landscape Summary: Copy the smoothed strip data back into the tileData table
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file

This part copies the smoothed strip back into the tileData table.
.stri16 \ By this point we have smoothed the whole strip, so we \ can now copy the smoothed tile data back into the \ tileData table LDX #31 \ Set A counter in X to work through the tile data for \ the 32 tiles in the strip we just smoothed .stri17 TXA \ Set A to the tile index BIT processAction \ If bit 7 of processAction is clear then we are BPL stri18 \ smoothing a row of tiles at z-coordinate zTile, so \ jump to stri18 to iterate across xTile STA zTile \ If we get here then we are smoothing a column of tiles \ so set zTile to the counter in X so we iterate along \ the z-coordinate (i.e. coming out of the screen) JMP stri19 \ Jump to stri19 to skip the following .stri18 STA xTile \ If we get here then we are smoothing a row of tiles \ so set xTile to the counter in X so we iterate along \ the x-coordinate (i.e. from right to left) .stri19 JSR GetTileData \ Set A to the tile data for the tile anchored at \ (xTile, zTile), which we ignore, but this also sets \ the tile page in tileDataPage and the index in Y, so \ tileDataPage+Y now points to the tile data entry in \ the tileData table LDA stripData,X \ Copy the X-th byte of tile data from the smoothed STA (tileDataPage),Y \ strip into the corresponding entry for (xTile, zTile) \ in the tileData table DEX \ Decrement the tile counter in X so we work our way \ along to the next tile in the strip we are smoothing BPL stri17 \ Loop back to smooth the next tile until we have \ smoothed the whole strip RTS \ Return from the subroutine