Example #1
0
UINT32 darkmist_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
#define DM_GETSCROLL(n) (((m_scroll[(n)]<<1)&0xff) + ((m_scroll[(n)]&0x80)?1:0) +( ((m_scroll[(n)-1]<<4) | (m_scroll[(n)-1]<<12) )&0xff00))

	m_bgtilemap->set_scrollx(0, DM_GETSCROLL(0x2));
	m_bgtilemap->set_scrolly(0, DM_GETSCROLL(0x6));
	m_fgtilemap->set_scrollx(0, DM_GETSCROLL(0xa));
	m_fgtilemap->set_scrolly(0, DM_GETSCROLL(0xe));

	bitmap.fill(m_palette->black_pen(), cliprect);

	if(m_hw & DISPLAY_BG)
		m_bgtilemap->draw(screen, bitmap, cliprect, 0,0);

	if(m_hw & DISPLAY_FG)
		m_fgtilemap->draw(screen, bitmap, cliprect, 0,0);

	if(m_hw & DISPLAY_SPR)
	{
/*
    Sprites

    76543210
0 - TTTT TTTT - tile
1 - xyBP PPP? - palette (P), flips (x,y), B - use spritebank,
                ? - unknown, according to gamecode top bit of one of coords(y/x)
2 - YYYY YYYY - y coord
3 - XXXX XXXX - x coord

*/
		int i,fx,fy,tile,palette;
		for(i=0;i<m_spriteram.bytes();i+=32)
		{
			fy=m_spriteram[i+1]&0x40;
			fx=m_spriteram[i+1]&0x80;

			tile=m_spriteram[i+0];

			if(m_spriteram[i+1]&0x20)
				tile += (*m_spritebank << 8);

			palette=((m_spriteram[i+1])>>1)&0xf;

			if(m_spriteram[i+1]&0x1)
				palette=machine().rand()&15;

			palette+=32;


				m_gfxdecode->gfx(3)->transpen(
				bitmap,cliprect,
				tile,
				palette,
				fx,fy,
				m_spriteram[i+3],m_spriteram[i+2],0 );
		}
	}
Example #2
0
uint32_t darkmist_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
#define DM_GETSCROLL(n) (((m_scroll[(n)]<<1)&0xff) + ((m_scroll[(n)]&0x80)?1:0) +( ((m_scroll[(n)-1]<<4) | (m_scroll[(n)-1]<<12) )&0xff00))

	m_bgtilemap->set_scrollx(0, DM_GETSCROLL(0x2));
	m_bgtilemap->set_scrolly(0, DM_GETSCROLL(0x6));
	m_fgtilemap->set_scrollx(0, DM_GETSCROLL(0xa));
	m_fgtilemap->set_scrolly(0, DM_GETSCROLL(0xe));

	m_temp_bitmap.fill(0,cliprect);
	bitmap.fill(m_palette->black_pen(), cliprect);
	
	if(m_hw & DISPLAY_BG)
	{
		m_bgtilemap->draw(screen, m_temp_bitmap, cliprect, 0,0);
		mix_layer(screen, bitmap, cliprect, m_bg_clut);
	}
	
	if(m_hw & DISPLAY_FG)
	{
		m_fgtilemap->draw(screen, m_temp_bitmap, cliprect, 0,0);
		mix_layer(screen, bitmap, cliprect, m_fg_clut);
	}
	
	if(m_hw & DISPLAY_SPR)
	{
		draw_sprites(m_temp_bitmap,cliprect);
		mix_layer(screen, bitmap, cliprect, m_spr_clut);
	}

	if(m_hw & DISPLAY_TXT)
	{
		m_txtilemap->draw(screen, m_temp_bitmap, cliprect, 0,0);
		mix_layer(screen, bitmap, cliprect, m_tx_clut);
	}

	return 0;
}