fmtowns: fix missing pixels in single-layer modes

This commit is contained in:
r09 2018-01-04 21:59:30 +01:00
parent 03fc45b3f9
commit 683079c400
2 changed files with 15 additions and 58 deletions

View File

@ -378,7 +378,7 @@ public:
void render_sprite_16(uint32_t poffset, uint16_t x, uint16_t y, bool xflip, bool yflip, bool xhalfsize, bool yhalfsize, bool rotation, const rectangle* rect);
void draw_sprites(const rectangle* rect);
void towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline);
void towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline);
void towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int line,int scanline);
void towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline);
void towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* rect,int layer);
void render_text_char(uint8_t x, uint8_t y, uint8_t ascii, uint16_t jis, uint8_t attr);

View File

@ -1089,7 +1089,7 @@ void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const
else
off &= 0x7ffff; // 1 layer
colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)];
if(colour < 0x8000)
if(colour < 0x8000 || !(m_video.towns_video_reg[0] & 0x10))
{
for (pixel = 0; pixel < hzoom; pixel++)
bitmap.pix32(scanline, x+pixel) =
@ -1103,7 +1103,7 @@ void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const
}
}
void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline)
void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int line,int scanline)
{
int off = 0;
int x;
@ -1120,57 +1120,26 @@ void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rect
page = 1;
}
bool bottom_layer = (m_video.towns_video_reg[1] & 0x01) != layer;
// if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1))
// off = 0x20000;
if(layer == 0)
linesize = m_video.towns_crtc_reg[20] * 8;
else
linesize = m_video.towns_crtc_reg[24] * 8;
linesize = m_video.towns_crtc_reg[20] * 8;
if(layer != 0)
{
if(!(m_video.towns_video_reg[0] & 0x10))
return;
if(!(m_video.towns_crtc_reg[28] & 0x10))
off += m_video.towns_crtc_reg[21] << 3; // initial offset
else
{
scroll = ((m_video.towns_crtc_reg[21] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[21] & 0x3ff) << 3));
off += scroll;
}
hzoom = ((m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1;
off += (m_video.towns_crtc_reg[11] - m_video.towns_crtc_reg[22]) / hzoom;
}
if(!(m_video.towns_crtc_reg[28] & 0x20))
off += m_video.towns_crtc_reg[17] << 3; // initial offset
else
{
if(!(m_video.towns_crtc_reg[28] & 0x20))
off += m_video.towns_crtc_reg[17] << 3; // initial offset
else
{
scroll = ((m_video.towns_crtc_reg[17] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[17] & 0x3ff) << 3));
off += scroll;
}
hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1;
off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]) / hzoom;
scroll = ((m_video.towns_crtc_reg[17] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[17] & 0x3ff) << 3));
off += scroll;
}
hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1;
off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]) / hzoom;
off += line * linesize;
for(x=rect->min_x;x<rect->max_x;x+=hzoom)
{
if(m_video.towns_video_reg[0] & 0x10)
off &= 0x3ffff; // 2 layers
else
off &= 0x7ffff; // 1 layer
colour = m_towns_gfxvram[off+(layer*0x40000)];
if(colour != 0 || bottom_layer)
{
for (pixel = 0; pixel < hzoom; pixel++)
bitmap.pix32(scanline, x+pixel) = m_palette->pen(colour);
}
off &= 0x7ffff; // 256 color mode is single-layer only
colour = m_towns_gfxvram[off];
for (pixel = 0; pixel < hzoom; pixel++)
bitmap.pix32(scanline, x+pixel) = m_palette->pen(colour);
off++;
if ((off - (page * 0x20000)) % linesize == 0)
off -= linesize;
@ -1295,7 +1264,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re
{
do
{
towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline);
towns_crtc_draw_scan_layer_256(bitmap,rect,line,scanline);
scanline++;
count++;
} while(count < zoom);
@ -1339,18 +1308,6 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re
count = 0;
}
break;
case 0x08:
for(line=top;line<=bottom;line++)
{
do
{
towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline);
scanline++;
count++;
} while(count < zoom);
count = 0;
}
break;
case 0x0c:
for(line=top;line<=bottom;line++)
{