UINT32 speglsht_state::screen_update_speglsht(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { int x,y,dy; dy=(m_videoreg&0x20)?(256*512):0; //visible frame for(y=0;y<256;y++) { for(x=0;x<512;x++) { int tmp=dy+y*512+x; PLOT_PIXEL_RGB(x-67,y-5,(m_framebuffer[tmp]>>0)&0xff,(m_framebuffer[tmp]>>8)&0xff,(m_framebuffer[tmp]>>16)&0xff); } } //draw st0016 gfx to temporary bitmap (indexed 16) m_bitmap->fill(0); st0016_draw_screen(screen, *m_bitmap, cliprect); //copy temporary bitmap to rgb 32 bit bitmap for(y=cliprect.min_y; y<cliprect.max_y;y++) { UINT16 *srcline = &m_bitmap->pix16(y); for(x=cliprect.min_x; x<cliprect.max_x;x++) { if(srcline[x]) { rgb_t color=palette_get_color(machine(), srcline[x]); PLOT_PIXEL_RGB(x,y,RGB_RED(color),RGB_GREEN(color),RGB_BLUE(color)); } } } return 0; }
UINT32 williams_state::screen_update_williams2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { rgb_t pens[16]; int x, y; /* draw the background */ m_bg_tilemap->draw(bitmap, cliprect, 0, 0); /* fetch the relevant pens */ for (x = 1; x < 16; x++) pens[x] = palette_get_color(machine(), m_williams2_fg_color * 16 + x); /* loop over rows */ for (y = cliprect.min_y; y <= cliprect.max_y; y++) { UINT8 *source = &m_videoram[y]; UINT32 *dest = &bitmap.pix32(y); /* loop over columns */ for (x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { int pix = source[(x/2) * 256]; if (pix & 0xf0) dest[x+0] = pens[pix >> 4]; if (pix & 0x0f) dest[x+1] = pens[pix & 0x0f]; } } return 0; }
static PALETTE_INIT( wolfpack ) { int i; palette_set_color(machine, 0, MAKE_RGB(0x00, 0x00, 0x00)); palette_set_color(machine, 1, MAKE_RGB(0xc1, 0xc1, 0xc1)); palette_set_color(machine, 2, MAKE_RGB(0x81, 0x81, 0x81)); palette_set_color(machine, 3, MAKE_RGB(0x48, 0x48, 0x48)); for (i = 0; i < 4; i++) { rgb_t color = palette_get_color(machine, i); palette_set_color_rgb(machine, 4 + i, RGB_RED(color) < 0xb8 ? RGB_RED(color) + 0x48 : 0xff, RGB_GREEN(color) < 0xb8 ? RGB_GREEN(color) + 0x48 : 0xff, RGB_BLUE(color) < 0xb8 ? RGB_BLUE(color) + 0x48 : 0xff); } colortable[0] = 0; colortable[1] = 1; colortable[2] = 1; colortable[3] = 0; colortable[4] = 0; colortable[5] = 2; colortable[6] = 0; colortable[7] = 3; }
static int zapper_hit_pixel(const UINT32 *input) { UINT16 pix; UINT8 r, g, b; pix = read_pixel(Machine->scrbitmap, input[1], input[2]); palette_get_color(pix, &r, &g, &b); return (((UINT16) r) + ((UINT16) g) + ((UINT16) b)) >= 240*3; }
static WRITE8_DEVICE_HANDLER( cliff_sound_overlay_w ) { int sound = data & 3; int overlay = (data & 0x10) ? 1 : 0; /* configure pen 0 and 1 as transparent in the renderer and use it as the compositing color */ if (overlay) { palette_set_color(device->machine(), 0, palette_get_color(device->machine(), 0) & MAKE_ARGB(0,255,255,255)); palette_set_color(device->machine(), 1, palette_get_color(device->machine(), 1) & MAKE_ARGB(0,255,255,255)); } else { palette_set_color(device->machine(), 0, palette_get_color(device->machine(), 0) | MAKE_ARGB(255,0,0,0)); palette_set_color(device->machine(), 1, palette_get_color(device->machine(), 1) | MAKE_ARGB(255,0,0,0)); } /* audio */ discrete_sound_w(device, CLIFF_ENABLE_SND_1, sound & 1); discrete_sound_w(device, CLIFF_ENABLE_SND_2, (sound >> 1) & 1); }
static SCREEN_UPDATE(speglsht) { speglsht_state *state = screen->machine().driver_data<speglsht_state>(); int x,y,dy; dy=(state->m_videoreg&0x20)?(256*512):0; //visible frame for(y=0;y<256;y++) { for(x=0;x<512;x++) { int tmp=dy+y*512+x; PLOT_PIXEL_RGB(x-67,y-5,(state->m_framebuffer[tmp]>>0)&0xff,(state->m_framebuffer[tmp]>>8)&0xff,(state->m_framebuffer[tmp]>>16)&0xff); } } //draw st0016 gfx to temporary bitmap (indexed 16) bitmap_fill(state->m_bitmap,NULL,0); st0016_draw_screen(screen, state->m_bitmap, cliprect); //copy temporary bitmap to rgb 32 bit bitmap for(y=cliprect->min_y; y<cliprect->max_y;y++) { UINT16 *srcline = BITMAP_ADDR16(state->m_bitmap, y, 0); for(x=cliprect->min_x; x<cliprect->max_x;x++) { if(srcline[x]) { rgb_t color=palette_get_color(screen->machine(), srcline[x]); PLOT_PIXEL_RGB(x,y,RGB_RED(color),RGB_GREEN(color),RGB_BLUE(color)); } } } return 0; }
static void gpworld_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) { gpworld_state *state = machine.driver_data<gpworld_state>(); const int SPR_Y_TOP = 0; const int SPR_Y_BOTTOM = 1; const int SPR_X_LO = 2; const int SPR_X_HI = 3; const int SPR_SKIP_LO = 4; const int SPR_SKIP_HI = 5; const int SPR_GFXOFS_LO = 6; const int SPR_GFXOFS_HI = 7; int flip = state->flip_screen(); int i; UINT8 *GFX = state->memregion("gfx2")->base(); /* Heisted from Daphne which heisted it from MAME */ for (i = 0; i < 0x800; i += 8) { UINT8 *spr_reg = state->m_sprite_ram + i; if (spr_reg[SPR_Y_BOTTOM] && spr_reg[SPR_X_LO] != 0xff) { int row; int src = spr_reg[SPR_GFXOFS_LO] + (spr_reg[SPR_GFXOFS_HI] << 8); int skip = spr_reg[SPR_SKIP_LO] + (spr_reg[SPR_SKIP_HI] << 8); int height = spr_reg[SPR_Y_BOTTOM] - spr_reg[SPR_Y_TOP]; int sy = spr_reg[SPR_Y_TOP] + 1; int sx = spr_reg[SPR_X_LO] + ((spr_reg[SPR_X_HI] & 0x01) << 8) ; int sprite_color = (spr_reg[SPR_X_HI] >> 4) & 0x0f; int sprite_bank = (spr_reg[SPR_X_HI] >> 1) & 0x07; /* logerror("%x - %x = %x\n", spr_reg[SPR_Y_BOTTOM], spr_reg[SPR_Y_TOP], height); logerror("Draw Sprite #%x with src %x, skip %x, height %x, y %x, x %x\n", i/8, src, skip, height, sy, sx); logerror("%02x %02x %02x %02x %02x %02x %02x %02x\n", spr_reg[SPR_Y_TOP], spr_reg[SPR_Y_BOTTOM], spr_reg[SPR_X_LO], spr_reg[SPR_X_HI], spr_reg[SPR_SKIP_LO], spr_reg[SPR_SKIP_HI], spr_reg[SPR_GFXOFS_LO], spr_reg[SPR_GFXOFS_HI]); draw_pixel(bitmap,cliprect,sx,sy,0xffffffff,flip); */ for (row = 0; row < height; row++) { int x, y; int src2; src = src2 = src + skip; x = sx; y = sy+row; while (1) { int data_lo, data_high; UINT8 pixel1, pixel2, pixel3, pixel4; data_lo = GFX[(src2 & 0x7fff) | (sprite_bank << 16)]; data_high = GFX[(src2 & 0x7fff) | 0x8000 | (sprite_bank << 16)]; pixel1 = data_high >> 0x04; pixel2 = data_high & 0x0f; pixel3 = data_lo >> 0x04; pixel4 = data_lo & 0x0f; /* we'll see if this is still applicable */ if (src & 0x8000) { UINT8 temp_pixel; temp_pixel = pixel1; pixel1 = pixel4; pixel4 = temp_pixel; temp_pixel = pixel2; pixel2 = pixel3; pixel3 = temp_pixel; src2--; } else { src2++; } /* Daphne says "don't draw the pixel if it's black". */ draw_pixel(bitmap,cliprect,x+0,y,palette_get_color(machine, pixel1 + (sprite_color*0x10 + 0x200)),flip); draw_pixel(bitmap,cliprect,x+1,y,palette_get_color(machine, pixel2 + (sprite_color*0x10 + 0x200)),flip); draw_pixel(bitmap,cliprect,x+2,y,palette_get_color(machine, pixel3 + (sprite_color*0x10 + 0x200)),flip); draw_pixel(bitmap,cliprect,x+3,y,palette_get_color(machine, pixel4 + (sprite_color*0x10 + 0x200)),flip); x += 4; /* stop drawing when the sprite data is 0xf */ if (((data_lo & 0x0f) == 0x0f) && (!(src & 0x8000))) { break; } else if ((src & 0x8000) && ((data_high & 0xf0) == 0xf0)) { break; } } } } }