예제 #1
0
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
{

	/* | ---- ---- hhhf Fe-Y | ---- ---- yyyy yyyy | ---- ---- TTTT TTTT | ---- ---- tttt tttt |
       | ---- ---- -pCc cccX | ---- ---- xxxx xxxx | ---- ---- ---- ---- | ---- ---- ---- ---- | */

	/* h  = height
       f  = flipx
       F  = flipy
       e  = enable
       Yy = Y Position
       Tt = Tile No.
       Xx = X Position
       Cc = color
       P = priority
    */

	shadfrce_state *state = machine.driver_data<shadfrce_state>();
	gfx_element *gfx = machine.gfx[1];
	UINT16 *finish = state->m_spvideoram_old;
	UINT16 *source = finish + 0x2000/2 - 8;
	int hcount;
	while( source>=finish )
	{
		int ypos = 0x100 - (((source[0] & 0x0003) << 8) | (source[1] & 0x00ff));
		int xpos = (((source[4] & 0x0001) << 8) | (source[5] & 0x00ff)) + 1;
		int tile = ((source[2] & 0x00ff) << 8) | (source[3] & 0x00ff);
		int height = (source[0] & 0x00e0) >> 5;
		int enable = ((source[0] & 0x0004));
		int flipx = ((source[0] & 0x0010) >> 4);
		int flipy = ((source[0] & 0x0008) >> 3);
		int pal = ((source[4] & 0x003e));
		int pri_mask = (source[4] & 0x0040) ? 0x02 : 0x00;

		if (pal & 0x20) pal ^= 0x60;	/* skip hole */

		height++;
		if (enable)	{
			for (hcount=0;hcount<height;hcount++) {
				pdrawgfx_transpen(bitmap,cliprect,gfx,tile+hcount,pal,flipx,flipy,xpos,ypos-hcount*16-16,machine.priority_bitmap,pri_mask,0);
				pdrawgfx_transpen(bitmap,cliprect,gfx,tile+hcount,pal,flipx,flipy,xpos-0x200,ypos-hcount*16-16,machine.priority_bitmap,pri_mask,0);
				pdrawgfx_transpen(bitmap,cliprect,gfx,tile+hcount,pal,flipx,flipy,xpos,ypos-hcount*16-16+0x200,machine.priority_bitmap,pri_mask,0);
				pdrawgfx_transpen(bitmap,cliprect,gfx,tile+hcount,pal,flipx,flipy,xpos-0x200,ypos-hcount*16-16+0x200,machine.priority_bitmap,pri_mask,0);
			}
		}
		source-=8;
	}
}
예제 #2
0
void warriorb_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs )
{
	UINT16 *spriteram = m_spriteram;
	int offs, data, data2, tilenum, color, flipx, flipy;
	int x, y, priority, pri_mask;

#ifdef MAME_DEBUG
	int unknown = 0;
#endif

	/* pdrawgfx() needs us to draw sprites front to back */
	for (offs = 0; offs < m_spriteram.bytes() / 2; offs += 4)
	{
		data = spriteram[offs + 1];
		tilenum = data & 0x7fff;

		data = spriteram[offs + 0];
		y = (-(data & 0x1ff) - 24) & 0x1ff; /* (inverted y adjusted for vis area) */
		flipy = (data & 0x200) >> 9;

		data2 = spriteram[offs + 2];
		/* 8,4 also seen in msbyte */
		priority = (data2 & 0x0100) >> 8; // 1 = low

		if(priority)
			pri_mask = 0xfffe;
		else
			pri_mask = 0;

		color = (data2 & 0x7f);

		data = spriteram[offs + 3];
		x = (data & 0x3ff);
		flipx = (data & 0x400) >> 10;


#ifdef MAME_DEBUG
		if (data2 & 0xf280)   unknown |= (data2 &0xf280);
#endif

		x -= x_offs;
		y += y_offs;

		/* sprite wrap: coords become negative at high values */
		if (x > 0x3c0) x -= 0x400;
		if (y > 0x180) y -= 0x200;

		pdrawgfx_transpen(bitmap,cliprect,machine().gfx[0],
					tilenum,
					color,
					flipx,flipy,
					x,y,
					machine().priority_bitmap,pri_mask,0);
	}

#ifdef MAME_DEBUG
	if (unknown)
		popmessage("unknown sprite bits: %04x",unknown);
#endif
}
예제 #3
0
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	gaelco_state *state = machine->driver_data<gaelco_state>();
	int i, x, y, ex, ey;
	const gfx_element *gfx = machine->gfx[0];

	static const int x_offset[2] = {0x0,0x2};
	static const int y_offset[2] = {0x0,0x1};

	for (i = 0x800 - 4 - 1; i >= 3; i -= 4)
	{
		int sx = state->spriteram[i + 2] & 0x01ff;
		int sy = (240 - (state->spriteram[i] & 0x00ff)) & 0x00ff;
		int number = state->spriteram[i + 3];
		int color = (state->spriteram[i + 2] & 0x7e00) >> 9;
		int attr = (state->spriteram[i] & 0xfe00) >> 9;
		int priority = (state->spriteram[i] & 0x3000) >> 12;

		int xflip = attr & 0x20;
		int yflip = attr & 0x40;
		int spr_size, pri_mask;

		/* palettes 0x38-0x3f are used for high priority sprites in Big Karnak */
		if (color >= 0x38)
			priority = 4;

		switch (priority)
		{
			case 0: pri_mask = 0xff00; break;
			case 1: pri_mask = 0xff00 | 0xf0f0; break;
			case 2: pri_mask = 0xff00 | 0xf0f0 | 0xcccc; break;
			case 3: pri_mask = 0xff00 | 0xf0f0 | 0xcccc | 0xaaaa; break;
			default:
			case 4: pri_mask = 0; break;
		}

		if (attr & 0x04)
			spr_size = 1;
		else
		{
			spr_size = 2;
			number &= (~3);
		}

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

				pdrawgfx_transpen(bitmap,cliprect,gfx,number + x_offset[ex] + y_offset[ey],
						color,xflip,yflip,
						sx-0x0f+x*8,sy+y*8,
						machine->priority_bitmap,pri_mask,0);
			}
		}
	}
}
예제 #4
0
파일: silkroad.c 프로젝트: j4y4r/j4ymame
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	silkroad_state *state = machine.driver_data<silkroad_state>();
	const gfx_element *gfx = machine.gfx[0];
	UINT32 *source = state->m_sprram;
	UINT32 *finish = source + 0x1000/4;

	while( source < finish )
	{

		int xpos = (source[0] & 0x01ff0000) >> 16;
		int ypos = (source[0] & 0x0000ffff);
		int tileno = (source[1] & 0xffff0000) >> 16;
		int attr = (source[1] & 0x0000ffff);
		int flipx = (attr & 0x0080);
		int width = ((attr & 0x0f00) >> 8) + 1;
		int wcount;
		int color = (attr & 0x003f) ;
		int pri		 =	((attr & 0x1000)>>12);	// Priority (1 = Low)
		int pri_mask =	~((1 << (pri+1)) - 1);	// Above the first "pri" levels

		// attr & 0x2000 -> another priority bit?

		if ( (source[1] & 0xff00) == 0xff00 ) break;

		if ( (attr & 0x8000) == 0x8000 ) tileno+=0x10000;

		if (!flipx)
		{
			for (wcount=0;wcount<width;wcount++)
			{
				pdrawgfx_transpen(bitmap,cliprect,gfx,tileno+wcount,color,0,0,xpos+wcount*16+8,ypos,machine.priority_bitmap,pri_mask,0);
			}
		}
		else
		{

			for (wcount=width;wcount>0;wcount--)
			{
				pdrawgfx_transpen(bitmap,cliprect,gfx,tileno+(width-wcount),color,1,0,xpos+wcount*16-16+8,ypos,machine.priority_bitmap,pri_mask,0);
			}
		}

		source += 2;
	}
}
예제 #5
0
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
    yunsun16_state *state = (yunsun16_state *)machine->driver_data;
    int offs;
    const rectangle &visarea = machine->primary_screen->visible_area();

    int max_x = visarea.max_x + 1;
    int max_y = visarea.max_y + 1;

    int pri = *state->priorityram & 3;
    int pri_mask;

    switch (pri)
    {
    case 1:
        pri_mask = (1 << 1) | (1 << 2) | (1 << 3);
        break;
    case 2:
        pri_mask = (1 << 2) | (1 << 3);
        break;
    case 3:
    default:
        pri_mask = 0;
        break;
    }

    for (offs = (state->spriteram_size - 8) / 2 ; offs >= 0; offs -= 8 / 2)
    {
        int x = state->spriteram[offs + 0];
        int y = state->spriteram[offs + 1];
        int code = state->spriteram[offs + 2];
        int attr = state->spriteram[offs + 3];
        int flipx = attr & 0x20;
        int flipy = attr & 0x40;

        x += state->sprites_scrolldx;
        y += state->sprites_scrolldy;

        if (flip_screen_get(machine))	// not used?
        {
            flipx = !flipx;
            x = max_x - x - 16;
            flipy = !flipy;
            y = max_y - y - 16;
        }

        pdrawgfx_transpen(bitmap,cliprect,machine->gfx[1],
                          code,
                          attr & 0x1f,
                          flipx, flipy,
                          x,y,
                          machine->priority_bitmap,
                          pri_mask,15);
    }
}
예제 #6
0
static void zeropnt2_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
{
	UINT32 *spriteram32 = machine->generic.spriteram.u32;
	int offs;

	/* Draw them backwards, for pdrawgfx */
	for ( offs = (machine->generic.spriteram_size-8)/4; offs >= 0 ; offs -= 8/4 )
	{
		int x, startx, endx, incx;

		int	sx			=	spriteram32[ offs + 0 ] >> 16;
		int	sy			=	spriteram32[ offs + 0 ] & 0xffff;
		int	code		=	spriteram32[ offs + 1 ] >> 16;
		int	attr		=	spriteram32[ offs + 1 ] & 0xffff;

		int	flipx		=	attr & 0x020;
		int	flipy		=	attr & 0x040;	// not sure

		int dimx		=	((attr >> 8) & 0xf) + 1;

		int priority	=	((attr >> 12) & 0x3);
		int pri_mask;

		switch( priority )
		{
			case 0:		pri_mask = 0xfe;	break;	// below all
			case 1:		pri_mask = 0xf0;	break;	// above layer 0
			case 2:		pri_mask = 0xfc;	break;	// above layer 1
			default:
			case 3:		pri_mask = 0x00;			// above all
		}

		sx	+=	sprites_scrolldx;
		sy	+=	sprites_scrolldy;

		sx	=	(sx & 0x1ff) - (sx & 0x200);
		sy	=	(sy & 0x1ff) - (sy & 0x200);

		if (flipx)	{	startx = sx+(dimx-1)*16;	endx = sx-16;		incx = -16;	}
		else		{	startx = sx;				endx = sx+dimx*16;	incx = +16;	}

		for (x = startx ; x != endx ; x += incx)
		{
			pdrawgfx_transpen(	bitmap, cliprect, machine->gfx[0],
						code++,
						attr & 0x1f,
						flipx, flipy,
						x, sy,
						machine->priority_bitmap,
						pri_mask,0x00	);
		}
	}
}
예제 #7
0
UINT32 foodf_state::screen_update_foodf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
    int offs;
    gfx_element *gfx = machine().gfx[1];
    bitmap_ind8 &priority_bitmap = screen.priority();
    UINT16 *spriteram16 = m_spriteram;

    /* first draw the playfield opaquely */
    m_playfield_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);

    /* then draw the non-transparent parts with a priority of 1 */
    priority_bitmap.fill(0);
    m_playfield_tilemap->draw(screen, bitmap, cliprect, 0, 1);

    /* draw the motion objects front-to-back */
    for (offs = 0x80-2; offs >= 0x20; offs -= 2)
    {
        int data1 = spriteram16[offs];
        int data2 = spriteram16[offs+1];

        int pict = data1 & 0xff;
        int color = (data1 >> 8) & 0x1f;
        int xpos = (data2 >> 8) & 0xff;
        int ypos = (0xff - data2 - 16) & 0xff;
        int hflip = (data1 >> 15) & 1;
        int vflip = (data1 >> 14) & 1;
        int pri = (data1 >> 13) & 1;

        pdrawgfx_transpen(bitmap, cliprect, gfx, pict, color, hflip, vflip,
                          xpos, ypos, priority_bitmap, pri * 2, 0);

        /* draw again with wraparound (needed to get the end of level animation right) */
        pdrawgfx_transpen(bitmap, cliprect, gfx, pict, color, hflip, vflip,
                          xpos - 256, ypos, priority_bitmap, pri * 2, 0);
    }

    return 0;
}
예제 #8
0
파일: stfight.c 프로젝트: coinhelper/jsmess
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	stfight_state *state = machine.driver_data<stfight_state>();
	int offs,sx,sy;

	for (offs = 0;offs < 4096;offs += 32)
	{
		int code;
		int attr = state->m_sprite_ram[offs+1];
		int flipx = attr & 0x10;
		int color = attr & 0x0f;
		int pri = (attr & 0x20) >> 5;

		sy = state->m_sprite_ram[offs+2];
		sx = state->m_sprite_ram[offs+3];

		// non-active sprites have zero y coordinate value
		if( sy > 0 )
		{
			// sprites which wrap onto/off the screen have
			// a sign extension bit in the sprite attribute
			if( sx >= 0xf0 )
			{
				if (attr & 0x80)
				    sx -= 0x100;
			}

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

			code = state->m_sprite_base + state->m_sprite_ram[offs];

			pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
				     code,
					 color,
					 flipx,state->flip_screen(),
					 sx,sy,
				     machine.priority_bitmap,
					 pri ? 0x02 : 0,0x0f);
		}
	}
}
예제 #9
0
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	blmbycar_state *state = machine->driver_data<blmbycar_state>();
	UINT16 *source, *finish;

	source = state->spriteram + 0x6 / 2;				// !
	finish = state->spriteram + state->spriteram_size / 2 - 8 / 2;

	/* Find "the end of sprites" marker */

	for ( ; source < finish; source += 8 / 2 )
		if (source[0] & 0x8000)	break;

	/* Draw sprites in reverse order for pdrawfgfx */

	source -= 8 / 2;
	finish = state->spriteram;

	for ( ; source >= finish; source -= 8 / 2 )
	{
		int	y		= source[0];
		int	code		= source[1];
		int	attr		= source[2];
		int	x		= source[3];

		int	flipx		= attr & 0x4000;
		int	flipy		= attr & 0x8000;
		int	pri		= (~attr >> 3) & 0x1;		// Priority (1 = Low)
		int pri_mask	= ~((1 << (pri+1)) - 1);	// Above the first "pri" levels

		if (x & 0x4000)	continue;	// ? To get rid of the "shadow" blocks

		x	= (x & 0x1ff) - 0x10;
		y	= 0xf0 - ((y & 0xff)  - (y & 0x100));

		pdrawgfx_transpen(bitmap, cliprect, machine->gfx[0],
					code,
					0x20 + (attr & 0xf),
					flipx, flipy,
					x, y,
					machine->priority_bitmap,
					pri_mask,0);
	}
}
예제 #10
0
파일: taito_l.c 프로젝트: clobber/UME
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	taitol_state *state = machine.driver_data<taitol_state>();
	int offs;

	/* at spriteram + 0x3f0 and 03f8 are the tilemap control registers; spriteram + 0x3e8 seems to be unused */
	for (offs = 0; offs < TAITOL_SPRITERAM_SIZE - 3 * 8; offs += 8)
	{
		int code, color, sx, sy, flipx, flipy;

		color = state->m_buff_spriteram[offs + 2] & 0x0f;
		code = state->m_buff_spriteram[offs] | (state->m_buff_spriteram[offs + 1] << 8);

		code |= (state->m_horshoes_gfxbank & 0x03) << 10;

		sx = state->m_buff_spriteram[offs + 4] | ((state->m_buff_spriteram[offs + 5] & 1) << 8);
		sy = state->m_buff_spriteram[offs + 6];
		if (sx >= 320)
			sx -= 512;
		flipx = state->m_buff_spriteram[offs + 3] & 0x01;
		flipy = state->m_buff_spriteram[offs + 3] & 0x02;

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

		pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
				code,
				color,
				flipx,flipy,
				sx,sy,
				machine.priority_bitmap,
				(color & 0x08) ? 0xaa : 0x00,0);
	}
}
예제 #11
0
파일: taito_l.c 프로젝트: antervud/MAMEHub
void taitol_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
	int offs;

	/* at spriteram + 0x3f0 and 03f8 are the tilemap control registers; spriteram + 0x3e8 seems to be unused */
	for (offs = 0; offs < TAITOL_SPRITERAM_SIZE - 3 * 8; offs += 8)
	{
		int code, color, sx, sy, flipx, flipy;

		color = m_buff_spriteram[offs + 2] & 0x0f;
		code = m_buff_spriteram[offs] | (m_buff_spriteram[offs + 1] << 8);

		code |= (m_horshoes_gfxbank & 0x03) << 10;

		sx = m_buff_spriteram[offs + 4] | ((m_buff_spriteram[offs + 5] & 1) << 8);
		sy = m_buff_spriteram[offs + 6];
		if (sx >= 320)
			sx -= 512;
		flipx = m_buff_spriteram[offs + 3] & 0x01;
		flipy = m_buff_spriteram[offs + 3] & 0x02;

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

		pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
				code,
				color,
				flipx,flipy,
				sx,sy,
				screen.priority(),
				(color & 0x08) ? 0xaa : 0x00,0);
	}
}
예제 #12
0
static void f1gpb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect )
{
	f1gp_state *state = machine.driver_data<f1gp_state>();
	UINT16 *spriteram = state->m_spriteram;
	int attr_start, start_offset = state->m_spriteram_size / 2 - 4;

	// find the "end of list" to draw the sprites in reverse order
	for (attr_start = 4; attr_start < state->m_spriteram_size / 2; attr_start += 4)
	{
		if (spriteram[attr_start + 3 - 4] == 0xffff) /* end of list marker */
		{
			start_offset = attr_start - 4;
			break;
		}
	}

	for (attr_start = start_offset;attr_start >= 4;attr_start -= 4)
	{
		int code, gfx;
		int x, y, flipx, flipy, color, pri;

		x = (spriteram[attr_start + 2] & 0x03ff) - 48;
		y = (256 - (spriteram[attr_start + 3 - 4] & 0x03ff)) - 15;
		flipx = spriteram[attr_start + 1] & 0x0800;
		flipy = spriteram[attr_start + 1] & 0x8000;
		color = spriteram[attr_start + 1] & 0x000f;
		code = spriteram[attr_start + 0] & 0x3fff;
		pri = 0; //?

		if((spriteram[attr_start + 1] & 0x00f0) && (spriteram[attr_start + 1] & 0x00f0) != 0xc0)
		{
			printf("attr %X\n",spriteram[attr_start + 1] & 0x00f0);
			code = machine.rand();
		}

/*
        if (spriteram[attr_start + 1] & ~0x88cf)
            printf("1 = %X\n", spriteram[attr_start + 1] & ~0x88cf);
*/
		if(code >= 0x2000)
		{
			gfx = 1;
			code -= 0x2000;
		}
		else
		{
			gfx = 0;
		}

		pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1 + gfx],
			code,
			color,
			flipx,flipy,
			x,y,
			machine.priority_bitmap,
			pri ? 0 : 0x2,15);

		// wrap around x
		pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1 + gfx],
			code,
			color,
			flipx,flipy,
			x - 512,y,
			machine.priority_bitmap,
			pri ? 0 : 0x2,15);
	}
}
예제 #13
0
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int bank_bits )
{
	shootout_state *state = (shootout_state *)machine->driver_data;
	UINT8 *spriteram = state->spriteram;
	static int bFlicker;
	const gfx_element *gfx = machine->gfx[1];
	const UINT8 *source = spriteram+127*4;
	int count;

	bFlicker = !bFlicker;

	for( count=0; count<128; count++ )
	{
		int attributes = source[1];
		/*
            76543210
            xxx-----    bank
            ---x----    vertical size
            ----x---    priority
            -----x--    horizontal flip
            ------x-    flicker
            -------x    enable
        */
		if ( attributes & 0x01 ){ /* visible */
			if( bFlicker || (attributes&0x02)==0 ){
				int priority_mask = (attributes&0x08)?0x2:0;
				int sx = (240 - source[2])&0xff;
				int sy = (240 - source[0])&0xff;
				int vx, vy;
				int number = source[3] | ((attributes<<bank_bits)&0x700);
				int flipx = (attributes & 0x04);
				int flipy = 0;

				if (flip_screen_get(machine)) {
					flipx = !flipx;
					flipy = !flipy;
				}

				if( attributes & 0x10 ){ /* double height */
					number = number&(~1);
					sy -= 16;

					vx = sx;
					vy = sy;
					if (flip_screen_get(machine)) {
						vx = 240 - vx;
						vy = 240 - vy;
					}

					pdrawgfx_transpen(bitmap,cliprect,gfx,
						number,
						0 /*color*/,
						flipx,flipy,
						vx,vy,
						machine->priority_bitmap,
						priority_mask,0);

					number++;
					sy += 16;
				}

				vx = sx;
				vy = sy;
				if (flip_screen_get(machine)) {
					vx = 240 - vx;
					vy = 240 - vy;
				}

				pdrawgfx_transpen(bitmap,cliprect,gfx,
						number,
						0 /*color*/,
						flipx,flipy,
						vx,vy,
						machine->priority_bitmap,
						priority_mask,0);
			}
		}
		source -= 4;
	}
}
예제 #14
0
static void draw_sprites( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int y_offs )
{
	gcpinbal_state *state = machine.driver_data<gcpinbal_state>();
	UINT16 *spriteram = state->m_spriteram;
	int offs, chain_pos;
	int x, y, curx, cury;
	int priority = 0;
	UINT8 col, flipx, flipy, chain;
	UINT16 code;

	/* According to Raine, word in ioc_ram determines sprite/tile priority... */
	priority = (state->m_ioc_ram[0x68 / 2] & 0x8800) ? 0 : 1;

	for (offs = state->m_spriteram_size / 2 - 8; offs >= 0; offs -= 8)
	{
		code = ((spriteram[offs + 5]) & 0xff) + (((spriteram[offs + 6]) & 0xff) << 8);
		code &= 0x3fff;

		if (!(spriteram[offs + 4] &0x80))	/* active sprite ? */
		{
			x = ((spriteram[offs + 0]) & 0xff) + (((spriteram[offs + 1]) & 0xff) << 8);
			y = ((spriteram[offs + 2]) & 0xff) + (((spriteram[offs + 3]) & 0xff) << 8);

			/* Treat coords as signed */
			if (x & 0x8000)  x -= 0x10000;
			if (y & 0x8000)  y -= 0x10000;

			col  = ((spriteram[offs + 7]) & 0x0f) | 0x60;
			chain = (spriteram[offs + 4]) & 0x07;
			flipy = (spriteram[offs + 4]) & 0x10;
			flipx = 0;

			curx = x;
			cury = y;

			if (((spriteram[offs + 4]) & 0x08) && flipy)
				cury += (chain * 16);

			for (chain_pos = chain; chain_pos >= 0; chain_pos--)
			{
				pdrawgfx_transpen(bitmap, cliprect,machine.gfx[0],
						code,
						col,
						flipx, flipy,
						curx,cury,
						machine.priority_bitmap,
						priority ? 0xfc : 0xf0,0);

				code++;

				if ((spriteram[offs + 4]) & 0x08)	/* Y chain */
				{
					if (flipy)	cury -= 16;
					else cury += 16;
				}
				else	/* X chain */
				{
					curx += 16;
				}
			}
		}
	}
#if 0
	if (rotate)
	{
		char buf[80];
		sprintf(buf, "sprite rotate offs %04x ?", rotate);
		popmessage(buf);
	}
#endif
}
예제 #15
0
파일: lkage.c 프로젝트: nitrologic/emu
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	const UINT8 *source = 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;
		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_get(machine))
		{
			sx = 239 - sx - 24;
			flipx = !flipx;
		}
		if( flip_screen_y_get(machine) )
		{
			sy = 254 - 16*height - sy;
			flipy = !flipy;
		}
		if (height == 2 && !flipy)
		{
			sprite_number ^= 1;
		}

		for (y = 0;y < height;y++)
		{
			pdrawgfx_transpen(
				bitmap,
				cliprect,
				machine->gfx[1],
				sprite_number ^ y,
				color,
				flipx,flipy,
				sx&0xff,
				sy + 16*y,
				machine->priority_bitmap,
				priority_mask,0 );
		}
		source+=4;
	}
} /* draw_sprites */
예제 #16
0
파일: dcon.c 프로젝트: kkalmaz/psmame
static void draw_sprites(running_machine& machine, bitmap_t *bitmap,const rectangle *cliprect)
{
	dcon_state *state = machine.driver_data<dcon_state>();
	UINT16 *spriteram16 = state->m_spriteram;
	int offs,fx,fy,x,y,color,sprite;
	int dx,dy,ax,ay,inc,pri_mask = 0;

	for (offs = 0;offs < 0x400;offs += 4)
	{
		if ((spriteram16[offs+0]&0x8000)!=0x8000) continue;
		sprite = spriteram16[offs+1];

		switch((sprite>>14) & 3)
		{
		case 0: pri_mask = 0xf0; // above foreground layer
			break;
		case 1: pri_mask = 0xfc; // above midground layer
			break;
		case 2: pri_mask = 0xfe; // above background layer
			break;
		case 3: pri_mask = 0; // above text layer
			break;
		}

		sprite &= 0x3fff;

		y = spriteram16[offs+3];
		x = spriteram16[offs+2];

		if (x&0x8000) x=0-(0x200-(x&0x1ff));
		else x&=0x1ff;
		if (y&0x8000) y=0-(0x200-(y&0x1ff));
		else y&=0x1ff;

		color = spriteram16[offs+0]&0x3f;
		fx = spriteram16[offs+0]&0x4000;
		fy = spriteram16[offs+0]&0x2000;
		dy=((spriteram16[offs+0]&0x0380)>>7)+1;
		dx=((spriteram16[offs+0]&0x1c00)>>10)+1;

		inc = 0;

		for (ax=0; ax<dx; ax++)
			for (ay=0; ay<dy; ay++) {
				if (!fx && !fy)
				{
					pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
						sprite + inc,
						color,fx,fy,x+ax*16,y+ay*16,
						machine.priority_bitmap,pri_mask,15);

					// wrap around y
					pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
						sprite + inc,
						color,fx,fy,x+ax*16,y+ay*16 + 512,
						machine.priority_bitmap,pri_mask,15);

					// wrap around y
					pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
						sprite + inc,
						color,fx,fy,x+ax*16,y+ay*16 - 512,
						machine.priority_bitmap,pri_mask,15);
				}
				else if (fx && !fy)
				{
					pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
						sprite + inc,
						color,fx,fy,x+(dx-1-ax)*16,y+ay*16,
						machine.priority_bitmap,pri_mask,15);

					// wrap around y
					pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
						sprite + inc,
						color,fx,fy,x+(dx-1-ax)*16,y+ay*16 + 512,
						machine.priority_bitmap,pri_mask,15);

					// wrap around y
					pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
						sprite + inc,
						color,fx,fy,x+(dx-1-ax)*16,y+ay*16 - 512,
						machine.priority_bitmap,pri_mask,15);
				}
				else if (!fx && fy)
				{
					pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
						sprite + inc,
						color,fx,fy,x+ax*16,y+(dy-1-ay)*16,
						machine.priority_bitmap,pri_mask,15);

					// wrap around y
					pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
						sprite + inc,
						color,fx,fy,x+ax*16,y+(dy-1-ay)*16 + 512,
						machine.priority_bitmap,pri_mask,15);

					// wrap around y
					pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
						sprite + inc,
						color,fx,fy,x+ax*16,y+(dy-1-ay)*16 - 512,
						machine.priority_bitmap,pri_mask,15);
				}
				else
				{
					pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
						sprite + inc,
						color,fx,fy,x+(dx-1-ax)*16,y+(dy-1-ay)*16,
						machine.priority_bitmap,pri_mask,15);

					// wrap around y
					pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
						sprite + inc,
						color,fx,fy,x+(dx-1-ax)*16,y+(dy-1-ay)*16 + 512,
						machine.priority_bitmap,pri_mask,15);

					// wrap around y
					pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
						sprite + inc,
						color,fx,fy,x+(dx-1-ax)*16,y+(dy-1-ay)*16 - 512,
						machine.priority_bitmap,pri_mask,15);
				}

				inc++;
			}
	}
}