Ejemplo n.º 1
0
void gottlieb_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
	rectangle clip = cliprect;
	int offs;

	/* this is a temporary guess until the sprite hardware is better understood */
	/* there is some additional clipping, but this may not be it */
	clip.min_x = 8;

	for (offs = 0; offs < 256; offs += 4)
	{
		/* coordinates hand tuned to make the position correct in Q*Bert Qubes start */
		/* of level animation. */
		int sx = (m_spriteram[offs + 1]) - 4;
		int sy = (m_spriteram[offs]) - 13;
		int code = (255 ^ m_spriteram[offs + 2]) + 256 * m_spritebank;

		if (flip_screen_x()) sx = 233 - sx;
		if (flip_screen_y()) sy = 228 - sy;

		m_gfxdecode->gfx(2)->transpen(bitmap,clip,
		code, 0,
		flip_screen_x(), flip_screen_y(),
		sx,sy, 0);
	}
}
Ejemplo n.º 2
0
void arkanoid_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	int offs;

	for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
	{
		int sx, sy, code;

		sx = m_spriteram[offs];
		sy = 248 - m_spriteram[offs + 1];
		if (flip_screen_x())
			sx = 248 - sx;
		if (flip_screen_y())
			sy = 248 - sy;

		code = m_spriteram[offs + 3] + ((m_spriteram[offs + 2] & 0x03) << 8) + 1024 * m_gfxbank;

		drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
				2 * code,
				((m_spriteram[offs + 2] & 0xf8) >> 3) + 32 * m_palettebank,
				flip_screen_x(),flip_screen_y(),
				sx,sy + (flip_screen_y() ? 8 : -8),0);
		drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
				2 * code + 1,
				((m_spriteram[offs + 2] & 0xf8) >> 3) + 32 * m_palettebank,
				flip_screen_x(),flip_screen_y(),
				sx,sy,0);
	}
}
Ejemplo n.º 3
0
void tehkanwc_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	UINT8 *spriteram = m_spriteram;
	int offs;

	for (offs = 0;offs < m_spriteram.bytes();offs += 4)
	{
		int attr = spriteram[offs + 1];
		int code = spriteram[offs] + ((attr & 0x08) << 5);
		int color = attr & 0x07;
		int flipx = attr & 0x40;
		int flipy = attr & 0x80;
		int sx = spriteram[offs + 2] + ((attr & 0x20) << 3) - 128;
		int sy = spriteram[offs + 3];

		if (flip_screen_x())
		{
			sx = 240 - sx;
			flipx = !flipx;
		}

		if (flip_screen_y())
		{
			sy = 240 - sy;
			flipy = !flipy;
		}

		m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
			code, color, flipx, flipy, sx, sy, 0);
	}
}
Ejemplo n.º 4
0
void freekick_state::gigas_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	int offs;

	for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
	{
		int xpos = m_spriteram[offs + 3];
		int ypos = m_spriteram[offs + 2];
		int code = m_spriteram[offs + 0] | ((m_spriteram[offs + 1] & 0x20) << 3);

		int flipx = 0;
		int flipy = 0;
		int color = m_spriteram[offs + 1] & 0x1f;

		if (flip_screen_x())
		{
			xpos = 240 - xpos;
			flipx = !flipx;
		}
		if (flip_screen_y())
		{
			ypos = 256 - ypos;
			flipy = !flipy;
		}

		drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
				code,
				color,
				flipx,flipy,
				xpos,240-ypos,0);
	}
}
Ejemplo n.º 5
0
void buggychl_state::draw_fg( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	int offs;

	for (offs = 0; offs < 0x400; offs++)
	{
		int sx = offs % 32;
		int sy = offs / 32;
		int flipx = flip_screen_x();
		int flipy = flip_screen_y();

		int code = m_videoram[offs];

		if (flipx)
			sx = 31 - sx;
		if (flipy)
			sy = 31 - sy;

		drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
				code,
				0,
				flipx,flipy,
				8*sx,8*sy,
				0);
	}
}
Ejemplo n.º 6
0
void freekick_state::freekick_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	int offs;

	for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
	{
		int xpos = m_spriteram[offs + 3];
		int ypos = m_spriteram[offs + 0];
		int code = m_spriteram[offs + 1] + ((m_spriteram[offs + 2] & 0x20) << 3);

		int flipx = m_spriteram[offs + 2] & 0x80;    //?? unused ?
		int flipy = m_spriteram[offs + 2] & 0x40;
		int color = m_spriteram[offs + 2] & 0x1f;

		if (flip_screen_x())
		{
			xpos = 240 - xpos;
			flipx = !flipx;
		}
		if (flip_screen_y())
		{
			ypos = 256 - ypos;
			flipy = !flipy;
		}

		m_gfxdecode->gfx(1)->transpen(m_palette,bitmap,cliprect,
				code,
				color,
				flipx,flipy,
				xpos,248-ypos,0);
	}
}
Ejemplo n.º 7
0
UINT32 sshangha_state::screen_update_sshangha(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
	m_sprgen1->draw_sprites(bitmap, cliprect, m_spriteram, 0x800, true);

	// I'm pretty sure only the original has the 2nd spriteram, used for the Japanese text on the 2nd scene (non-scrolling text) in the intro of the quest (3rd in JPN) mode
	if (m_spriteram2 != NULL)
		m_sprgen2->draw_sprites(bitmap, cliprect, m_spriteram2, 0x800, true);

	machine().tilemap().set_flip_all(flip_screen_x() ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);

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

	m_deco_tilegen1->pf_update(m_pf1_rowscroll, m_pf2_rowscroll);

	/* the tilemap 4bpp + 4bpp = 8bpp mixing actually seems external to the tilemap, note video_control is not part of the tilemap chip */
	if ((m_video_control&4)==0) {
		m_deco_tilegen1->tilemap_12_combine_draw(screen, bitmap, cliprect, 0, 0, 1);
		m_sprgen1->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x0200, 0x0200, 0x100, 0x1ff);
	}
	else {
		m_deco_tilegen1->tilemap_2_draw(screen, bitmap, cliprect, 0, 0);
		m_sprgen1->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x0200, 0x0200, 0x100, 0x1ff);
		m_deco_tilegen1->tilemap_1_draw(screen, bitmap, cliprect, 0, 0);
	}

	if (m_spriteram2 != NULL)
		m_sprgen2->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x0000, 0x0000, 0, 0x1ff);

	m_sprgen1->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x0000, 0x0200, 0, 0x1ff);
	return 0;
}
Ejemplo n.º 8
0
void freekick_state::pbillrd_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	int offs;

	for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
	{
		int xpos = m_spriteram[offs + 3];
		int ypos = m_spriteram[offs + 2];
		int code = m_spriteram[offs + 0];

		int flipx = 0;//m_spriteram[offs + 0] & 0x80; //?? unused ?
		int flipy = 0;//m_spriteram[offs + 0] & 0x40;
		int color = m_spriteram[offs + 1] & 0x0f;

		if (flip_screen_x())
		{
			xpos = 240 - xpos;
			flipx = !flipx;
		}
		if (flip_screen_y())
		{
			ypos = 256 - ypos;
			flipy = !flipy;
		}

		m_gfxdecode->m_gfx[1]->transpen(bitmap,cliprect,
				code,
				color,
				flipx,flipy,
				xpos,240-ypos,0);
	}
}
Ejemplo n.º 9
0
void buggychl_state::draw_bg( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	int offs;
	int scroll[256];

	/* prevent wraparound */
	rectangle clip = cliprect;
	// enable clipping if on (title screen disable this to cover all of the area)
	if(m_bg_clip_on)
	{
		if (flip_screen_x()) clip.min_x += 8*8;
		else clip.max_x -= 8*8;
	}

	for (offs = 0; offs < 0x400; offs++)
	{
		int code = m_videoram[0x400 + offs];

		int sx = offs % 32;
		int sy = offs / 32;

		if (flip_screen_x())
			sx = 31 - sx;
		if (flip_screen_y())
			sy = 31 - sy;

		m_gfxdecode->gfx(0)->opaque(m_tmp_bitmap1,m_tmp_bitmap1.cliprect(),
				code,
				2,
				flip_screen_x(),flip_screen_y(),
				8*sx,8*sy);
	}

	/* first copy to a temp bitmap doing column scroll */
	for (offs = 0; offs < 256; offs++)
		scroll[offs] = -m_scrollv[offs / 8];

	copyscrollbitmap(m_tmp_bitmap2, m_tmp_bitmap1, 1, &m_bg_scrollx, 256, scroll, m_tmp_bitmap2.cliprect());

	/* then copy to the screen doing row scroll */
	for (offs = 0; offs < 256; offs++)
		scroll[offs] = -m_scrollh[offs];

	copyscrollbitmap_trans(bitmap, m_tmp_bitmap2, 256, scroll, 0, nullptr, clip, 32);
}
Ejemplo n.º 10
0
void buggychl_state::draw_bg( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	int offs;
	int scroll[256];

	/* prevent wraparound */
	rectangle clip = cliprect;
	if (flip_screen_x()) clip.min_x += 8*8;
	else clip.max_x -= 8*8;

	for (offs = 0; offs < 0x400; offs++)
	{
		int code = m_videoram[0x400 + offs];

		int sx = offs % 32;
		int sy = offs / 32;

		if (flip_screen_x())
			sx = 31 - sx;
		if (flip_screen_y())
			sy = 31 - sy;

		drawgfx_opaque(m_tmp_bitmap1, m_tmp_bitmap1.cliprect(), machine().gfx[0],
				code,
				2,
				flip_screen_x(),flip_screen_y(),
				8*sx,8*sy);
	}

	/* first copy to a temp bitmap doing column scroll */
	for (offs = 0; offs < 256; offs++)
		scroll[offs] = -m_scrollv[offs / 8];

	copyscrollbitmap(m_tmp_bitmap2, m_tmp_bitmap1, 1, &m_bg_scrollx, 256, scroll, m_tmp_bitmap2.cliprect());

	/* then copy to the screen doing row scroll */
	for (offs = 0; offs < 256; offs++)
		scroll[offs] = -m_scrollh[offs];

	copyscrollbitmap_trans(bitmap, m_tmp_bitmap2, 256, scroll, 0, 0, clip, 32);
}
Ejemplo n.º 11
0
void mermaid_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	const rectangle spritevisiblearea(0 * 8, 26 * 8 - 1, 2 * 8, 30 * 8 - 1);
	const rectangle flip_spritevisiblearea(6 * 8, 31 * 8 - 1, 2 * 8, 30 * 8 - 1);

	UINT8 *spriteram = m_spriteram;
	int offs;

	for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
	{
		int attr = spriteram[offs + 2];
		int bank = (attr & 0x30) >> 4;
		int code = (spriteram[offs] & 0x3f) | (bank << 6);
		int color = attr & 0x0f;
		int flipx = spriteram[offs] & 0x40;
		int flipy = spriteram[offs] & 0x80;
		int sx = spriteram[offs + 3] + 1;
		int sy = 240 - spriteram[offs + 1];

		if (sx >= 0xf0) sx -= 256;

		code |= m_rougien_gfxbank1 * 0x2800;
		code |= m_rougien_gfxbank2 * 0x2400;

		if (flip_screen_x())
		{
			flipx = !flipx;
			sx = 240 - sx;
		}

		if (flip_screen_y())
		{
			flipy = !flipy;
			sy = 240 - sy;
		}


			m_gfxdecode->gfx(1)->transpen(bitmap,(flip_screen_x() ? flip_spritevisiblearea : spritevisiblearea), code, color, flipx, flipy, sx, sy, 0);
	}
}
Ejemplo n.º 12
0
UINT32 pturn_state::screen_update_pturn(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	UINT8 *spriteram = m_spriteram;
	int offs;
	int sx, sy;
	int flipx, flipy;

	bitmap.fill(m_bgcolor, cliprect);
	m_bgmap->draw(screen, bitmap, cliprect, 0,0);
	for ( offs = 0x80-4 ; offs >=0 ; offs -= 4)
	{
		sy=256-spriteram[offs]-16 ;
		sx=spriteram[offs+3]-16 ;

		flipx=spriteram[offs+1]&0x40;
		flipy=spriteram[offs+1]&0x80;


		if (flip_screen_x())
		{
			sx = 224 - sx;
			flipx ^= 0x40;
		}

		if (flip_screen_y())
		{
			flipy ^= 0x80;
			sy = 224 - sy;
		}

		if(sx|sy)
		{
			m_gfxdecode->gfx(2)->transpen(m_palette,bitmap,cliprect,
			spriteram[offs+1] & 0x3f ,
			(spriteram[offs+2] & 0x1f),
			flipx, flipy,
			sx,sy,0);
		}
	}
	m_fgmap->draw(screen, bitmap, cliprect, 0,0);
	return 0;
}
Ejemplo n.º 13
0
UINT32 pturn_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	bitmap.fill(m_bgcolor, cliprect);
	m_bgmap->draw(screen, bitmap, cliprect, 0,0);
	for (int offs = 0x80-4 ; offs >=0 ; offs -= 4)
	{
		int sy=256-m_spriteram[offs]-16 ;
		int sx=m_spriteram[offs+3]-16 ;

		int flipx=m_spriteram[offs+1]&0x40;
		int flipy=m_spriteram[offs+1]&0x80;


		if (flip_screen_x())
		{
			sx = 224 - sx;
			flipx ^= 0x40;
		}

		if (flip_screen_y())
		{
			flipy ^= 0x80;
			sy = 224 - sy;
		}

		if(sx|sy)
		{
			m_gfxdecode->m_gfx[2]->transpen(bitmap,cliprect,
			m_spriteram[offs+1] & 0x3f ,
			(m_spriteram[offs+2] & 0x1f),
			flipx, flipy,
			sx,sy,0);
		}
	}
	m_fgmap->draw(screen, bitmap, cliprect, 0,0);
	return 0;
}
Ejemplo n.º 14
0
void wyvernf0_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, bool is_foreground )
{
	int offs;
/*
1st boss:
YY       XX
71 1D 02 60 <- head
81 73 02 80 <- left neck
81 71 02 A0 <- left body
61 74 02 80 <- right neck
61 72 02 A0 <- right body
71 6C 02 C0 <- tail
41 E5 02 60 <- right arm
41 E4 02 80 <- right shoulder
41 6B 02 A0 <- right wing
A1 65 02 60 <- left arm
A1 EB 02 A0 <- left wing
A1 64 02 80 <- left shoulder

player+target:
YY       XX
71 11 04 a8 <- target
71 01 0f 50 <- player

yyyyyyyy fccccccc x???pppp xxxxxxxx

*/
	uint8_t *sprram = &m_spriteram[ is_foreground ? m_spriteram.bytes()/2 : 0 ];

	// sy = 0 -> on the left
	for (offs = 0; offs < m_spriteram.bytes() / 2; offs += 4)
	{
		int sx, sy, code, color;

		sx = sprram[offs + 3] - ((sprram[offs + 2] & 0x80) << 1);
		sy = 256 - 8 - sprram[offs + 0] - 23;   // center player sprite: 256 - 8 - 0x71 + dy = 256/2-32/2 -> dy = -23

//      int flipx = sprram[offs + 2] & 0x40;    // nope
		int flipx = 0;
		int flipy = sprram[offs + 1] & 0x80;

		if (flip_screen_x())
		{
			flipx = !flipx;
			sx = 256 - 8 - sx - 3*8;
		}
		if (flip_screen_y())
		{
			flipy = !flipy;
			sy = 256 - 8 - sy - 3*8;
		}

		code = sprram[offs + 1] & 0x7f;
		color = (sprram[offs + 2] & 0x0f);

		if (is_foreground)
		{
			code  += 0x80;
			color += 0x10;
		}

		for (int y = 0; y < 4; y++)
		{
			for (int x = 0; x < 4; x++)
			{
				int objoffs = code * 0x20 + (x + y * 4) * 2;

				m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
						(m_objram[objoffs + 1] << 8) + m_objram[objoffs],
						color,
						flipx, flipy,
						sx + (flipx ? 3-x : x) * 8, sy + (flipy ? 3-y : y) * 8, 0);
			}
		}
	}
}
Ejemplo n.º 15
0
void buggychl_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	UINT8 *spriteram = m_spriteram;
	int offs;
	const UINT8 *gfx;

	g_profiler.start(PROFILER_USER1);

	gfx = memregion("gfx2")->base();
	for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
	{
		int sx, sy, flipy, zoom, ch, x, px, y;
		const UINT8 *lookup;
		const UINT8 *zoomx_rom, *zoomy_rom;

		sx = spriteram[offs + 3] - ((spriteram[offs + 2] & 0x80) << 1);
		sy = 256 - 64 - spriteram[offs] + ((spriteram[offs + 1] & 0x80) << 1);
		flipy = spriteram[offs + 1] & 0x40;
		zoom = spriteram[offs + 1] & 0x3f;
		zoomy_rom = gfx + (zoom << 6);
		zoomx_rom = gfx + 0x2000 + (zoom << 3);

		lookup = m_sprite_lookup + ((spriteram[offs + 2] & 0x7f) << 6);

		for (y = 0; y < 64; y++)
		{
			int dy = flip_screen_y() ? (255 - sy - y) : (sy + y);

			if ((dy & ~0xff) == 0)
			{
				int charline, base_pos;

				charline = zoomy_rom[y] & 0x07;
				base_pos = zoomy_rom[y] & 0x38;
				if (flipy)
					base_pos ^= 0x38;

				px = 0;
				for (ch = 0; ch < 4; ch++)
				{
					int pos, code, realflipy;
					const UINT8 *pendata;

					pos = base_pos + 2 * ch;
					code = 8 * (lookup[pos] | ((lookup[pos + 1] & 0x07) << 8));
					realflipy = (lookup[pos + 1] & 0x80) ? !flipy : flipy;
					code += (realflipy ? (charline ^ 7) : charline);
					pendata = machine().gfx[1]->get_data(code);

					for (x = 0; x < 16; x++)
					{
						int col = pendata[x];
						if (col)
						{
							int dx = flip_screen_x() ? (255 - sx - px) : (sx + px);
							if ((dx & ~0xff) == 0)
								bitmap.pix16(dy, dx) = m_sprite_color_base + col;
						}

						/* the following line is almost certainly wrong */
						if (zoomx_rom[7 - (2 * ch + x / 8)] & (1 << (x & 7)))
							px++;
					}
				}
			}
		}
	}

	g_profiler.stop();
}
Ejemplo n.º 16
0
void lkage_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	const UINT8 *source = m_spriteram;
	const UINT8 *finish = source + 0x60;

	while (source < finish)
	{
		int attributes = source[2];
		/* 0x01: horizontal flip
		 * 0x02: vertical flip
		 * 0x04: bank select
		 * 0x08: sprite size
		 * 0x70: color
		 * 0x80: priority
		 */
		int priority_mask = 0;
		int color = (attributes >> 4) & 7;
		int flipx = attributes & 0x01;
		int flipy = attributes & 0x02;
		int height = (attributes & 0x08) ? 2 : 1;
		int sx = source[0] - 15 + m_sprite_dx;
		int sy = 256 - 16 * height - source[1];
		int sprite_number = source[3] + ((attributes & 0x04) << 6);
		int y;

		if (attributes & 0x80)
		{
			priority_mask = (0xf0 | 0xcc);
		}
		else
		{
			priority_mask = 0xf0;
		}

		if (flip_screen_x())
		{
			sx = 239 - sx - 24;
			flipx = !flipx;
		}
		if (flip_screen_y())
		{
			sy = 254 - 16 * height - sy;
			flipy = !flipy;
		}
		if (height == 2 && !flipy)
		{
			sprite_number ^= 1;
		}

		for (y = 0; y < height; y++)
		{
			m_gfxdecode->gfx(1)->prio_transpen(
				bitmap,
				cliprect,
				sprite_number ^ y,
				color,
				flipx,flipy,
				sx&0xff,
				sy + 16*y,
				screen.priority(),
				priority_mask,0 );
		}
		source += 4;
	}
}
Ejemplo n.º 17
0
void mermaid_state::screen_eof_mermaid(screen_device &screen, bool state)
{
	// rising edge
	if (state)
	{
		const rectangle &visarea = m_screen->visible_area();
		UINT8 *spriteram = m_spriteram;

		int offs, offs2;

		m_coll_bit0 = 0;
		m_coll_bit1 = 0;
		m_coll_bit2 = 0;
		m_coll_bit3 = 0;
		m_coll_bit6 = 0;

		// check for bit 0 (sprite-sprite), 1 (sprite-foreground), 2 (sprite-background)

		for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
		{
			int attr = spriteram[offs + 2];
			int bank = (attr & 0x30) >> 4;
			int coll = (attr & 0xc0) >> 6;
			int code = (spriteram[offs] & 0x3f) | (bank << 6);
			int flipx = spriteram[offs] & 0x40;
			int flipy = spriteram[offs] & 0x80;
			int sx = spriteram[offs + 3] + 1;
			int sy = 240 - spriteram[offs + 1];

			rectangle rect;

			if (coll != 1) continue;

			code |= m_rougien_gfxbank1 * 0x2800;
			code |= m_rougien_gfxbank2 * 0x2400;

			if (flip_screen_x())
			{
				flipx = !flipx;
				sx = 240 - sx;
			}

			if (flip_screen_y())
			{
				flipy = !flipy;
				sy = 240 - sy;
			}

			rect.min_x = sx;
			rect.min_y = sy;
			rect.max_x = sx + m_gfxdecode->gfx(1)->width() - 1;
			rect.max_y = sy + m_gfxdecode->gfx(1)->height() - 1;

			rect &= visarea;

			// check collision sprite - background

			m_helper.fill(0, rect);
			m_helper2.fill(0, rect);

			m_bg_tilemap->draw(screen, m_helper, rect, 0, 0);

			m_gfxdecode->gfx(1)->transpen(m_helper2,rect, code, 0, flipx, flipy, sx, sy, 0);

			m_coll_bit2 |= collision_check(rect);

			// check collision sprite - foreground

			m_helper.fill(0, rect);
			m_helper2.fill(0, rect);

			m_fg_tilemap->draw(screen, m_helper, rect, 0, 0);

			m_gfxdecode->gfx(1)->transpen(m_helper2,rect, code, 0, flipx, flipy, sx, sy, 0);

			m_coll_bit1 |= collision_check(rect);

			// check collision sprite - sprite

			m_helper.fill(0, rect);
			m_helper2.fill(0, rect);

			for (offs2 = m_spriteram.bytes() - 4; offs2 >= 0; offs2 -= 4)
				if (offs != offs2)
				{
					int attr2 = spriteram[offs2 + 2];
					int bank2 = (attr2 & 0x30) >> 4;
					int coll2 = (attr2 & 0xc0) >> 6;
					int code2 = (spriteram[offs2] & 0x3f) | (bank2 << 6);
					int flipx2 = spriteram[offs2] & 0x40;
					int flipy2 = spriteram[offs2] & 0x80;
					int sx2 = spriteram[offs2 + 3] + 1;
					int sy2 = 240 - spriteram[offs2 + 1];

					if (coll2 != 0) continue;

					code2 |= m_rougien_gfxbank1 * 0x2800;
					code2 |= m_rougien_gfxbank2 * 0x2400;

					if (flip_screen_x())
					{
						flipx2 = !flipx2;
						sx2 = 240 - sx2;
					}

					if (flip_screen_y())
					{
						flipy2 = !flipy2;
						sy2 = 240 - sy2;
					}

					m_gfxdecode->gfx(1)->transpen(m_helper,rect, code2, 0, flipx2, flipy2, sx2, sy2, 0);
				}

			m_gfxdecode->gfx(1)->transpen(m_helper2,rect, code, 0, flipx, flipy, sx, sy, 0);

			m_coll_bit0 |= collision_check(rect);
		}

		// check for bit 3 (sprite-sprite)

		for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
		{
			int attr = spriteram[offs + 2];
			int bank = (attr & 0x30) >> 4;
			int coll = (attr & 0xc0) >> 6;
			int code = (spriteram[offs] & 0x3f) | (bank << 6);
			int flipx = spriteram[offs] & 0x40;
			int flipy = spriteram[offs] & 0x80;
			int sx = spriteram[offs + 3] + 1;
			int sy = 240 - spriteram[offs + 1];

			rectangle rect;

			if (coll != 2) continue;

			code |= m_rougien_gfxbank1 * 0x2800;
			code |= m_rougien_gfxbank2 * 0x2400;

			if (flip_screen_x())
			{
				flipx = !flipx;
				sx = 240 - sx;
			}

			if (flip_screen_y())
			{
				flipy = !flipy;
				sy = 240 - sy;
			}

			rect.min_x = sx;
			rect.min_y = sy;
			rect.max_x = sx + m_gfxdecode->gfx(1)->width() - 1;
			rect.max_y = sy + m_gfxdecode->gfx(1)->height() - 1;

			rect &= visarea;

			// check collision sprite - sprite

			m_helper.fill(0, rect);
			m_helper2.fill(0, rect);

			for (offs2 = m_spriteram.bytes() - 4; offs2 >= 0; offs2 -= 4)
				if (offs != offs2)
				{
					int attr2 = spriteram[offs2 + 2];
					int bank2 = (attr2 & 0x30) >> 4;
					int coll2 = (attr2 & 0xc0) >> 6;
					int code2 = (spriteram[offs2] & 0x3f) | (bank2 << 6);
					int flipx2 = spriteram[offs2] & 0x40;
					int flipy2 = spriteram[offs2] & 0x80;
					int sx2 = spriteram[offs2 + 3] + 1;
					int sy2 = 240 - spriteram[offs2 + 1];

					if (coll2 != 0) continue;

					code2 |= m_rougien_gfxbank1 * 0x2800;
					code2 |= m_rougien_gfxbank2 * 0x2400;

					if (flip_screen_x())
					{
						flipx2 = !flipx2;
						sx2 = 240 - sx2;
					}

					if (flip_screen_y())
					{
						flipy2 = !flipy2;
						sy2 = 240 - sy2;
					}

					m_gfxdecode->gfx(1)->transpen(m_helper,rect, code2, 0, flipx2, flipy2, sx2, sy2, 0);
				}

			m_gfxdecode->gfx(1)->transpen(m_helper2,rect, code, 0, flipx, flipy, sx, sy, 0);

			m_coll_bit3 |= collision_check(rect);
		}