Compare commits
2 Commits
e915a88cbf
...
2d75d54f6b
| Author | SHA1 | Date |
|---|---|---|
|
|
2d75d54f6b | |
|
|
a48e731794 |
|
|
@ -369,6 +369,26 @@ func ReadData(raw []byte, tiles []*nesimg.Tile, isSprites bool) ([]*Layer, error
|
||||||
layers = append(layers, l)
|
layers = append(layers, l)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if offset != int(dataHeader.PaletteOffset) {
|
||||||
|
fmt.Printf("[[ offset != dataHeader.PaletteOffset: %04X != %04X ]]\n", offset, dataHeader.PaletteOffset)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Looks like the data after the palettes is just padding? If there's a non-zero
|
||||||
|
// byte in there, print a warning.
|
||||||
|
palend := int(dataHeader.PaletteOffset) + (8*4)
|
||||||
|
if palend < len(raw) {
|
||||||
|
nonzero := false
|
||||||
|
for i := palend; i < len(raw); i++ {
|
||||||
|
if raw[i] != 0x00 {
|
||||||
|
nonzero = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if nonzero {
|
||||||
|
fmt.Printf("[[ %d bytes of extra data ]]\n", len(raw) - palend)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return layers, nil
|
return layers, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -414,12 +434,6 @@ func (l *Layer) At(x, y int) color.Color {
|
||||||
|
|
||||||
tileIdx := (row*l.Width)+col
|
tileIdx := (row*l.Width)+col
|
||||||
|
|
||||||
if x == 89 && y == 101 {
|
|
||||||
fmt.Printf("row:%d col:%d tx:%d ty:%d tileIdx:%d width:%d height:%d l.Width:%d l.Height:%d\n",
|
|
||||||
row, col, tx, ty, tileIdx, width, height, l.Width, l.Height,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if l.Tiles[tileIdx] == nil {
|
if l.Tiles[tileIdx] == nil {
|
||||||
return color.RGBA{0x00, 0x00, 0x00, 0x00}
|
return color.RGBA{0x00, 0x00, 0x00, 0x00}
|
||||||
//return color.RGBA{0xFF, 0x00, 0xFF, 0xFF}
|
//return color.RGBA{0xFF, 0x00, 0xFF, 0xFF}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue