Пример #1
0
func (m Map) BorderImage() []*image.NRGBA {
	ts := m.Tileset()
	l := m.Border()
	return []*image.NRGBA{
		pkm.DrawImage(l, ts, 0),
		pkm.DrawImage(l, ts, 1),
	}
}
Пример #2
0
func (m Map) Image() []*image.NRGBA {
	ts := m.Tileset()
	l := m.Layout()
	return []*image.NRGBA{
		pkm.DrawImage(l, ts, 0),
		pkm.DrawImage(l, ts, 1),
	}
}
Пример #3
0
func (m Map) TilesetImage(width int) []*image.NRGBA {
	if width < 1 {
		width = 0x400
	}
	b := readStruct(
		m.v.ROM,
		m.headerPtr(),
		0,
		structMapHeader,
		0,
	)
	b = readStruct(
		m.v.ROM,
		decPtr(b),
		0,
		structMapLayoutData,
		4, 5,
	)

	ts := m.Tileset()

	height := 0x400 / width
	if 0x400%width != 0 {
		height++
	}

	l := _layout{
		width:  width,
		height: height,
		cells:  make([]byte, width*height*2),
	}
	for i := 0; i < 0x400; i++ {
		binary.LittleEndian.PutUint16(l.cells[i*2:], uint16(i))
	}
	return []*image.NRGBA{
		pkm.DrawImage(l, ts, 0),
		pkm.DrawImage(l, ts, 1),
	}
}