sms renderer, fix unaligned bg-filled tiles

This commit is contained in:
kub 2021-11-09 23:33:45 +01:00
parent b23725dd9f
commit d05e2eb3d6

View file

@ -60,9 +60,15 @@ static int CollisionDetect(u8 *mb, u16 sx, unsigned int pack, int zoomed)
static void TileBGM4(u16 sx, int pal) static void TileBGM4(u16 sx, int pal)
{ {
if (sx & 3) {
u8 *pd = (u8 *)(Pico.est.HighCol + sx);
pd[0] = pd[1] = pd[2] = pd[3] = pal;
pd[4] = pd[5] = pd[6] = pd[7] = pal;
} else {
u32 *pd = (u32 *)(Pico.est.HighCol + sx); u32 *pd = (u32 *)(Pico.est.HighCol + sx);
pd[0] = pd[1] = pal * 0x01010101; pd[0] = pd[1] = pal * 0x01010101;
} }
}
// 8 pixels are arranged in 4 bitplane bytes in a 32 bit word. To pull the // 8 pixels are arranged in 4 bitplane bytes in a 32 bit word. To pull the
// 4 bitplanes together multiply with each bit distance (multiples of 1<<7) // 4 bitplanes together multiply with each bit distance (multiples of 1<<7)