mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-10-27 00:29:39 -04:00
sms, renderer fixes (sprite y wrap, bg in 1st col, mode 1->mode 0)
This commit is contained in:
parent
63fb265fac
commit
68e7a5c1c0
1 changed files with 11 additions and 9 deletions
20
pico/mode4.c
20
pico/mode4.c
|
|
@ -3,7 +3,7 @@
|
||||||
* (C) notaz, 2009-2010
|
* (C) notaz, 2009-2010
|
||||||
* (C) kub, 2021
|
* (C) kub, 2021
|
||||||
*
|
*
|
||||||
* currently supports VDP mode 4 (SMS and GG) and mode 2
|
* currently supports VDP mode 4 (SMS and GG) and mode 2+0 (TMS)
|
||||||
*
|
*
|
||||||
* This work is licensed under the terms of MAME license.
|
* This work is licensed under the terms of MAME license.
|
||||||
* See COPYING file in the top-level directory.
|
* See COPYING file in the top-level directory.
|
||||||
|
|
@ -43,7 +43,7 @@ static int CollisionDetect(u8 *mb, u16 sx, unsigned int pack, int zoomed)
|
||||||
}
|
}
|
||||||
|
|
||||||
// invisible overscan area, not tested for collision
|
// invisible overscan area, not tested for collision
|
||||||
mb[0] = mb[33] = 0;
|
mb[0] = mb[33] = mb[34] = 0;
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,6 +173,8 @@ static void DrawSpritesM4(int scanline)
|
||||||
y = (sat[MEM_LE2(i)] + 1) & 0xff;
|
y = (sat[MEM_LE2(i)] + 1) & 0xff;
|
||||||
if (y == 0xd1 && !((pv->reg[0] & 6) == 6 && (pv->reg[1] & 0x18)))
|
if (y == 0xd1 && !((pv->reg[0] & 6) == 6 && (pv->reg[1] & 0x18)))
|
||||||
break;
|
break;
|
||||||
|
if (y > 0xe0)
|
||||||
|
y -= 256;
|
||||||
if (y + h <= scanline || scanline < y)
|
if (y + h <= scanline || scanline < y)
|
||||||
continue; // not on this line
|
continue; // not on this line
|
||||||
if (s >= 8) {
|
if (s >= 8) {
|
||||||
|
|
@ -295,7 +297,7 @@ static void DrawDisplayM4(int scanline)
|
||||||
if ((pv->reg[0] & 0x20) && (Pico.m.hardware & 0x3) != 0x3) {
|
if ((pv->reg[0] & 0x20) && (Pico.m.hardware & 0x3) != 0x3) {
|
||||||
// first column masked with background, caculate offset to start of line
|
// first column masked with background, caculate offset to start of line
|
||||||
dx = (dx&~0x1f) / 4;
|
dx = (dx&~0x1f) / 4;
|
||||||
ty = 0xe0e0e0e0; // really (pv->reg[7]&0x3f) * 0x01010101, but the looks...
|
ty = ((pv->reg[7]&0x0f)|0x10) * 0x01010101;
|
||||||
((u32 *)Pico.est.HighCol)[dx+2] = ((u32 *)Pico.est.HighCol)[dx+3] = ty;
|
((u32 *)Pico.est.HighCol)[dx+2] = ((u32 *)Pico.est.HighCol)[dx+3] = ty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -435,7 +437,7 @@ static void DrawSpritesTMS(int scanline)
|
||||||
else if (c) TileNormSprTMS(x, pack, c);
|
else if (c) TileNormSprTMS(x, pack, c);
|
||||||
if (!m) m = CollisionDetect(mb, x, pack, zoomed);
|
if (!m) m = CollisionDetect(mb, x, pack, zoomed);
|
||||||
}
|
}
|
||||||
if((pv->reg[1] & 0x2) && (x+=w) > 0) {
|
if((pv->reg[1] & 0x2) && (x+=w) > 0 && x < 8+256) {
|
||||||
pack = PicoMem.vramb[MEM_LE2(sprites_addr[s]+0x10)];
|
pack = PicoMem.vramb[MEM_LE2(sprites_addr[s]+0x10)];
|
||||||
if (zoomed && c) TileDoubleSprTMS(x, pack, c);
|
if (zoomed && c) TileDoubleSprTMS(x, pack, c);
|
||||||
else if (c) TileNormSprTMS(x, pack, c);
|
else if (c) TileNormSprTMS(x, pack, c);
|
||||||
|
|
@ -496,11 +498,11 @@ static void DrawDisplayM2(int scanline)
|
||||||
DrawSpritesTMS(scanline);
|
DrawSpritesTMS(scanline);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mode 1 */
|
/* Mode 0 */
|
||||||
/*========*/
|
/*========*/
|
||||||
|
|
||||||
/* Draw the background into a scanline; cells, dx, tilex, ty merged to reduce registers */
|
/* Draw the background into a scanline; cells, dx, tilex, ty merged to reduce registers */
|
||||||
static void DrawStripM1(const u8 *nametab, const u8 *coltab, const u8 *pattab, int cells_dx, int tilex_ty)
|
static void DrawStripM0(const u8 *nametab, const u8 *coltab, const u8 *pattab, int cells_dx, int tilex_ty)
|
||||||
{
|
{
|
||||||
// Draw tiles across screen:
|
// Draw tiles across screen:
|
||||||
for (; cells_dx > 0; cells_dx += 8, tilex_ty++, cells_dx -= 0x10000)
|
for (; cells_dx > 0; cells_dx += 8, tilex_ty++, cells_dx -= 0x10000)
|
||||||
|
|
@ -516,7 +518,7 @@ static void DrawStripM1(const u8 *nametab, const u8 *coltab, const u8 *pattab, i
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw a scanline */
|
/* Draw a scanline */
|
||||||
static void DrawDisplayM1(int scanline)
|
static void DrawDisplayM0(int scanline)
|
||||||
{
|
{
|
||||||
struct PicoVideo *pv = &Pico.video;
|
struct PicoVideo *pv = &Pico.video;
|
||||||
u8 *nametab, *coltab, *pattab;
|
u8 *nametab, *coltab, *pattab;
|
||||||
|
|
@ -538,7 +540,7 @@ static void DrawDisplayM1(int scanline)
|
||||||
|
|
||||||
// tiles
|
// tiles
|
||||||
if (!(pv->debug_p & PVD_KILL_B))
|
if (!(pv->debug_p & PVD_KILL_B))
|
||||||
DrawStripM1(nametab, coltab, pattab, dx | (cells << 16), tilex | (scanline << 16));
|
DrawStripM0(nametab, coltab, pattab, dx | (cells << 16), tilex | (scanline << 16));
|
||||||
|
|
||||||
// sprites
|
// sprites
|
||||||
if (!(pv->debug_p & PVD_KILL_S_LO))
|
if (!(pv->debug_p & PVD_KILL_S_LO))
|
||||||
|
|
@ -636,7 +638,7 @@ void PicoLineSMS(int line)
|
||||||
if (Pico.video.reg[1] & 0x40) {
|
if (Pico.video.reg[1] & 0x40) {
|
||||||
if (Pico.video.reg[0] & 0x04) DrawDisplayM4(line);
|
if (Pico.video.reg[0] & 0x04) DrawDisplayM4(line);
|
||||||
else if (Pico.video.reg[0] & 0x02) DrawDisplayM2(line);
|
else if (Pico.video.reg[0] & 0x02) DrawDisplayM2(line);
|
||||||
else DrawDisplayM1(line);
|
else DrawDisplayM0(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FinalizeLineSMS != NULL)
|
if (FinalizeLineSMS != NULL)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue