コード例 #1
0
ファイル: trackfld.c プロジェクト: j4y4r/j4ymame
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	trackfld_state *state = machine.driver_data<trackfld_state>();
	UINT8 *spriteram = state->m_spriteram;
	UINT8 *spriteram_2 = state->m_spriteram2;
	int offs;

	for (offs = state->m_spriteram.bytes() - 2; offs >= 0; offs -= 2)
	{
		int attr = spriteram_2[offs];
		int code = spriteram[offs + 1];
		int color = attr & 0x0f;
		if (!state->m_sprites_gfx_banked)
			if (attr&1) code|=0x100; // extra tile# bit for the yiear conversion, trackfld doesn't have this many sprites so it will just get masked
		int flipx = ~attr & 0x40;
		int flipy = attr & 0x80;
		int sx = spriteram[offs] - 1;
		int sy = 240 - spriteram_2[offs + 1];

		if (state->flip_screen())
		{
			sy = 240 - sy;
			flipy = !flipy;
		}

		/* Note that this adjustement must be done AFTER handling flip screen, thus */
		/* proving that this is a hardware related "feature" */
		sy += 1;

		// to fix the title screen in yieartf it would have to be like this, the same as yiear.c, this should be verified on the hw
		//
		//if (offs < 0x26)
		//{
		//  sy++;   /* fix title screen & garbage at the bottom of the screen */
		//}


		drawgfx_transmask(bitmap, cliprect,
			machine.gfx[0],
			code + state->m_sprite_bank1 + state->m_sprite_bank2, color,
			flipx, flipy,
			sx, sy,
			colortable_get_transpen_mask(machine.colortable, machine.gfx[0], color, 0));

		/* redraw with wraparound */
		drawgfx_transmask(bitmap,cliprect,
			machine.gfx[0],
			code + state->m_sprite_bank1 + state->m_sprite_bank2, color,
			flipx, flipy,
			sx - 256, sy,
			colortable_get_transpen_mask(machine.colortable, machine.gfx[0], color, 0));
	}
}
コード例 #2
0
ファイル: pingpong.c プロジェクト: nitrologic/emu
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	int offs;

	for (offs = spriteram_size - 4;offs >= 0;offs -= 4)
	{
		int sx,sy,flipx,flipy,color,schar;


		sx = spriteram[offs + 3];
		sy = 241 - spriteram[offs + 1];

		flipx = spriteram[offs] & 0x40;
		flipy = spriteram[offs] & 0x80;
		color = spriteram[offs] & 0x1f;
		schar = spriteram[offs + 2] & 0x7f;

		drawgfx_transmask(bitmap,&spritevisiblearea,machine->gfx[1],
				schar,
				color,
				flipx,flipy,
				sx,sy,
				colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0));
	}
}
コード例 #3
0
ファイル: jailbrek.c プロジェクト: clobber/UME
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	jailbrek_state *state = machine.driver_data<jailbrek_state>();
	UINT8 *spriteram = state->m_spriteram;
	int i;

	for (i = 0; i < state->m_spriteram.bytes(); i += 4)
	{
		int attr = spriteram[i + 1];    // attributes = ?tyxcccc
		int code = spriteram[i] + ((attr & 0x40) << 2);
		int color = attr & 0x0f;
		int flipx = attr & 0x10;
		int flipy = attr & 0x20;
		int sx = spriteram[i + 2] - ((attr & 0x80) << 1);
		int sy = spriteram[i + 3];

		if (state->flip_screen())
		{
			sx = 240 - sx;
			sy = 240 - sy;
			flipx = !flipx;
			flipy = !flipy;
		}

		drawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy,
			sx, sy,
			colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0));
	}
}
コード例 #4
0
ファイル: pooyan.c プロジェクト: AltimorTASDK/shmupmametgm
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	timeplt_state *state = (timeplt_state *)machine->driver_data;
	UINT8 *spriteram = state->spriteram;
	UINT8 *spriteram_2 = state->spriteram2;
	int offs;

	for (offs = 0x10; offs < 0x40; offs += 2)
	{
		int sx = spriteram[offs];
		int sy = 240 - spriteram_2[offs + 1];

		int code = spriteram[offs + 1];
		int color = spriteram_2[offs] & 0x0f;
		int flipx = ~spriteram_2[offs] & 0x40;
		int flipy = spriteram_2[offs] & 0x80;

		drawgfx_transmask(bitmap,cliprect,
			machine->gfx[1],
			code,
			color,
			flipx, flipy,
			sx, sy,
			colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0));
	}
}
コード例 #5
0
ファイル: pingpong.c プロジェクト: kkalmaz/psmame
static void draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	pingpong_state *state = machine.driver_data<pingpong_state>();
	UINT8 *spriteram = state->m_spriteram;
	int offs;

	for (offs = state->m_spriteram_size - 4;offs >= 0;offs -= 4)
	{
		int sx,sy,flipx,flipy,color,schar;


		sx = spriteram[offs + 3];
		sy = 241 - spriteram[offs + 1];

		flipx = spriteram[offs] & 0x40;
		flipy = spriteram[offs] & 0x80;
		color = spriteram[offs] & 0x1f;
		schar = spriteram[offs + 2] & 0x7f;

		drawgfx_transmask(bitmap,&spritevisiblearea,machine.gfx[1],
				schar,
				color,
				flipx,flipy,
				sx,sy,
				colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0));
	}
}
コード例 #6
0
ファイル: gberet.c プロジェクト: Paulodx/sdl-mame-wii
static void gberet_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	int offs;
	UINT8 *sr;

	if (gberet_spritebank & 0x08)
		sr = spriteram_2;
	else
		sr = spriteram;

	for (offs = 0; offs < 0xc0; offs += 4)
	{
		if (sr[offs + 3])
		{
			int attr = sr[offs + 1];
			int code = sr[offs+0] + ((attr & 0x40) << 2);
			int color = attr & 0x0f;
			int sx = sr[offs + 2] - 2 * (attr & 0x80);
			int sy = sr[offs + 3];
			int flipx = attr & 0x10;
			int flipy = attr & 0x20;

			if (flip_screen_get(machine))
			{
				sx = 240 - sx;
				sy = 240 - sy;
				flipx = !flipx;
				flipy = !flipy;
			}

			drawgfx_transmask(bitmap, cliprect, machine->gfx[1], code, color, flipx, flipy, sx, sy,
				colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0));
		}
	}
}
コード例 #7
0
ファイル: gberet.c プロジェクト: j4y4r/j4ymame
static void gberetb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	gberet_state *state = machine.driver_data<gberet_state>();
	UINT8 *spriteram = state->m_spriteram;
	int offs;

	for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
	{
		if (spriteram[offs + 1])
		{
			int attr = spriteram[offs + 3];
			int code = spriteram[offs] + ((attr & 0x40) << 2);
			int color = attr & 0x0f;
			int sx = spriteram[offs + 2] - 2 * (attr & 0x80);
			int sy = 240 - spriteram[offs + 1];
			int flipx = attr & 0x10;
			int flipy = attr & 0x20;

			if (state->flip_screen())
			{
				sx = 240 - sx;
				sy = 240 - sy;
				flipx = !flipx;
				flipy = !flipy;
			}

			drawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx, sy,
				colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0));
		}
	}
}
コード例 #8
0
/* Same as Jailbreak + palette bank */
static void draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	scotrsht_state *state = machine.driver_data<scotrsht_state>();
	UINT8 *spriteram = state->m_spriteram;
	int i;

	for (i = 0; i < state->m_spriteram_size; i += 4)
	{
		int attr = spriteram[i + 1];	// attributes = ?tyxcccc
		int code = spriteram[i] + ((attr & 0x40) << 2);
		int color = (attr & 0x0f) + state->m_palette_bank * 16;
		int flipx = attr & 0x10;
		int flipy = attr & 0x20;
		int sx = spriteram[i + 2] - ((attr & 0x80) << 1);
		int sy = spriteram[i + 3];

		if (flip_screen_get(machine))
		{
			sx = 240 - sx;
			sy = 240 - sy;
			flipx = !flipx;
			flipy = !flipy;
		}

		drawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy,
			sx, sy,
			colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, state->m_palette_bank * 16));
	}
}
コード例 #9
0
ファイル: jailbrek.c プロジェクト: hstampfl/mame2010-libretro
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	jailbrek_state *state = (jailbrek_state *)machine->driver_data;
	UINT8 *spriteram = state->spriteram;
	int i;

	for (i = 0; i < state->spriteram_size; i += 4)
	{
		int attr = spriteram[i + 1];	// attributes = ?tyxcccc
		int code = spriteram[i] + ((attr & 0x40) << 2);
		int color = attr & 0x0f;
		int flipx = attr & 0x10;
		int flipy = attr & 0x20;
		int sx = spriteram[i + 2] - ((attr & 0x80) << 1);
		int sy = spriteram[i + 3];

		if (flip_screen_get(machine))
		{
			sx = 240 - sx;
			sy = 240 - sy;
			flipx = !flipx;
			flipy = !flipy;
		}

		drawgfx_transmask(bitmap, cliprect, machine->gfx[1], code, color, flipx, flipy,
			sx, sy,
			colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0));
	}
}
コード例 #10
0
ファイル: shaolins.c プロジェクト: DarrenBranford/MAME4iOS
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
{
	UINT8 *spriteram = machine->generic.spriteram.u8;
	int offs;

	for (offs = machine->generic.spriteram_size-32; offs >= 0; offs-=32 ) /* max 24 sprites */
	{
		if (spriteram[offs] && spriteram[offs + 6]) /* stop rogue sprites on high score screen */
		{
			int code = spriteram[offs + 8];
			int color = (spriteram[offs + 9] & 0x0f) | (palettebank << 4);
			int flipx = !(spriteram[offs + 9] & 0x40);
			int flipy = spriteram[offs + 9] & 0x80;
			int sx = 240 - spriteram[offs + 6];
			int sy = 248 - spriteram[offs + 4];

			if (flip_screen_get(machine))
			{
				sx = 240 - sx;
				sy = 248 - sy;
				flipx = !flipx;
				flipy = !flipy;
			}

			drawgfx_transmask(bitmap, cliprect,machine->gfx[1],
				code, color,
				flipx, flipy,
				sx, sy,
				colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, palettebank << 5));
		}
	}
}
コード例 #11
0
ファイル: gberet.c プロジェクト: Paulodx/sdl-mame-wii
static void gberetb_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	int offs;

	for (offs = spriteram_size - 4; offs >= 0; offs -= 4)
	{
		if (spriteram[offs + 1])
		{
			int attr = spriteram[offs + 3];
			int code = spriteram[offs] + ((attr & 0x40) << 2);
			int color = attr & 0x0f;
			int sx = spriteram[offs + 2] - 2 * (attr & 0x80);
			int sy = 240 - spriteram[offs + 1];
			int flipx = attr & 0x10;
			int flipy = attr & 0x20;

			if (flip_screen_get(machine))
			{
				sx = 240 - sx;
				sy = 240 - sy;
				flipx = !flipx;
				flipy = !flipy;
			}

			drawgfx_transmask(bitmap, cliprect, machine->gfx[1], code, color, flipx, flipy, sx, sy,
				colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0));
		}
	}
}
コード例 #12
0
ファイル: shaolins.c プロジェクト: kleopatra999/mess-svn
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	shaolins_state *state = machine.driver_data<shaolins_state>();
	UINT8 *spriteram = state->m_spriteram;
	int offs;

	for (offs = state->m_spriteram.bytes() - 32; offs >= 0; offs -= 32 ) /* max 24 sprites */
	{
		if (spriteram[offs] && spriteram[offs + 6]) /* stop rogue sprites on high score screen */
		{
			int code = spriteram[offs + 8];
			int color = (spriteram[offs + 9] & 0x0f) | (state->m_palettebank << 4);
			int flipx = !(spriteram[offs + 9] & 0x40);
			int flipy = spriteram[offs + 9] & 0x80;
			int sx = 240 - spriteram[offs + 6];
			int sy = 248 - spriteram[offs + 4];

			if (state->flip_screen())
			{
				sx = 240 - sx;
				sy = 248 - sy;
				flipx = !flipx;
				flipy = !flipy;
			}

			drawgfx_transmask(bitmap, cliprect,machine.gfx[1],
				code, color,
				flipx, flipy,
				sx, sy,
				colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, state->m_palettebank << 5));
		}
	}
}
コード例 #13
0
ファイル: hyperspt.c プロジェクト: hstampfl/mame2010-libretro
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	trackfld_state *state = (trackfld_state *)machine->driver_data;
	UINT8 *spriteram = state->spriteram;
	int offs;

	for (offs = state->spriteram_size - 4;offs >= 0;offs -= 4)
	{
		int sx = spriteram[offs + 3];
		int sy = 240 - spriteram[offs + 1];
		int code = spriteram[offs + 2] + 8 * (spriteram[offs] & 0x20);
		int color = spriteram[offs] & 0x0f;
		int flipx = ~spriteram[offs] & 0x40;
		int flipy = spriteram[offs] & 0x80;

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

		/* Note that this adjustment must be done AFTER handling flip_screen_get(machine), thus */
		/* proving that this is a hardware related "feature" */

		sy += 1;

		drawgfx_transmask(bitmap,cliprect,
			machine->gfx[0],
			code, color,
			flipx, flipy,
			sx, sy,
			colortable_get_transpen_mask(machine->colortable, machine->gfx[0], color, 0));

		/* redraw with wraparound */

		drawgfx_transmask(bitmap,cliprect,
			machine->gfx[0],
			code, color,
			flipx, flipy,
			sx - 256, sy,
			colortable_get_transpen_mask(machine->colortable, machine->gfx[0], color, 0));
	}
}
コード例 #14
0
ファイル: trackfld.c プロジェクト: Paulodx/sdl-mame-wii
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
{
	int offs;

	for (offs = spriteram_size - 2; offs >= 0; offs -= 2)
	{
		int attr = spriteram_2[offs];
		int code = spriteram[offs + 1];
		int color = attr & 0x0f;
		int flipx = ~attr & 0x40;
		int flipy = attr & 0x80;
		int sx = spriteram[offs] - 1;
		int sy = 240 - spriteram_2[offs + 1];

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

		/* Note that this adjustement must be done AFTER handling flip screen, thus */
		/* proving that this is a hardware related "feature" */
		sy += 1;

		drawgfx_transmask(bitmap, cliprect,
			machine->gfx[0],
			code + sprite_bank1 + sprite_bank2, color,
			flipx, flipy,
			sx, sy,
			colortable_get_transpen_mask(machine->colortable, machine->gfx[0], color, 0));

		/* redraw with wraparound */
		drawgfx_transmask(bitmap,cliprect,
			machine->gfx[0],
			code + sprite_bank1 + sprite_bank2, color,
			flipx, flipy,
			sx - 256, sy,
			colortable_get_transpen_mask(machine->colortable, machine->gfx[0], color, 0));
	}
}
コード例 #15
0
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	_galaga_state *state =  machine->driver_data<_galaga_state>();

	UINT8 *spriteram = state->galaga_ram1 + 0x380;
	UINT8 *spriteram_2 = state->galaga_ram2 + 0x380;
	UINT8 *spriteram_3 = state->galaga_ram3 + 0x380;
	int offs;


	for (offs = 0;offs < 0x80;offs += 2)
	{
		static const int gfx_offs[2][2] =
		{
			{ 0, 1 },
			{ 2, 3 }
		};
		int sprite = spriteram[offs] & 0x7f;
		int color = spriteram[offs+1] & 0x3f;
		int sx = spriteram_2[offs+1] - 40 + 0x100*(spriteram_3[offs+1] & 3);
		int sy = 256 - spriteram_2[offs] + 1;	// sprites are buffered and delayed by one scanline
		int flipx = (spriteram_3[offs] & 0x01);
		int flipy = (spriteram_3[offs] & 0x02) >> 1;
		int sizex = (spriteram_3[offs] & 0x04) >> 2;
		int sizey = (spriteram_3[offs] & 0x08) >> 3;
		int x,y;

		sy -= 16 * sizey;
		sy = (sy & 0xff) - 32;	// fix wraparound

		if (flip_screen_get(machine))
		{
			flipx ^= 1;
			flipy ^= 1;
			sy += 48;
		}

		for (y = 0;y <= sizey;y++)
		{
			for (x = 0;x <= sizex;x++)
			{
				drawgfx_transmask(bitmap,cliprect,machine->gfx[1],
					sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)],
					color,
					flipx,flipy,
					sx + 16*x, sy + 16*y,
					colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0x0f));
			}
		}
	}
}
コード例 #16
0
ファイル: skykid.c プロジェクト: LibXenonProject/mame-lx
/* the sprite generator IC is the same as Mappy */
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
{
	skykid_state *state = machine.driver_data<skykid_state>();
	UINT8 *spriteram = state->m_spriteram + 0x780;
	UINT8 *spriteram_2 = spriteram + 0x0800;
	UINT8 *spriteram_3 = spriteram_2 + 0x0800;
	int offs;

	for (offs = 0;offs < 0x80;offs += 2)
	{
		static const int gfx_offs[2][2] =
		{
			{ 0, 1 },
			{ 2, 3 }
		};
		int sprite = spriteram[offs] + ((spriteram_3[offs] & 0x80) << 1);
		int color = (spriteram[offs+1] & 0x3f);
		int sx = (spriteram_2[offs+1]) + 0x100*(spriteram_3[offs+1] & 1) - 71;
		int sy = 256 - spriteram_2[offs] - 7;
		int flipx = (spriteram_3[offs] & 0x01);
		int flipy = (spriteram_3[offs] & 0x02) >> 1;
		int sizex = (spriteram_3[offs] & 0x04) >> 2;
		int sizey = (spriteram_3[offs] & 0x08) >> 3;
		int x,y;

		sprite &= ~sizex;
		sprite &= ~(sizey << 1);

		if (flip_screen_get(machine))
		{
			flipx ^= 1;
			flipy ^= 1;
		}

		sy -= 16 * sizey;
		sy = (sy & 0xff) - 32;	// fix wraparound

		for (y = 0;y <= sizey;y++)
		{
			for (x = 0;x <= sizex;x++)
			{
				drawgfx_transmask(bitmap,cliprect,machine.gfx[2],
					sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)],
					color,
					flipx,flipy,
					sx + 16*x,sy + 16*y,
					colortable_get_transpen_mask(machine.colortable, machine.gfx[2], color, 0xff));
			}
		}
	}
}
コード例 #17
0
ファイル: sprcros2.c プロジェクト: DarrenBranford/MAME4iOS
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
{
	int offs,sx,sy,color,flipx,flipy;

	for (offs = sprcros2_spriteram_size-4; offs >= 0; offs -= 4)
	{
		if(sprcros2_spriteram[offs])
		{

			//offs
			//76543210
			//x------- unused
			//-xxxxxxx sprite number
			//offs+1
			//76543210
			//xx------ unused
			//--xxx--- colour (6/7 unused and blank in prom)
			//-----x-- unused
			//------x- flipx
			//-------x unused
			//offs+2   y pos
			//offs+3   x pos

			sx = ((sprcros2_spriteram[offs+3]+0x10)%0x100)-0x10;
			sy = 225-(((sprcros2_spriteram[offs+2]+0x10)%0x100)-0x10);
			color = (sprcros2_spriteram[offs+1]&0x38)>>3;
			flipx = sprcros2_spriteram[offs+1]&0x02;
			flipy = 0;

			if (sprcros2_m_port7&0x02)
			{
				sx = 224-sx;
				sy = 224-sy;
				flipx = !flipx;
				flipy = !flipy;
			}

			drawgfx_transmask(bitmap,cliprect,machine->gfx[1],
				sprcros2_spriteram[offs],
				color,
				flipx,flipy,
				sx,sy,
				colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0));
		}
	}
}
コード例 #18
0
ファイル: rocnrope.c プロジェクト: kleopatra999/mess-svn
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
    rocnrope_state *state = machine.driver_data<rocnrope_state>();
    UINT8 *spriteram = state->m_spriteram;
    UINT8 *spriteram_2 = state->m_spriteram2;
    int offs;

    for (offs = state->m_spriteram.bytes() - 2; offs >= 0; offs -= 2)
    {
        int color = spriteram_2[offs] & 0x0f;

        drawgfx_transmask(bitmap, cliprect, machine.gfx[0],
                          spriteram[offs + 1],
                          color,
                          spriteram_2[offs] & 0x40,~spriteram_2[offs] & 0x80,
                          240 - spriteram[offs], spriteram_2[offs + 1],
                          colortable_get_transpen_mask(machine.colortable, machine.gfx[0], color, 0));
    }
}
コード例 #19
0
ファイル: rocnrope.c プロジェクト: AltimorTASDK/shmupmametgm
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	timeplt_state *state = (timeplt_state *)machine->driver_data;
	UINT8 *spriteram = state->spriteram;
	UINT8 *spriteram_2 = state->spriteram2;
	int offs;

	for (offs = state->spriteram_size - 2;offs >= 0;offs -= 2)
	{
		int color = spriteram_2[offs] & 0x0f;

		drawgfx_transmask(bitmap, cliprect, machine->gfx[0],
				spriteram[offs + 1],
				color,
				spriteram_2[offs] & 0x40,~spriteram_2[offs] & 0x80,
				240 - spriteram[offs], spriteram_2[offs + 1],
				colortable_get_transpen_mask(machine->colortable, machine->gfx[0], color, 0));
	}
}
コード例 #20
0
ファイル: gsword.c プロジェクト: AltimorTASDK/shmupmametgm
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
{
	int offs;

	for (offs = 0; offs < gsword_spritexy_size - 1; offs+=2)
	{
		int sx,sy,flipx,flipy,spritebank,tile,color;

		if (gsword_spritexy_ram[offs]!=0xf1)
		{
			spritebank = 0;
			tile = gsword_spritetile_ram[offs];
			color = gsword_spritetile_ram[offs+1] & 0x3f;
			sy = 241-gsword_spritexy_ram[offs];
			sx = gsword_spritexy_ram[offs+1]-56;
			flipx = gsword_spriteattrib_ram[offs] & 0x02;
			flipy = gsword_spriteattrib_ram[offs] & 0x01;

			// Adjust sprites that should be far far right!
			if (sx<0) sx+=256;

			// Adjuste for 32x32 tiles(#128-256)
			if (tile > 127)
			{
				spritebank = 1;
				tile -= 128;
				sy-=16;
			}
			if (flipscreen)
			{
				flipx = !flipx;
				flipy = !flipy;
			}
			drawgfx_transmask(bitmap,cliprect,machine->gfx[1+spritebank],
					tile,
					color,
					flipx,flipy,
					sx,sy,
					colortable_get_transpen_mask(machine->colortable, machine->gfx[1+spritebank], color, 0x8f));
		}
	}
}
コード例 #21
0
ファイル: pandoras.c プロジェクト: j4y4r/j4ymame
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8* sr )
{
	int offs;

	for (offs = 0; offs < 0x100; offs += 4)
	{
		int sx = sr[offs + 1];
		int sy = 240 - sr[offs];
		int color = sr[offs + 3] & 0x0f;
		int nflipx = sr[offs + 3] & 0x40;
		int nflipy = sr[offs + 3] & 0x80;

		drawgfx_transmask(bitmap,cliprect,machine.gfx[0],
			sr[offs + 2],
			color,
			!nflipx,!nflipy,
			sx,sy,
			colortable_get_transpen_mask(machine.colortable, machine.gfx[0], color, 0));
	}
}
コード例 #22
0
ファイル: tp84.c プロジェクト: kkalmaz/psmame
static void draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect)
{
	tp84_state *state = machine.driver_data<tp84_state>();
	int offs;
	int palette_base = ((*state->m_palette_bank & 0x07) << 4);

	for (offs = 0x5c; offs >= 0; offs -= 4)
	{
		int x = state->m_spriteram[offs];
		int y = 240 - state->m_spriteram[offs + 3];

		int code = state->m_spriteram[offs + 1];
		int color = palette_base | (state->m_spriteram[offs + 2] & 0x0f);
		int flip_x = ~state->m_spriteram[offs + 2] & 0x40;
		int flip_y =  state->m_spriteram[offs + 2] & 0x80;

		drawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flip_x, flip_y, x, y,
				colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, palette_base));

	}
}
コード例 #23
0
ファイル: panicr.c プロジェクト: nitrologic/emu
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect )
{
    int offs,fx,fy,x,y,color,sprite;

    for (offs = 0; offs<0x1000; offs+=16)
    {

        fx = 0;
        fy = spriteram[offs+1] & 0x80;
        y = spriteram[offs+2];
        x = spriteram[offs+3];

        color = spriteram[offs+1] & 0x0f;

        sprite = spriteram[offs+0]+(scrollram[0x0c]<<8);

        drawgfx_transmask(bitmap,cliprect,machine->gfx[2],
                          sprite,
                          color,fx,fy,x,y,
                          colortable_get_transpen_mask(machine->colortable, machine->gfx[2], color, 0));
    }
}
コード例 #24
0
ファイル: equites.c プロジェクト: kkalmaz/psmame
static void equites_draw_sprites_block( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int start, int end )
{
	equites_state *state = machine.driver_data<equites_state>();
	int offs;

	for (offs = end - 2; offs >= start; offs -= 2)
	{
		int attr = state->m_spriteram[offs + 1];
		if (!(attr & 0x800))	// disable or x MSB?
		{
			int tile = attr & 0x1ff;
			int fx = ~attr & 0x400;
			int fy = ~attr & 0x200;
			int color = (~attr & 0xf000) >> 12;
			int sx = (state->m_spriteram[offs] & 0xff00) >> 8;
			int sy = (state->m_spriteram[offs] & 0x00ff);
			int transmask = colortable_get_transpen_mask(machine.colortable, machine.gfx[2], color, 0);

			if (flip_screen_get(machine))
			{
				sx = 240 - sx;
				sy = 240 - sy;
				fx = !fx;
				fy = !fy;
			}

			// align
			sx -= 4;

			// sprites are 16x14 centered in a 16x16 square, so skip the first line
			sy += 1;

			drawgfx_transmask(bitmap,cliprect, machine.gfx[2],
					tile,
					color,
					fx, fy,
					sx, sy, transmask);
		}
	}
コード例 #25
0
static void draw_sprites(running_machine &machine, bitmap_t *bitmap,const rectangle *cliprect )
{
    panicr_state *state = machine.driver_data<panicr_state>();
    UINT8 *spriteram = state->m_spriteram;
    int offs,flipx,flipy,x,y,color,sprite;

    for (offs = 0; offs<0x1000; offs+=16)
    {
        flipx = 0;
        flipy = spriteram[offs+1] & 0x80;
        y = spriteram[offs+2];
        x = spriteram[offs+3];
        if (spriteram[offs+1] & 0x40) x -= 0x100;

        color = spriteram[offs+1] & 0x0f;
        sprite = spriteram[offs+0]+(state->m_scrollram[0x0c]<<8);

        drawgfx_transmask(bitmap,cliprect,machine.gfx[2],
                          sprite,
                          color,flipx,flipy,x,y,
                          colortable_get_transpen_mask(machine.colortable, machine.gfx[2], color, 0));
    }
}
コード例 #26
0
ファイル: m57.c プロジェクト: kkalmaz/psmame
static void draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect)
{
	m57_state *state = machine.driver_data<m57_state>();
	int offs;

	for (offs = state->m_spriteram_size - 4; offs >= 0; offs -= 4)
	{
		UINT8 attributes = state->m_spriteram[offs + 1];
		int sx = state->m_spriteram[offs + 3];
		int sy = ((224 - state->m_spriteram[offs + 0] - 32) & 0xff) + 32;
		int code = state->m_spriteram[offs + 2];
		int color = attributes & 0x1f;
		int flipy = attributes & 0x80;
		int flipx = attributes & 0x40;

		int tile_number = code & 0x3f;

		int bank = 0;
		if (code & 0x80) bank += 1;
		if (attributes & 0x20) bank += 2;

		if (state->m_flipscreen)
		{
			sx = 240 - sx;
			sy = 224 - sy;
			flipx = !flipx;
			flipy = !flipy;
		}

		drawgfx_transmask(bitmap, cliprect, machine.gfx[1 + bank],
			tile_number,
			color,
			flipx, flipy,
			sx, sy,
			colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 256 + 15));
	}
}
コード例 #27
0
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	circusc_state *state = machine->driver_data<circusc_state>();
	int offs;
	UINT8 *sr;

	if ((*state->spritebank & 0x01) != 0)
		sr = state->spriteram;
	else
		sr = state->spriteram_2;

	for (offs = 0; offs < state->spriteram_size; offs += 4)
	{
		int code = sr[offs + 0] + 8 * (sr[offs + 1] & 0x20);
		int color = sr[offs + 1] & 0x0f;
		int sx = sr[offs + 2];
		int sy = sr[offs + 3];
		int flipx = sr[offs + 1] & 0x40;
		int flipy = sr[offs + 1] & 0x80;

		if (flip_screen_get(machine))
		{
			sx = 240 - sx;
			sy = 240 - sy;
			flipx = !flipx;
			flipy = !flipy;
		}


		drawgfx_transmask(bitmap,cliprect,machine->gfx[1],
				code, color,
				flipx,flipy,
				sx,sy,
				colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0));
	}
}
コード例 #28
0
ファイル: k007121.c プロジェクト: thomas41546/mame4raspi
void k007121_device::sprites_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, colortable_t *ctable,
                                   const UINT8 *source, int base_color, int global_x_offset, int bank_base, bitmap_ind8 &priority_bitmap, UINT32 pri_mask )
{
    //  gfx_element *gfx = gfxs[chip];
    int flipscreen = m_flipscreen;
    int i, num, inc, offs[5];
    int is_flakatck = (ctable == NULL);

    if (is_flakatck)
    {
        num = 0x40;
        inc = -0x20;
        source += 0x3f * 0x20;
        offs[0] = 0x0e;
        offs[1] = 0x0f;
        offs[2] = 0x06;
        offs[3] = 0x04;
        offs[4] = 0x08;
    }
    else    /* all others */
    {
        /* TODO: sprite limit is supposed to be per-line! (check MT #00185) */
        num = 0x40;
        //num = (k007121->ctrlram[0x03] & 0x40) ? 0x80 : 0x40; /* WRONG!!! (needed by combatsc)  */

        inc = 5;
        offs[0] = 0x00;
        offs[1] = 0x01;
        offs[2] = 0x02;
        offs[3] = 0x03;
        offs[4] = 0x04;
        /* when using priority buffer, draw front to back */
        if (pri_mask != -1)
        {
            source += (num - 1)*inc;
            inc = -inc;
        }
    }

    for (i = 0; i < num; i++)
    {
        int number = source[offs[0]];               /* sprite number */
        int sprite_bank = source[offs[1]] & 0x0f;   /* sprite bank */
        int sx = source[offs[3]];                   /* vertical position */
        int sy = source[offs[2]];                   /* horizontal position */
        int attr = source[offs[4]];             /* attributes */
        int xflip = source[offs[4]] & 0x10;     /* flip x */
        int yflip = source[offs[4]] & 0x20;     /* flip y */
        int color = base_color + ((source[offs[1]] & 0xf0) >> 4);
        int width, height;
        int transparent_mask;
        static const int x_offset[4] = {0x0,0x1,0x4,0x5};
        static const int y_offset[4] = {0x0,0x2,0x8,0xa};
        int x,y, ex, ey, flipx, flipy, destx, desty;

        if (attr & 0x01) sx -= 256;
        if (sy >= 240) sy -= 256;

        number += ((sprite_bank & 0x3) << 8) + ((attr & 0xc0) << 4);
        number = number << 2;
        number += (sprite_bank >> 2) & 3;

        /* Flak Attack doesn't use a lookup PROM, it maps the color code directly */
        /* to a palette entry */
        if (is_flakatck)
            transparent_mask = 1 << 0;
        else
            transparent_mask = colortable_get_transpen_mask(ctable, gfx, color, 0);

        if (!is_flakatck || source[0x00])   /* Flak Attack needs this */
        {
            number += bank_base;

            switch (attr & 0xe)
            {
            case 0x06:
                width = height = 1;
                break;
            case 0x04:
                width = 1;
                height = 2;
                number &= (~2);
                break;
            case 0x02:
                width = 2;
                height = 1;
                number &= (~1);
                break;
            case 0x00:
                width = height = 2;
                number &= (~3);
                break;
            case 0x08:
                width = height = 4;
                number &= (~3);
                break;
            default:
                width = 1;
                height = 1;
//                  logerror("Unknown sprite size %02x\n", attr & 0xe);
//                  popmessage("Unknown sprite size %02x\n", attr & 0xe);
            }

            for (y = 0; y < height; y++)
            {
                for (x = 0; x < width; x++)
                {
                    ex = xflip ? (width - 1 - x) : x;
                    ey = yflip ? (height - 1 - y) : y;

                    if (flipscreen)
                    {
                        flipx = !xflip;
                        flipy = !yflip;
                        destx = 248 - (sx + x * 8);
                        desty = 248 - (sy + y * 8);
                    }
                    else
                    {
                        flipx = xflip;
                        flipy = yflip;
                        destx = global_x_offset + sx + x * 8;
                        desty = sy + y * 8;
                    }

                    if (pri_mask != -1)
                        pdrawgfx_transmask(bitmap,cliprect,gfx,
                                           number + x_offset[ex] + y_offset[ey],
                                           color,
                                           flipx,flipy,
                                           destx,desty,
                                           priority_bitmap,pri_mask,
                                           transparent_mask);
                    else
                        drawgfx_transmask(bitmap,cliprect,gfx,
                                          number + x_offset[ex] + y_offset[ey],
                                          color,
                                          flipx,flipy,
                                          destx,desty,
                                          transparent_mask);
                }
            }
        }

        source += inc;
    }
}
コード例 #29
0
ファイル: m52.c プロジェクト: coinhelper/jsmess
UINT32 m52_state::screen_update_m52(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	int offs;

	bitmap.fill(0, cliprect);

	if (!(m_bgcontrol & 0x20))
	{
		if (!(m_bgcontrol & 0x10))
			draw_background(machine(), bitmap, cliprect, m_bg2xpos, m_bg2ypos, 2); /* distant mountains */

		if (!(m_bgcontrol & 0x02))
			draw_background(machine(), bitmap, cliprect, m_bg1xpos, m_bg1ypos, 3); /* hills */

		if (!(m_bgcontrol & 0x04))
			draw_background(machine(), bitmap, cliprect, m_bg1xpos, m_bg1ypos, 4); /* cityscape */
	}

	m_bg_tilemap->set_flip(flip_screen() ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);

	m_bg_tilemap->draw(bitmap, cliprect, 0, 0);

	/* draw the sprites */
	for (offs = 0xfc; offs >= 0; offs -= 4)
	{
		int sy = 257 - m_spriteram[offs];
		int color = m_spriteram[offs + 1] & 0x3f;
		int flipx = m_spriteram[offs + 1] & 0x40;
		int flipy = m_spriteram[offs + 1] & 0x80;
		int code = m_spriteram[offs + 2];
		int sx = m_spriteram[offs + 3];
		rectangle clip;

		/* sprites from offsets $00-$7F are processed in the upper half of the frame */
		/* sprites from offsets $80-$FF are processed in the lower half of the frame */
		clip = cliprect;
		if (!(offs & 0x80))
			clip.min_y = 0, clip.max_y = 127;
		else
			clip.min_y = 128, clip.max_y = 255;

		/* adjust for flipping */
		if (flip_screen())
		{
			int temp = clip.min_y;
			clip.min_y = 255 - clip.max_y;
			clip.max_y = 255 - temp;
			flipx = !flipx;
			flipy = !flipy;
			sx = 240 - sx;
			sy = 257 + 11 - sy;
		}

		sx += 128;

		/* in theory anyways; in practice, some of the molecule-looking guys get clipped */
#ifdef SPLIT_SPRITES
		sect_rect(&clip, cliprect);
#else
		clip = cliprect;
#endif

		drawgfx_transmask(bitmap, clip, machine().gfx[1],
			code, color, flipx, flipy, sx, sy,
			colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 512 + 32));
	}
	return 0;
}
コード例 #30
0
ファイル: megazone.c プロジェクト: coinhelper/jsmess
UINT32 megazone_state::screen_update_megazone(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	int offs;
	int x, y;

	/* for every character in the Video RAM */
	for (offs = m_videoram.bytes() - 1; offs >= 0; offs--)
	{
		int sx, sy, flipx, flipy;

		sx = offs % 32;
		sy = offs / 32;
		flipx = m_colorram[offs] & (1 << 6);
		flipy = m_colorram[offs] & (1 << 5);

		if (m_flipscreen)
		{
			sx = 31 - sx;
			sy = 31 - sy;
			flipx = !flipx;
			flipy = !flipy;
		}

		drawgfx_opaque(*m_tmpbitmap, m_tmpbitmap->cliprect(), machine().gfx[1],
				((int)m_videoram[offs]) + ((m_colorram[offs] & (1 << 7) ? 256 : 0) ),
				(m_colorram[offs] & 0x0f) + 0x10,
				flipx,flipy,
				8*sx,8*sy);
	}

	/* copy the temporary bitmap to the screen */
	{
		int scrollx;
		int scrolly;

		if (m_flipscreen)
		{
			scrollx = *m_scrolly;
			scrolly = *m_scrollx;
		}
		else
		{
			scrollx = - *m_scrolly + 4 * 8; // leave space for credit&score overlay
			scrolly = - *m_scrollx;
		}


		copyscrollbitmap(bitmap, *m_tmpbitmap, 1, &scrollx, 1, &scrolly, cliprect);
	}


	/* Draw the sprites. */
	{
		UINT8 *spriteram = m_spriteram;
		for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
		{
			int sx = spriteram[offs + 3];
			int sy = 255 - ((spriteram[offs + 1] + 16) & 0xff);
			int color =  spriteram[offs + 0] & 0x0f;
			int flipx = ~spriteram[offs + 0] & 0x40;
			int flipy =  spriteram[offs + 0] & 0x80;

			if (m_flipscreen)
			{
				sx = sx - 11;
				sy = sy + 2;
			}
			else
				sx = sx + 32;

			drawgfx_transmask(bitmap,cliprect,machine().gfx[0],
					spriteram[offs + 2],
					color,
					flipx,flipy,
					sx,sy,
					colortable_get_transpen_mask(machine().colortable, machine().gfx[0], color, 0));
		}
	}

	for (y = 0; y < 32;y++)
	{
		offs = y * 32;
		for (x = 0; x < 6; x++)
		{
			int sx, sy, flipx, flipy;

			sx = x;
			sy = y;

			flipx = m_colorram2[offs] & (1 << 6);
			flipy = m_colorram2[offs] & (1 << 5);

			if (m_flipscreen)
			{
				sx = 35 - sx;
				sy = 31 - sy;
				flipx = !flipx;
				flipy = !flipy;
			}




			drawgfx_opaque(bitmap, cliprect, machine().gfx[1],
					((int)m_videoram2[offs]) + ((m_colorram2[offs] & (1 << 7) ? 256 : 0) ),
					(m_colorram2[offs] & 0x0f) + 0x10,
					flipx,flipy,
					8*sx,8*sy);
			offs++;
		}
	}
	return 0;
}