Example #1
0
void sprint8_state::screen_eof_sprint8(screen_device &screen, bool state)
{
	// rising edge
	if (state)
	{
		int x;
		int y;
		const rectangle &visarea = machine().primary_screen->visible_area();

		m_tilemap2->draw(m_helper2, visarea, 0, 0);

		m_helper1.fill(0x20, visarea);

		draw_sprites(m_helper1, visarea);

		for (y = visarea.min_y; y <= visarea.max_y; y++)
		{
			const UINT16* p1 = &m_helper1.pix16(y);
			const UINT16* p2 = &m_helper2.pix16(y);

			for (x = visarea.min_x; x <= visarea.max_x; x++)
				if (p1[x] != 0x20 && p2[x] == 0x23)
					machine().scheduler().timer_set(machine().primary_screen->time_until_pos(y + 24, x),
							timer_expired_delegate(FUNC(sprint8_state::sprint8_collision_callback),this),
							colortable_entry_get_value(machine().colortable, p1[x]));
		}
	}
}
Example #2
0
static UINT8 collision_check(colortable_t *colortable, rectangle* rect)
{
	UINT8 data = 0;

	int x;
	int y;

	for (y = rect->min_y; y <= rect->max_y; y++)
		for (x = rect->min_x; x <= rect->max_x; x++)
		{
			UINT16 a = colortable_entry_get_value(colortable, *BITMAP_ADDR16(helper, y, x));
			UINT16 b = colortable_entry_get_value(colortable, *BITMAP_ADDR16(helper2, y, x));

			if (b != 0)
				if ((a != 0) & (a != 0x40))
					data |= 0x01;
		}

	return data;
}
Example #3
0
UINT8 mermaid_state::collision_check( rectangle& rect )
{
	UINT8 data = 0;

	int x;
	int y;

	for (y = rect.min_y; y <= rect.max_y; y++)
		for (x = rect.min_x; x <= rect.max_x; x++)
		{
			UINT16 a = colortable_entry_get_value(machine().colortable, m_helper.pix16(y, x)) & 0x3f;
			UINT16 b = colortable_entry_get_value(machine().colortable, m_helper2.pix16(y, x)) & 0x3f;

			if (b)
				if (a)
					data |= 0x01;
		}

	return data;
}
Example #4
0
static void draw_water(colortable_t *colortable, bitmap_t* bitmap, const rectangle* cliprect)
{
	rectangle rect = *cliprect;

	int x;
	int y;

	if (rect.max_y > 127)
		rect.max_y = 127;

	for (y = rect.min_y; y <= rect.max_y; y++)
	{
		UINT16* p = BITMAP_ADDR16(bitmap, y, 0);

		for (x = rect.min_x; x <= rect.max_x; x++)
			p[x] = colortable_entry_get_value(colortable, p[x]) | 0x08;
	}
}
Example #5
0
static void draw_water(colortable_t *colortable, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
    rectangle rect = cliprect;

    int x;
    int y;

    if (rect.max_y > 127)
        rect.max_y = 127;

    for (y = rect.min_y; y <= rect.max_y; y++)
    {
        UINT16* p = &bitmap.pix16(y);

        for (x = rect.min_x; x <= rect.max_x; x++)
            p[x] = colortable_entry_get_value(colortable, p[x]) | 0x08;
    }
}
Example #6
0
static UINT8 collision_check(sprint2_state *state, colortable_t *colortable, rectangle& rect)
{
	UINT8 data = 0;

	int x;
	int y;

	for (y = rect.min_y; y <= rect.max_y; y++)
		for (x = rect.min_x; x <= rect.max_x; x++)
		{
			UINT16 a = colortable_entry_get_value(colortable, state->m_helper.pix16(y, x));

			if (a == 0)
				data |= 0x40;

			if (a == 3)
				data |= 0x80;
		}

	return data;
}
Example #7
0
static void draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int sprite_priority)
{
	tceptor_state *state = machine.driver_data<tceptor_state>();
	UINT16 *mem1 = &state->m_sprite_ram_buffered[0x000/2];
	UINT16 *mem2 = &state->m_sprite_ram_buffered[0x100/2];
	int need_mask = 0;
	int i;

	for (i = 0; i < 0x100; i += 2)
	{
		int scalex = (mem1[1 + i] & 0xfc00) << 1;
		int scaley = (mem1[0 + i] & 0xfc00) << 1;
		int pri = 7 - ((mem1[1 + i] & 0x3c0) >> 6);

		if (pri == sprite_priority && scalex && scaley)
		{
			int x = mem2[1 + i] & 0x3ff;
			int y = 512 - (mem2[0 + i] & 0x3ff);
			int flipx = mem2[0 + i] & 0x4000;
			int flipy = mem2[0 + i] & 0x8000;
			int color = mem1[1 + i] & 0x3f;
			int gfx;
			int code;

			if (mem2[0 + i] & 0x2000)
			{
				gfx = state->m_sprite32;
				code = mem1[0 + i] & 0x3ff;

			}
			else
			{
				gfx = state->m_sprite16;
				code = mem1[0 + i] & 0x1ff;
				scaley *= 2;
			}

			if (state->m_is_mask_spr[color])
			{
				if (!need_mask)
					// backup previous bitmap
					copybitmap(state->m_temp_bitmap, bitmap, 0, 0, 0, 0, cliprect);

				need_mask = 1;
			}

			// round off
			scalex += 0x800;
			scaley += 0x800;

			x -= 64;
			y -= 78;

			drawgfxzoom_transmask(bitmap,
			            cliprect,
			            machine.gfx[gfx],
			            code,
			            color,
			            flipx, flipy,
			            x, y,
			            scalex,
			            scaley,
			            colortable_get_transpen_mask(machine.colortable, machine.gfx[gfx], color, SPR_TRANS_COLOR));
		}
	}

	/* if SPR_MASK_COLOR pen is used, restore pixels from previous bitmap */
	if (need_mask)
	{
		int x, y;

		for (x = cliprect->min_x; x <= cliprect->max_x; x++)
			for (y = cliprect->min_y; y <= cliprect->max_y; y++)
				if (colortable_entry_get_value(machine.colortable, *BITMAP_ADDR16(bitmap, y, x)) == SPR_MASK_COLOR)
					// restore pixel
					*BITMAP_ADDR16(bitmap, y, x) = *BITMAP_ADDR16(state->m_temp_bitmap, y, x);
	}
}