inline void nmk16_state::nmk16_draw_sprite_flipsupported(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 *spr) { if(!(spr[0] & 0x0001)) return; int sx = (spr[4] & 0x1FF) + m_videoshift; int sy = spr[6] & 0x1FF; int code = spr[3]; int color = spr[7]; int w = spr[1] & 0x00F; int h = (spr[1] & 0x0F0) >> 4; int flipy = (spr[1] & 0x200) >> 9; int flipx = (spr[1] & 0x100) >> 8; int xx,yy,x; int delta = 16; flipx ^= flip_screen(); flipy ^= flip_screen(); if (flip_screen()) { sx = 368 - sx; sy = 240 - sy; delta = -16; } yy = h; sy += flipy ? (delta*h) : 0; do { x = sx + (flipx ? (delta*w) : 0); xx = w; do { m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, code, color, flipx, flipy, ((x + 16) & 0x1FF) - 16,sy & 0x1FF,15); code++; x += delta * (flipx ? -1 : 1); } while (--xx >= 0); sy += delta * (flipy ? -1 : 1); } while (--yy >= 0); }
void pbaction_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { UINT8 *spriteram = m_spriteram; int offs; for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) { int sx, sy, flipx, flipy; /* if next sprite is double size, skip this one */ if (offs > 0 && spriteram[offs - 4] & 0x80) continue; sx = spriteram[offs + 3]; if (spriteram[offs] & 0x80) sy = 225 - spriteram[offs + 2]; else sy = 241 - spriteram[offs + 2]; flipx = spriteram[offs + 1] & 0x40; flipy = spriteram[offs + 1] & 0x80; if (flip_screen()) { if (spriteram[offs] & 0x80) { sx = 224 - sx; sy = 225 - sy; } else { sx = 240 - sx; sy = 241 - sy; } flipx = !flipx; flipy = !flipy; } drawgfx_transpen(bitmap,cliprect,machine().gfx[(spriteram[offs] & 0x80) ? 3 : 2], /* normal or double size */ spriteram[offs], spriteram[offs + 1] & 0x0f, flipx,flipy, sx + (flip_screen() ? m_scroll : -m_scroll), sy,0); } }
void tsamurai_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) { UINT8 *spriteram = m_spriteram; gfx_element *gfx = machine().gfx[2]; const UINT8 *source = spriteram+32*4-4; const UINT8 *finish = spriteram; /* ? */ m_flicker = 1-m_flicker; while( source>=finish ) { int attributes = source[2]; /* bit 0x10 is usually, but not always set */ int sx = source[3] - 16; int sy = 240-source[0]; int sprite_number = source[1]; int color = attributes&0x1f; #if 0 /* VS Gong Fight */ if (attributes == 0xe) attributes = 4; if (attributes > 7 || attributes < 4 || attributes == 5 ) attributes = 6; color = attributes&0x1f; #endif #if 0 /* Nunchakun */ color = 0x2d - (attributes&0x1f); #endif if( sy<-16 ) sy += 256; /* 240-source[0] seems nice,but some dangling sprites appear on the left */ /* side in Mission 660.Setting it to 242 fixes it,but will break other games. */ /* So I'm using this specific check. -kal 11 jul 2002 */ // if(sprite_type == 1) sy=sy+2; if( flip_screen() ) { drawgfx_transpen( bitmap,cliprect,gfx, sprite_number&0x7f, color, 1,(sprite_number&0x80)?0:1, 256-32-sx,256-32-sy,0 ); } else { drawgfx_transpen( bitmap,cliprect,gfx, sprite_number&0x7f, color, 0,sprite_number&0x80, sx,sy,0 ); } source -= 4; } }
void srumbler_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { UINT8 *buffered_spriteram = m_spriteram->buffer(); int offs; /* Draw the sprites. */ for (offs = m_spriteram->bytes()-4; offs>=0;offs -= 4) { /* SPRITES ===== Attribute 0x80 Code MSB 0x40 Code MSB 0x20 Code MSB 0x10 Colour 0x08 Colour 0x04 Colour 0x02 y Flip 0x01 X MSB */ int code,colour,sx,sy,flipy; int attr = buffered_spriteram[offs+1]; code = buffered_spriteram[offs]; code += ( (attr&0xe0) << 3 ); colour = (attr & 0x1c)>>2; sy = buffered_spriteram[offs + 2]; sx = buffered_spriteram[offs + 3] + 0x100 * ( attr & 0x01); flipy = attr & 0x02; if (flip_screen()) { sx = 496 - sx; sy = 240 - sy; flipy = !flipy; } m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, code, colour, flip_screen(),flipy, sx, sy,15); } }
void stfight_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { int offs,sx,sy; for (offs = 0;offs < 4096;offs += 32) { int code; int attr = m_sprite_ram[offs+1]; int flipx = attr & 0x10; int color = attr & 0x0f; int pri = (attr & 0x20) >> 5; sy = m_sprite_ram[offs+2]; sx = 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 (flip_screen()) { sx = 240 - sx; sy = 240 - sy; flipx = !flipx; } code = m_sprite_base + m_sprite_ram[offs]; pdrawgfx_transpen(bitmap,cliprect,machine().gfx[4], code, color, flipx,flip_screen(), sx,sy, machine().priority_bitmap, pri ? 0x02 : 0,0x0f); } } }
void kyugo_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { /* sprite information is scattered through memory */ /* and uses a portion of the text layer memory (outside the visible area) */ UINT8 *spriteram_area1 = &m_spriteram_1[0x28]; UINT8 *spriteram_area2 = &m_spriteram_2[0x28]; UINT8 *spriteram_area3 = &m_fgvideoram[0x28]; int flip = flip_screen(); for (int n = 0; n < 12 * 2; n++) { int offs, sy, sx, color; offs = 2 * (n % 12) + 64 * (n / 12); sx = spriteram_area3[offs + 1] + 256 * (spriteram_area2[offs + 1] & 1); if (sx > 320) sx -= 512; sy = 255 - spriteram_area1[offs] + 2; if (sy > 0xf0) sy -= 256; if (flip) sy = 240 - sy; color = spriteram_area1[offs + 1] & 0x1f; for (int y = 0; y < 16; y++) { int code, attr, flipx, flipy; code = spriteram_area3[offs + 128 * y]; attr = spriteram_area2[offs + 128 * y]; code = code | ((attr & 0x01) << 9) | ((attr & 0x02) << 7); flipx = attr & 0x08; flipy = attr & 0x04; if (flip) { flipx = !flipx; flipy = !flipy; } m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, code, color, flipx,flipy, sx,flip ? sy - 16*y : sy + 16*y, 0 ); } } }
void ddragon3_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { UINT16 *source = m_spriteram; UINT16 *finish = source + 0x800; while (source < finish) { UINT16 attr = source[1]; if (attr & 0x01) /* enable */ { int i; int bank = source[3] & 0xff; int code = (source[2] & 0xff) + (bank * 256); int color = source[4] & 0xf; int flipx = attr & 0x10; int flipy = attr & 0x08; int sx = source[5] & 0xff; int sy = source[0] & 0xff; int height = (attr >> 5) & 0x07; if (attr & 0x04) sx |= 0x100; if (attr & 0x02) sy = 239 + (0x100 - sy); else sy = 240 - sy; if (sx > 0x17f) sx = 0 - (0x200 - sx); if (flip_screen()) { sx = 304 - sx; sy = 224 - sy; flipx = !flipx; flipy = !flipy; } for (i = 0; i <= height; i++) { drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code + i, color, flipx, flipy, sx, sy + (flip_screen() ? (i * 16) : (-i * 16)), 0); } } source += 8; }
inline void nmk16_state::nmk16_draw_sprite(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, UINT16 *spr) { if ((spr[0] & 0x0001)) { int sx = (spr[4] & 0x1FF) + m_videoshift; int sy = spr[6] & 0x1FF; int code = spr[3]; int color = spr[7]; int w = spr[1] & 0x00F; int h = (spr[1] & 0x0F0) >> 4; int pri = (spr[0] & 0x0C0) >> 6; int xx,yy,x; int delta = 16; if(pri != priority) return; if (flip_screen()) { sx = 368 - sx; sy = 240 - sy; delta = -16; } yy = h; do { x = sx; xx = w; do { drawgfx_transpen(bitmap,cliprect,machine().gfx[2], code, color, flip_screen(), flip_screen(), ((x + 16) & 0x1FF) - 16,sy & 0x1FF,15); code++; x += delta; } while (--xx >= 0); sy += delta; } while (--yy >= 0); }
void bombjack_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { int offs; for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) { /* abbbbbbb cdefgggg hhhhhhhh iiiiiiii a use big sprites (32x32 instead of 16x16) bbbbbbb sprite code c x flip d y flip (used only in death sequence?) e ? (set when big sprites are selected) f ? (set only when the bonus (B) materializes?) gggg color hhhhhhhh x position iiiiiiii y position */ int sx,sy,flipx,flipy; sx = m_spriteram[offs + 3]; if (m_spriteram[offs] & 0x80) sy = 225 - m_spriteram[offs + 2]; else sy = 241 - m_spriteram[offs + 2]; flipx = m_spriteram[offs + 1] & 0x40; flipy = m_spriteram[offs + 1] & 0x80; if (flip_screen()) { if (m_spriteram[offs + 1] & 0x20) { sx = 224 - sx; sy = 224 - sy; } else { sx = 240 - sx; sy = 240 - sy; } flipx = !flipx; flipy = !flipy; } drawgfx_transpen(bitmap,cliprect,machine().gfx[(m_spriteram[offs] & 0x80) ? 3 : 2], m_spriteram[offs] & 0x7f, m_spriteram[offs + 1] & 0x0f, flipx,flipy, sx,sy,0); } }
void metlclsh_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { UINT8 *spriteram = m_spriteram; gfx_element *gfx = machine().gfx[0]; int offs; for (offs = 0; offs < m_spriteram.bytes(); offs += 4) { int attr, code, color, sx, sy, flipx, flipy, wrapy, sizey; attr = spriteram[offs]; if (!(attr & 0x01)) continue; // enable flipy = (attr & 0x02); flipx = (attr & 0x04); color = (attr & 0x08) >> 3; sizey = (attr & 0x10); // double height code = ((attr & 0x60) << 3) + spriteram[offs + 1]; sx = 240 - spriteram[offs + 3]; if (sx < -7) sx += 256; sy = 240 - spriteram[offs + 2]; if (flip_screen()) { sx = 240 - sx; flipx = !flipx; sy = 240 - sy; flipy = !flipy; if (sizey) sy += 16; if (sy > 240) sy -= 256; } /* Draw twice, at sy and sy + 256 (wrap around) */ for (wrapy = 0; wrapy <= 256; wrapy += 256) { if (sizey) { drawgfx_transpen(bitmap,cliprect,gfx, code & ~1, color, flipx,flipy, sx, sy + (flipy ? 0 : -16) + wrapy,0); drawgfx_transpen(bitmap,cliprect,gfx, code | 1, color, flipx,flipy, sx,sy + (flipy ? -16 : 0) + wrapy,0); } else { drawgfx_transpen(bitmap,cliprect,gfx, code, color, flipx,flipy, sx,sy + wrapy,0); } } } }
void markham_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { UINT8 *spriteram = m_spriteram; int offs; for (offs = 0x60; offs < 0x100; offs += 4) { int chr = spriteram[offs + 1]; int col = spriteram[offs + 2]; int fx = flip_screen(); int fy = flip_screen(); int x = spriteram[offs + 3]; int y = spriteram[offs + 0]; int px, py; col &= 0x3f ; if (flip_screen() == 0) { px = x - 2; py = 240 - y; } else { px = 240 - x; py = y; } px = px & 0xff; if (px > 248) px = px - 256; m_gfxdecode->gfx(1)->transmask(bitmap,cliprect, chr, col, fx,fy, px,py, m_palette->transpen_mask(*m_gfxdecode->gfx(1), col, 0)); } }
uint32_t jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { const uint8_t *src = &m_blitter->blit_buffer(y, cliprect.min_x); uint16_t *dst = &m_tmp_bitmap->pix16(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { uint32_t const srcpix = *src++; *dst++ = m_palette->pen(srcpix & 0xf); *dst++ = m_palette->pen((srcpix >> 4) & 0xf); } } //void copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, int32_t destx, int32_t desty, const rectangle &cliprect) copybitmap(bitmap, *m_tmp_bitmap, flip_screen(), flip_screen(),0,0, cliprect); return 0; }
uint32_t nightgal_state::screen_update_nightgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { int x, y; for (y = cliprect.min_y; y <= cliprect.max_y; ++y) { uint8_t *src = &m_blitter->m_blit_buffer[y * 256 + cliprect.min_x]; uint16_t *dst = &m_tmp_bitmap->pix16(y, cliprect.min_x); for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) { uint32_t srcpix = *src++; *dst++ = m_palette->pen(srcpix & 0xf); *dst++ = m_palette->pen((srcpix >> 4) & 0xf); } } copybitmap(bitmap, *m_tmp_bitmap, flip_screen(), flip_screen(),0,0, cliprect); return 0; }
void yunsun16_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) { int offs; const rectangle &visarea = m_screen->visible_area(); int max_x = visarea.max_x + 1; int max_y = visarea.max_y + 1; int pri = *m_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 = (m_spriteram.bytes() - 8) / 2 ; offs >= 0; offs -= 8 / 2) { int x = m_spriteram[offs + 0]; int y = m_spriteram[offs + 1]; int code = m_spriteram[offs + 2]; int attr = m_spriteram[offs + 3]; int flipx = attr & 0x20; int flipy = attr & 0x40; x += m_sprites_scrolldx; y += m_sprites_scrolldy; if (flip_screen()) // not used? { flipx = !flipx; x = max_x - x - 16; flipy = !flipy; y = max_y - y - 16; } m_gfxdecode->gfx(1)->prio_transpen(bitmap,cliprect, code, attr & 0x1f, flipx, flipy, x,y, screen.priority(), pri_mask,15); } }
uint32_t calorie_state::screen_update_calorie(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { int x; if (m_bg_bank & 0x10) { m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); } else { m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); } for (x = 0x400; x >= 0; x -= 4) { int xpos, ypos, tileno, color, flipx, flipy; tileno = m_sprites[x + 0]; color = m_sprites[x + 1] & 0x0f; flipx = m_sprites[x + 1] & 0x40; flipy = 0; ypos = 0xff - m_sprites[x + 2]; xpos = m_sprites[x + 3]; if (flip_screen()) { if (m_sprites[x + 1] & 0x10) ypos = 0xff - ypos + 32; else ypos = 0xff - ypos + 16; xpos = 0xff - xpos - 16; flipx = !flipx; flipy = !flipy; } if (m_sprites[x + 1] & 0x10) { /* 32x32 sprites */ m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, tileno | 0x40, color, flipx, flipy, xpos, ypos - 31, 0); } else { /* 16x16 sprites */ m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, tileno, color, flipx, flipy, xpos, ypos - 15, 0); } } return 0; }
UINT32 kyugo_state::screen_update_kyugo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { if (flip_screen()) m_bg_tilemap->set_scrollx(0, -(m_scroll_x_lo + (m_scroll_x_hi * 256))); else m_bg_tilemap->set_scrollx(0, m_scroll_x_lo + (m_scroll_x_hi * 256)); m_bg_tilemap->set_scrolly(0, m_scroll_y); m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); draw_sprites(bitmap, cliprect); m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); return 0; }
/* the sprite generator IC is the same as Mappy */ void skykid_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) { UINT8 *spriteram = 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()) { 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++) { m_gfxdecode->gfx(2)->transmask(bitmap,cliprect, sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)], color, flipx,flipy, sx + 16*x,sy + 16*y, m_palette->transpen_mask(*m_gfxdecode->gfx(2), color, 0xff)); } } } }
UINT32 gladiatr_state::screen_update_gladiatr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { if (m_video_attributes & 0x20) { int scroll; scroll = m_bg_scrollx + ((m_video_attributes & 0x04) << 6); m_bg_tilemap->set_scrollx(0, scroll ^ (flip_screen() ? 0x0f : 0)); scroll = m_fg_scrollx + ((m_video_attributes & 0x08) << 5); m_fg_tilemap->set_scrollx(0, scroll ^ (flip_screen() ? 0x0f : 0)); // always 0 anyway m_bg_tilemap->set_scrolly(0, m_bg_scrolly); m_fg_tilemap->set_scrolly(0, m_fg_scrolly); m_bg_tilemap->draw(screen, bitmap, cliprect, 0,0); draw_sprites(bitmap,cliprect); m_fg_tilemap->draw(screen, bitmap, cliprect, 0,0); } else bitmap.fill(m_palette->black_pen(), cliprect ); return 0; }
int spbactn_state::draw_video(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, bool alt_sprites) { m_tile_bitmap_bg.fill(0, cliprect); m_tile_bitmap_fg.fill(0, cliprect); m_sprite_bitmap.fill(0, cliprect); bitmap.fill(0, cliprect); m_sprgen->gaiden_draw_sprites(screen, m_gfxdecode, cliprect, m_spvideoram, 0, 0, flip_screen(), m_sprite_bitmap); m_bg_tilemap->draw(screen, m_tile_bitmap_bg, cliprect, 0, 0); m_fg_tilemap->draw(screen, m_tile_bitmap_fg, cliprect, 0, 0); m_mixer->mix_bitmaps(screen, bitmap, cliprect, *m_palette, &m_tile_bitmap_bg, &m_tile_bitmap_fg, (bitmap_ind16*)nullptr, &m_sprite_bitmap); return 0; }
void travrusa_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) { int offs; const rectangle spritevisiblearea(1*8, 31*8-1, 0*8, 24*8-1); const rectangle spritevisibleareaflip(1*8, 31*8-1, 8*8, 32*8-1); rectangle clip = cliprect; if (flip_screen()) clip &= spritevisibleareaflip; else clip &= spritevisiblearea; for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) { int sx = ((m_spriteram[offs + 3] + 8) & 0xff) - 8; int sy = 240 - m_spriteram[offs]; int code = m_spriteram[offs + 2]; int attr = m_spriteram[offs + 1]; int flipx = attr & 0x40; int flipy = attr & 0x80; if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; flipx = !flipx; flipy = !flipy; } m_gfxdecode->gfx(1)->transpen(bitmap,clip, code, attr & 0x0f, flipx, flipy, sx, sy, 0); } }
void lastduel_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ) { UINT16 *buffered_spriteram16 = m_spriteram->buffer(); int offs; if (!m_sprite_pri_mask) if (pri == 1) return; /* only low priority sprites in lastduel */ for (offs = 0x400 - 4; offs >= 0; offs -= 4) { int attr, sy, sx, flipx, flipy, code, color; attr = buffered_spriteram16[offs + 1]; if (m_sprite_pri_mask) /* only madgear seems to have this */ { if (pri == 1 && (attr & m_sprite_pri_mask)) continue; if (pri == 0 && !(attr & m_sprite_pri_mask)) continue; } code = buffered_spriteram16[offs]; sx = buffered_spriteram16[offs + 3] & 0x1ff; sy = buffered_spriteram16[offs + 2] & 0x1ff; if (sy > 0x100) sy -= 0x200; flipx = attr & 0x20; flipy = attr & m_sprite_flipy_mask; /* 0x40 for lastduel, 0x80 for madgear */ color = attr & 0x0f; if (flip_screen()) { sx = 496 - sx; sy = 240 - sy; flipx = !flipx; flipy = !flipy; } m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, code, color, flipx,flipy, sx,sy,15); } }
void m52_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int initoffs) { int offs; /* draw the sprites */ for (offs = initoffs; offs >= (initoffs & 0xc0); 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]; /* 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 */ rectangle 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 = 238 - sx; sy = 282 - sy; } sx += 129; /* in theory anyways; in practice, some of the molecule-looking guys get clipped */ #ifdef SPLIT_SPRITES sect_rect(&clip, cliprect); #else clip = cliprect; #endif m_sp_gfxdecode->gfx(0)->transmask(bitmap,clip, code, color, flipx, flipy, sx, sy, m_sp_palette->transpen_mask(*m_sp_gfxdecode->gfx(0), color, 0)); } }
int main(int argc, char * argv) { screen_t * main_screen = init_screen(); flake_t * flakes = make_some_flakes(main_screen, INITIAL_SNOW); for (;;) { write_screen(main_screen, flakes); flip_screen(main_screen); update_flakes(main_screen, flakes); flakes = add_flakes(main_screen, flakes, INCREMENTAL_SNOW); usleep(90000); } return 0; }
void gladiatr_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { int offs; for (offs = 0;offs < 0x80;offs += 2) { static const int tile_offset[2][2] = { {0x0,0x1}, {0x2,0x3}, }; UINT8 *src = &m_spriteram[offs + (m_sprite_buffer << 7)]; int attributes = src[0x800]; int size = (attributes & 0x10) >> 4; int bank = (attributes & 0x01) + ((attributes & 0x02) ? m_sprite_bank : 0); int tile_number = (src[0]+256*bank); int sx = src[0x400+1] + 256*(src[0x801]&1) - 0x38; int sy = 240 - src[0x400] - (size ? 16 : 0); int xflip = attributes & 0x04; int yflip = attributes & 0x08; int color = src[1] & 0x1f; int x,y; if (flip_screen()) { xflip = !xflip; yflip = !yflip; } for (y = 0; y <= size; y++) { for (x = 0; x <= size; x++) { int ex = xflip ? (size - x) : x; int ey = yflip ? (size - y) : y; int t = tile_offset[ey][ex] + tile_number; m_gfxdecode->gfx(2)->transpen(m_palette,bitmap,cliprect, t, color, xflip, yflip, sx+x*16, sy+y*16,0); } } } }
uint32_t superwng_state::screen_update_superwng(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); rectangle tmp = cliprect; if (flip_screen()) { tmp.min_x += 32; m_fg_tilemap->draw(screen, bitmap, tmp, 0, 0); } else { tmp.max_x -= 32; m_fg_tilemap->draw(screen, bitmap, tmp, 0, 0); } //sprites for (int i = 0x3e; i >= 0; i -= 2) { /* 76543210 video0: xxxxxx code x /flip x enable? video1: xxxxxxxx x color0: xxxxxxxx y color1: xxx unused? x ? xxxx color */ if (~m_videoram_bg[i] & 1) continue; int code = (m_videoram_bg[i] >> 2) | 0x40; int flip = ~m_videoram_bg[i] >> 1 & 1; int sx = 240 - m_videoram_bg[i + 1]; int sy = m_colorram_bg[i]; int color = m_colorram_bg[i + 1] & 0xf; m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, code, color, flip, flip, sx, sy, 0); } return 0; }
void lwings_state::trojan_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { UINT8 *buffered_spriteram = m_spriteram->buffer(); int offs; for (offs = m_spriteram->bytes() - 4; offs >= 0; offs -= 4) { if (is_sprite_on(buffered_spriteram, offs)) { int code, color, sx, sy, flipx, flipy; sx = buffered_spriteram[offs + 3] - 0x100 * (buffered_spriteram[offs + 1] & 0x01); sy = buffered_spriteram[offs + 2]; if (sy > 0xf8) sy -= 0x100; code = buffered_spriteram[offs] | ((buffered_spriteram[offs + 1] & 0x20) << 4) | ((buffered_spriteram[offs + 1] & 0x40) << 2) | ((buffered_spriteram[offs + 1] & 0x80) << 3); color = (buffered_spriteram[offs + 1] & 0x0e) >> 1; if (m_bg2_avenger_hw) { flipx = 0; /* Avengers */ flipy = ~buffered_spriteram[offs + 1] & 0x10; } else { flipx = buffered_spriteram[offs + 1] & 0x10; /* Trojan */ flipy = 1; } if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; flipx = !flipx; flipy = !flipy; } drawgfx_transpen(bitmap,cliprect,machine().gfx[2], code,color, flipx,flipy, sx,sy,15); } } }
void m52_state::draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect, int xpos, int ypos, int image) { rectangle rect; const rectangle &visarea = m_screen->visible_area(); const pen_t *paldata = m_bg_palette->pens(); if (flip_screen()) { xpos = 264 - xpos; ypos = 264 - ypos - BGHEIGHT; } xpos += 124; /* this may not be correct */ ypos += 16; m_bg_gfxdecode->gfx(image)->transpen(bitmap,cliprect, 0, 0, flip_screen(), flip_screen(), xpos, ypos, 0); m_bg_gfxdecode->gfx(image)->transpen(bitmap,cliprect, 0, 0, flip_screen(), flip_screen(), xpos - 256, ypos, 0); // create a solid fill below the 64 pixel high bg images if (m_do_bg_fills) { rect.min_x = visarea.min_x; rect.max_x = visarea.max_x; if (flip_screen()) { rect.min_y = ypos - BGHEIGHT; rect.max_y = ypos - 1; } else { rect.min_y = ypos + BGHEIGHT; rect.max_y = ypos + 2 * BGHEIGHT - 1; } bitmap.fill(paldata[m_bg_gfxdecode->gfx(image)->colorbase() + 3], rect); } }
void xain_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) { for (int offs = 0; offs < m_spriteram.bytes();offs += 4) { int sx,sy,flipx,flipy; int attr = m_spriteram[offs+1]; int numtile = m_spriteram[offs+2] | ((attr & 7) << 8); int color = (attr & 0x38) >> 3; sx = 238 - m_spriteram[offs+3]; if (sx <= -7) sx += 256; sy = 240 - m_spriteram[offs]; if (sy <= -7) sy += 256; flipx = attr & 0x40; flipy = 0; if (flip_screen()) { sx = 238 - sx; sy = 240 - sy; flipx = !flipx; flipy = !flipy; } if (attr & 0x80) /* double height */ { m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, numtile, color, flipx,flipy, sx,flipy ? sy+16:sy-16,0); m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, numtile+1, color, flipx,flipy, sx,sy,0); } else { m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, numtile, color, flipx,flipy, sx,sy,0); } } }
UINT32 dacholer_state::screen_update_dacholer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { if (flip_screen()) { m_bg_tilemap->set_scrollx(0, 256 - m_scroll_x); m_bg_tilemap->set_scrolly(0, 256 - m_scroll_y); } else { m_bg_tilemap->set_scrollx(0, m_scroll_x); m_bg_tilemap->set_scrolly(0, m_scroll_y); } m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); draw_sprites(bitmap, cliprect); m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); return 0; }
void vball_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { gfx_element *gfx = machine().gfx[1]; UINT8 *src = m_spriteram; int i; /* 240-Y S|X|CLR|WCH WHICH 240-X xxxxxxxx x|x|xxx|xxx xxxxxxxx xxxxxxxx */ for (i = 0;i < m_spriteram.bytes();i += 4) { int attr = src[i+1]; int which = src[i+2]+((attr & 0x07)<<8); int sx = ((src[i+3] + 8) & 0xff) - 7; int sy = 240 - src[i]; int size = (attr & 0x80) >> 7; int color = (attr & 0x38) >> 3; int flipx = ~attr & 0x40; int flipy = 0; int dy = -16; if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; flipx = !flipx; flipy = !flipy; dy = -dy; } switch (size) { case 0: /* normal */ DRAW_SPRITE(0,sx,sy); break; case 1: /* double y */ DRAW_SPRITE(0,sx,sy + dy); DRAW_SPRITE(1,sx,sy); break; } } }