From 345a0c470bbd4c03dee69aa0725948116af31bfe Mon Sep 17 00:00:00 2001 From: Zsolt Vasvari Date: Fri, 22 Feb 2008 14:37:10 +0000 Subject: [PATCH] machine->pens lookup removal --- src/mame/video/othldrby.c | 2 +- src/mame/video/othunder.c | 2 +- src/mame/video/pacman.c | 2 +- src/mame/video/parodius.c | 2 +- src/mame/video/pastelg.c | 31 +++--------------- src/mame/video/pktgaldx.c | 2 +- src/mame/video/playmark.c | 10 +++--- src/mame/video/poolshrk.c | 2 +- src/mame/video/popeye.c | 2 +- src/mame/video/powerins.c | 2 +- src/mame/video/ppu2c0x.c | 22 ++++++------- src/mame/video/psikyo4.c | 4 +-- src/mame/video/psx.c | 2 +- src/mame/video/quasar.c | 4 +-- src/mame/video/rallyx.c | 2 +- src/mame/video/realbrk.c | 8 ++--- src/mame/video/rollerg.c | 2 +- src/mame/video/rollrace.c | 2 +- src/mame/video/segas24.c | 2 +- src/mame/video/senjyo.c | 51 +++++++++++------------------ src/mame/video/seta2.c | 4 +-- src/mame/video/sf.c | 2 +- src/mame/video/shangha3.c | 3 +- src/mame/video/simpl156.c | 2 +- src/mame/video/simpsons.c | 2 +- src/mame/video/skyfox.c | 8 ++--- src/mame/video/skyraid.c | 17 +++------- src/mame/video/slapshot.c | 2 +- src/mame/video/snk68.c | 4 +-- src/mame/video/spcforce.c | 2 +- src/mame/video/splash.c | 8 ++--- src/mame/video/sprint8.c | 2 +- src/mame/video/spy.c | 12 +++---- src/mame/video/srmp2.c | 6 ++-- src/mame/video/sshangha.c | 6 ++-- src/mame/video/ssv.c | 2 +- src/mame/video/st0016.c | 4 +-- src/mame/video/starcrus.c | 68 +++++++++++++-------------------------- src/mame/video/starshp1.c | 4 +-- src/mame/video/stfight.c | 2 +- src/mame/video/suna16.c | 4 +-- src/mame/video/suna8.c | 2 +- src/mame/video/supbtime.c | 2 +- src/mame/video/suprloco.c | 16 ++++----- src/mame/video/surpratk.c | 2 +- src/mame/video/system1.c | 10 +++--- src/mame/video/system16.c | 26 +++++++-------- 47 files changed, 156 insertions(+), 222 deletions(-) diff --git a/src/mame/video/othldrby.c b/src/mame/video/othldrby.c index bcec1ecf6a1..606ccc0db69 100644 --- a/src/mame/video/othldrby.c +++ b/src/mame/video/othldrby.c @@ -199,7 +199,7 @@ VIDEO_UPDATE( othldrby ) fillbitmap(priority_bitmap,0,cliprect); - fillbitmap(bitmap,machine->pens[0],cliprect); + fillbitmap(bitmap,0,cliprect); for (layer = 0;layer < 3;layer++) tilemap_draw(bitmap,cliprect,bg_tilemap[layer],0,0); diff --git a/src/mame/video/othunder.c b/src/mame/video/othunder.c index 683cf2bd630..ca2dd4b1b6d 100644 --- a/src/mame/video/othunder.c +++ b/src/mame/video/othunder.c @@ -232,7 +232,7 @@ VIDEO_UPDATE( othunder ) fillbitmap(priority_bitmap,0,cliprect); /* Ensure screen blanked even when bottom layer not drawn due to disable bit */ - fillbitmap(bitmap, machine->pens[0], cliprect); + fillbitmap(bitmap, 0, cliprect); TC0100SCN_tilemap_draw(machine,bitmap,cliprect,0,layer[0],TILEMAP_DRAW_OPAQUE,1); TC0100SCN_tilemap_draw(machine,bitmap,cliprect,0,layer[1],0,2); diff --git a/src/mame/video/pacman.c b/src/mame/video/pacman.c index 77bb131eb90..133ec07a89b 100644 --- a/src/mame/video/pacman.c +++ b/src/mame/video/pacman.c @@ -219,7 +219,7 @@ WRITE8_HANDLER( pacman_flipscreen_w ) VIDEO_UPDATE( pacman ) { if (bgpriority != 0) - fillbitmap(bitmap,machine->pens[0],cliprect); + fillbitmap(bitmap,0,cliprect); else tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_OPAQUE,0); diff --git a/src/mame/video/parodius.c b/src/mame/video/parodius.c index d1a81880ded..13534e5d3fb 100644 --- a/src/mame/video/parodius.c +++ b/src/mame/video/parodius.c @@ -88,7 +88,7 @@ VIDEO_UPDATE( parodius ) sortlayers(layer,layerpri); fillbitmap(priority_bitmap,0,cliprect); - fillbitmap(bitmap,machine->pens[16 * bg_colorbase],cliprect); + fillbitmap(bitmap,16 * bg_colorbase,cliprect); tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[0]],0,1); tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[1]],0,2); tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[2]],0,4); diff --git a/src/mame/video/pastelg.c b/src/mame/video/pastelg.c index 0d87841848f..f0d47ec89f3 100644 --- a/src/mame/video/pastelg.c +++ b/src/mame/video/pastelg.c @@ -18,10 +18,8 @@ static int pastelg_gfxrom; static int pastelg_dispflag; static int pastelg_flipscreen; static int blitter_direction_x, blitter_direction_y; -static int pastelg_screen_refresh; static int pastelg_palbank; -static mame_bitmap *pastelg_tmpbitmap; static UINT8 *pastelg_videoram; static UINT8 *pastelg_clut; @@ -137,13 +135,6 @@ static void pastelg_vramflip(void) } pastelg_flipscreen_old = pastelg_flipscreen; - pastelg_screen_refresh = 1; -} - -static void update_pixel(int x,int y) -{ - int color = pastelg_videoram[(y * Machine->screen[0].width) + x]; - *BITMAP_ADDR16(pastelg_tmpbitmap, y, x) = color; } static TIMER_CALLBACK( blitter_timer_callback ) @@ -239,14 +230,12 @@ static void pastelg_gfxdraw(void) { color = ((pastelg_palbank * 0x10) + color); pastelg_videoram[(dy * Machine->screen[0].width) + dx] = color; - update_pixel(dx, dy); } } else { color = ((pastelg_palbank * 0x10) + pastelg_clut[color]); pastelg_videoram[(dy * Machine->screen[0].width) + dx] = color; - update_pixel(dx, dy); } nb1413m3_busyctr++; @@ -263,7 +252,6 @@ static void pastelg_gfxdraw(void) ******************************************************************************/ VIDEO_START( pastelg ) { - pastelg_tmpbitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height,machine->screen[0].format); pastelg_videoram = auto_malloc(machine->screen[0].width * machine->screen[0].height * sizeof(UINT8)); pastelg_clut = auto_malloc(0x10 * sizeof(UINT8)); memset(pastelg_videoram, 0x00, (machine->screen[0].width * machine->screen[0].height * sizeof(UINT8))); @@ -275,27 +263,16 @@ VIDEO_START( pastelg ) ******************************************************************************/ VIDEO_UPDATE( pastelg ) { - int x, y; - UINT8 color; - - if (pastelg_screen_refresh) + if (pastelg_dispflag) { - pastelg_screen_refresh = 0; + int x, y; for (y = 0; y < machine->screen[0].height; y++) - { for (x = 0; x < machine->screen[0].width; x++) - { - color = pastelg_videoram[(y * machine->screen[0].width) + x]; - *BITMAP_ADDR16(pastelg_tmpbitmap, y, x) = machine->pens[color]; - } - } + *BITMAP_ADDR16(bitmap, y, x) = pastelg_videoram[(y * machine->screen[0].width) + x]; } - - if (pastelg_dispflag) - copybitmap(bitmap, pastelg_tmpbitmap, 0, 0, 0, 0, cliprect); else - fillbitmap(bitmap, machine->pens[0x00], 0); + fillbitmap(bitmap, 0, cliprect); return 0; } diff --git a/src/mame/video/pktgaldx.c b/src/mame/video/pktgaldx.c index becfc35cc41..8e476153a67 100644 --- a/src/mame/video/pktgaldx.c +++ b/src/mame/video/pktgaldx.c @@ -89,7 +89,7 @@ VIDEO_UPDATE(pktgaldx) flip_screen_set( deco16_pf12_control[0]&0x80 ); deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll); - fillbitmap(bitmap,machine->pens[0x0],cliprect); /* not Confirmed */ + fillbitmap(bitmap,0,cliprect); /* not Confirmed */ fillbitmap(priority_bitmap,0,NULL); deco16_tilemap_2_draw(bitmap,cliprect,0,0); diff --git a/src/mame/video/playmark.c b/src/mame/video/playmark.c index 66e3f55447d..35049b58e20 100644 --- a/src/mame/video/playmark.c +++ b/src/mame/video/playmark.c @@ -369,7 +369,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rec } } -static void draw_bitmap(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) +static void draw_bitmap(mame_bitmap *bitmap, const rectangle *cliprect) { int x,y,count; int color; @@ -386,7 +386,7 @@ static void draw_bitmap(running_machine *machine, mame_bitmap *bitmap, const rec { if(bg_full_size) { - *BITMAP_ADDR16(bitmap, (y + bgscrolly) & 0x1ff, (x + bgscrollx) & 0x1ff) = machine->pens[0x100 + color]; + *BITMAP_ADDR16(bitmap, (y + bgscrolly) & 0x1ff, (x + bgscrollx) & 0x1ff) = 0x100 + color; pri = BITMAP_ADDR8(priority_bitmap, (y + bgscrolly) & 0x1ff, 0); pri[(x + bgscrollx) & 0x1ff] |= 2; @@ -396,7 +396,7 @@ static void draw_bitmap(running_machine *machine, mame_bitmap *bitmap, const rec /* 50% size */ if(!(x % 2) && !(y % 2)) { - *BITMAP_ADDR16(bitmap, (y / 2 + bgscrolly) & 0x1ff, (x / 2 + bgscrollx) & 0x1ff) = machine->pens[0x100 + color]; + *BITMAP_ADDR16(bitmap, (y / 2 + bgscrolly) & 0x1ff, (x / 2 + bgscrollx) & 0x1ff) = 0x100 + color; pri = BITMAP_ADDR8(priority_bitmap, (y / 2 + bgscrolly) & 0x1ff, 0); pri[(x / 2 + bgscrollx) & 0x1ff] |= 2; @@ -415,7 +415,7 @@ VIDEO_UPDATE( bigtwin ) tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); if (bg_enable) - draw_bitmap(machine, bitmap, cliprect); + draw_bitmap(bitmap, cliprect); draw_sprites(machine, bitmap,cliprect,4); tilemap_draw(bitmap,cliprect,tx_tilemap,0,0); return 0; @@ -427,7 +427,7 @@ VIDEO_UPDATE( excelsr ) tilemap_draw(bitmap,cliprect,fg_tilemap,0,1); if (bg_enable) - draw_bitmap(machine, bitmap, cliprect); + draw_bitmap(bitmap, cliprect); tilemap_draw(bitmap,cliprect,tx_tilemap,0,4); draw_sprites(machine,bitmap,cliprect,2); return 0; diff --git a/src/mame/video/poolshrk.c b/src/mame/video/poolshrk.c index 411603a54b2..442097d17f7 100644 --- a/src/mame/video/poolshrk.c +++ b/src/mame/video/poolshrk.c @@ -35,7 +35,7 @@ VIDEO_UPDATE( poolshrk ) tilemap_mark_all_tiles_dirty(bg_tilemap); - fillbitmap(bitmap, machine->pens[0], cliprect); + fillbitmap(bitmap, 0, cliprect); /* draw sprites */ diff --git a/src/mame/video/popeye.c b/src/mame/video/popeye.c index 3537cf5a30f..4f54a330cb2 100644 --- a/src/mame/video/popeye.c +++ b/src/mame/video/popeye.c @@ -288,7 +288,7 @@ static void draw_background(running_machine *machine, mame_bitmap *bitmap, const set_background_palette(machine, (*popeye_palettebank & 0x08) >> 3); if (popeye_background_pos[1] == 0) /* no background */ - fillbitmap(bitmap,machine->pens[0],cliprect); + fillbitmap(bitmap,0,cliprect); else { /* copy the background graphics */ diff --git a/src/mame/video/powerins.c b/src/mame/video/powerins.c index d0c4986a8c1..af73940d3c7 100644 --- a/src/mame/video/powerins.c +++ b/src/mame/video/powerins.c @@ -367,7 +367,7 @@ if (input_code_pressed(KEYCODE_Z)) #endif if (layers_ctrl&1) tilemap_draw(bitmap,cliprect, tilemap_0, 0, 0); - else fillbitmap(bitmap,machine->pens[0],cliprect); + else fillbitmap(bitmap,0,cliprect); if (layers_ctrl&8) draw_sprites(machine,bitmap,cliprect); if (layers_ctrl&2) tilemap_draw(bitmap,cliprect, tilemap_1, 0, 0); return 0; diff --git a/src/mame/video/ppu2c0x.c b/src/mame/video/ppu2c0x.c index 9978d7c2905..2e0691e3456 100644 --- a/src/mame/video/ppu2c0x.c +++ b/src/mame/video/ppu2c0x.c @@ -423,7 +423,7 @@ static void draw_background(const int num, UINT8 *line_priority ) } /* cache the background pen */ - back_pen = chips[num].machine->pens[(chips[num].back_color & color_mask)+intf->color_base[num]]; + back_pen = (chips[num].back_color & color_mask)+intf->color_base[num]; /* determine where in the nametable to start drawing from */ /* based on the current scanline and scroll regs */ @@ -739,7 +739,7 @@ static void render_scanline(int num) color_mask = 0xff; /* cache the background pen */ - back_pen = chips[num].machine->pens[(chips[num].back_color & color_mask)+intf->color_base[num]]; + back_pen = (chips[num].back_color & color_mask)+intf->color_base[num]; // Fill this scanline with the background pen. for (i = 0; i < bitmap->width; i ++) @@ -803,10 +803,10 @@ static void update_scanline(int num ) else penNum = this_ppu->videoram[this_ppu->videoram_addr & 0x3f00] & 0x3f; - back_pen = chips[num].machine->pens[penNum + intf->color_base[num]]; + back_pen = penNum + intf->color_base[num]; } else - back_pen = chips[num].machine->pens[(this_ppu->back_color & color_mask)+intf->color_base[num]]; + back_pen = (this_ppu->back_color & color_mask)+intf->color_base[num]; // Fill this scanline with the background pen. for (i = 0; i < bitmap->width; i ++) @@ -986,10 +986,10 @@ void ppu2c0x_reset(int num, int scan_scale ) for( i = 0; i < ARRAY_LENGTH( default_colortable_mono ); i++ ) { /* monochromatic table */ - chips[num].colortable_mono[i] = chips[num].machine->pens[default_colortable_mono[i] + color_base]; + chips[num].colortable_mono[i] = default_colortable_mono[i] + color_base; /* color table */ - chips[num].colortable[i] = chips[num].machine->pens[default_colortable[i] + color_base]; + chips[num].colortable[i] = default_colortable[i] + color_base; } } @@ -1132,7 +1132,7 @@ void ppu2c0x_w( int num, offs_t offset, UINT8 data ) { UINT8 oldColor = this_ppu->videoram[i+0x3f00]; - this_ppu->colortable[i] = chips[num].machine->pens[color_base + oldColor + (data & PPU_CONTROL1_COLOR_EMPHASIS)*2]; + this_ppu->colortable[i] = color_base + oldColor + (data & PPU_CONTROL1_COLOR_EMPHASIS)*2; } } @@ -1248,8 +1248,8 @@ void ppu2c0x_w( int num, offs_t offset, UINT8 data ) if ( tempAddr & 0x03 ) { - this_ppu->colortable[ tempAddr & 0x1f ] = chips[num].machine->pens[color_base + data + colorEmphasis]; - this_ppu->colortable_mono[tempAddr & 0x1f] = chips[num].machine->pens[color_base + (data & 0xf0) + colorEmphasis]; + this_ppu->colortable[ tempAddr & 0x1f ] = color_base + data + colorEmphasis; + this_ppu->colortable_mono[tempAddr & 0x1f] = color_base + (data & 0xf0) + colorEmphasis; } /* The only valid background colors are writes to 0x3f00 and 0x3f10 */ @@ -1261,8 +1261,8 @@ void ppu2c0x_w( int num, offs_t offset, UINT8 data ) this_ppu->back_color = data; for( i = 0; i < 32; i += 4 ) { - this_ppu->colortable[ i ] = chips[num].machine->pens[color_base + data + colorEmphasis]; - this_ppu->colortable_mono[i] = chips[num].machine->pens[color_base + (data & 0xf0) + colorEmphasis]; + this_ppu->colortable[ i ] = color_base + data + colorEmphasis; + this_ppu->colortable_mono[i] = color_base + (data & 0xf0) + colorEmphasis; } } } diff --git a/src/mame/video/psikyo4.c b/src/mame/video/psikyo4.c index 139a945aa0e..88edef6fcd4 100644 --- a/src/mame/video/psikyo4.c +++ b/src/mame/video/psikyo4.c @@ -127,12 +127,12 @@ VIDEO_UPDATE( psikyo4 ) { if (screen==0) { - fillbitmap(bitmap, machine->pens[0x1000], cliprect); + fillbitmap(bitmap, 0x1000, cliprect); draw_sprites(machine, bitmap, cliprect, 0x0000); } else if (screen==1) { - fillbitmap(bitmap, machine->pens[0x1001], cliprect); + fillbitmap(bitmap, 0x1001, cliprect); draw_sprites(machine, bitmap, cliprect, 0x2000); } return 0; diff --git a/src/mame/video/psx.c b/src/mame/video/psx.c index 6f1f9349d47..52c5c338f85 100644 --- a/src/mame/video/psx.c +++ b/src/mame/video/psx.c @@ -932,7 +932,7 @@ VIDEO_UPDATE( psx ) n_line = n_lines; while( n_line > 0 ) { - draw_scanline16( bitmap, n_x + n_left, n_y + n_top, n_columns, m_p_p_vram[ n_y + m_n_displaystarty ] + n_x + n_displaystartx, machine->pens, -1 ); + draw_scanline16( bitmap, n_x + n_left, n_y + n_top, n_columns, m_p_p_vram[ n_y + m_n_displaystarty ] + n_x + n_displaystartx, NULL, -1 ); n_y++; n_line--; } diff --git a/src/mame/video/quasar.c b/src/mame/video/quasar.c index e41bdb0ef1a..0176f07ae14 100644 --- a/src/mame/video/quasar.c +++ b/src/mame/video/quasar.c @@ -176,7 +176,7 @@ VIDEO_UPDATE( quasar ) if (*BITMAP_ADDR8(s2636_0_bitmap, offs, bx) != 0) cvs_collision_register |= 0x04; if (*BITMAP_ADDR8(s2636_2_bitmap, offs, bx) != 0) cvs_collision_register |= 0x08; - *BITMAP_ADDR16(bitmap, offs, bx) = machine->pens[7]; + *BITMAP_ADDR16(bitmap, offs, bx) = 7; } } } @@ -200,7 +200,7 @@ VIDEO_UPDATE( quasar ) if (S2636_IS_PIXEL_DRAWN(pixel)) { - *BITMAP_ADDR16(bitmap, y, x) = machine->pens[S2636_PIXEL_COLOR(pixel)]; + *BITMAP_ADDR16(bitmap, y, x) = S2636_PIXEL_COLOR(pixel); /* S2636 vs. background collision detection */ if (colortable_entry_get_value(machine->colortable, *BITMAP_ADDR16(cvs_collision_background, y, x))) diff --git a/src/mame/video/rallyx.c b/src/mame/video/rallyx.c index 4d3b2565dab..6cca2487a10 100644 --- a/src/mame/video/rallyx.c +++ b/src/mame/video/rallyx.c @@ -497,7 +497,7 @@ static void plot_star(running_machine *machine, mame_bitmap *bitmap, const recta y = 255 - y; if (colortable_entry_get_value(machine->colortable, *BITMAP_ADDR16(bitmap, y, x) % 0x144) == 0) - *BITMAP_ADDR16(bitmap, y, x) = machine->pens[STARS_COLOR_BASE + color]; + *BITMAP_ADDR16(bitmap, y, x) = STARS_COLOR_BASE + color; } static void draw_stars(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect ) diff --git a/src/mame/video/realbrk.c b/src/mame/video/realbrk.c index 71e4d83ce34..3ef4a6245d3 100644 --- a/src/mame/video/realbrk.c +++ b/src/mame/video/realbrk.c @@ -313,8 +313,8 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rec // buffer the tile and rotate it into bitmap if( rot ) { - fillbitmap( tmpbitmap0, machine->pens[0], &spritetile_clip ); - fillbitmap( tmpbitmap1, machine->pens[0], &spritetile_clip ); + fillbitmap( tmpbitmap0, 0, &spritetile_clip ); + fillbitmap( tmpbitmap1, 0, &spritetile_clip ); drawgfxzoom( tmpbitmap0,machine->gfx[gfx], code++, color, @@ -536,7 +536,7 @@ if ( input_code_pressed(KEYCODE_Z) ) return 0; } else - fillbitmap(bitmap,machine->pens[realbrk_vregs[0xc/2] & 0x7fff],cliprect); + fillbitmap(bitmap,realbrk_vregs[0xc/2] & 0x7fff,cliprect); if (layers_ctrl & 2) tilemap_draw(bitmap,cliprect,tilemap_1,0,0); if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect,tilemap_0,0,0); @@ -604,7 +604,7 @@ if ( input_code_pressed(KEYCODE_Z) ) return 0; } else - fillbitmap(bitmap,machine->pens[realbrk_vregs[0xc/2] & 0x7fff],cliprect); + fillbitmap(bitmap,realbrk_vregs[0xc/2] & 0x7fff,cliprect); diff --git a/src/mame/video/rollerg.c b/src/mame/video/rollerg.c index 7832f4f5d3d..650bc70f832 100644 --- a/src/mame/video/rollerg.c +++ b/src/mame/video/rollerg.c @@ -69,7 +69,7 @@ VIDEO_START( rollerg ) VIDEO_UPDATE( rollerg ) { fillbitmap(priority_bitmap,0,cliprect); - fillbitmap(bitmap,machine->pens[16 * bg_colorbase],cliprect); + fillbitmap(bitmap,16 * bg_colorbase,cliprect); K051316_zoom_draw_0(bitmap,cliprect,0,1); K053245_sprites_draw(0,bitmap,cliprect); return 0; diff --git a/src/mame/video/rollrace.c b/src/mame/video/rollrace.c index 978c5756a25..2bd3a9d4328 100644 --- a/src/mame/video/rollrace.c +++ b/src/mame/video/rollrace.c @@ -66,7 +66,7 @@ VIDEO_UPDATE( rollrace ) int col; /* fill in background colour*/ - fillbitmap(bitmap,machine->pens[ra_bkgpen],&machine->screen[0].visarea); + fillbitmap(bitmap,ra_bkgpen,&machine->screen[0].visarea); /* draw road */ for (offs = videoram_size - 1;offs >= 0;offs--) diff --git a/src/mame/video/segas24.c b/src/mame/video/segas24.c index 5d815945f4b..706ee4a35a8 100644 --- a/src/mame/video/segas24.c +++ b/src/mame/video/segas24.c @@ -34,7 +34,7 @@ VIDEO_UPDATE(system24) sys24_tile_update(machine); fillbitmap(priority_bitmap, 0, 0); - fillbitmap(bitmap, machine->pens[0], &machine->screen[0].visarea); + fillbitmap(bitmap, 0, &machine->screen[0].visarea); for(i=0; i<12; i++) order[i] = i; diff --git a/src/mame/video/senjyo.c b/src/mame/video/senjyo.c index 63548073c3a..b39dfe24ac1 100644 --- a/src/mame/video/senjyo.c +++ b/src/mame/video/senjyo.c @@ -191,9 +191,7 @@ static void draw_bgbitmap(running_machine *machine, mame_bitmap *bitmap,const re if (senjyo_bgstripes == 0xff) /* off */ - { - fillbitmap(bitmap,machine->pens[0],cliprect); - } + fillbitmap(bitmap,0,cliprect); else { pen = 0; @@ -205,15 +203,11 @@ static void draw_bgbitmap(running_machine *machine, mame_bitmap *bitmap,const re for (x = 0;x < 256;x++) { if (flip_screen) - { for (y = 0;y < 256;y++) - *BITMAP_ADDR16(bitmap, y, 255 - x) = machine->pens[384 + pen]; - } + *BITMAP_ADDR16(bitmap, y, 255 - x) = 384 + pen; else - { for (y = 0;y < 256;y++) - *BITMAP_ADDR16(bitmap, y, x) = machine->pens[384 + pen]; - } + *BITMAP_ADDR16(bitmap, y, x) = 384 + pen; count += 0x10; if (count >= strwid) @@ -225,36 +219,29 @@ static void draw_bgbitmap(running_machine *machine, mame_bitmap *bitmap,const re } } -static void draw_radar(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect) +static void draw_radar(mame_bitmap *bitmap,const rectangle *cliprect) { int offs,x; for (offs = 0;offs < 0x400;offs++) - { - if (senjyo_radarram[offs]) - { - for (x = 0;x < 8;x++) + for (x = 0;x < 8;x++) + if (senjyo_radarram[offs] & (1 << x)) { - if (senjyo_radarram[offs] & (1 << x)) + int sx, sy; + + sx = (8 * (offs % 8) + x) + 256-64; + sy = ((offs & 0x1ff) / 8) + 96; + + if (flip_screen) { - int sx, sy; - - sx = (8 * (offs % 8) + x) + 256-64; - sy = ((offs & 0x1ff) / 8) + 96; - - if (flip_screen) - { - sx = 255 - sx; - sy = 255 - sy; - } - - if (sy >= cliprect->min_y && sy <= cliprect->max_y && - sx >= cliprect->min_x && sx <= cliprect->max_x) - *BITMAP_ADDR16(bitmap, sy, sx) = machine->pens[offs < 0x200 ? 512 : 513]; + sx = 255 - sx; + sy = 255 - sy; } + + if (sy >= cliprect->min_y && sy <= cliprect->max_y && + sx >= cliprect->min_x && sx <= cliprect->max_x) + *BITMAP_ADDR16(bitmap, sy, sx) = offs < 0x200 ? 512 : 513; } - } - } } static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int priority) @@ -359,7 +346,7 @@ VIDEO_UPDATE( senjyo ) tilemap_draw(bitmap,cliprect,bg1_tilemap,0,0); draw_sprites(machine, bitmap,cliprect,3); tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); - draw_radar(machine, bitmap,cliprect); + draw_radar(bitmap,cliprect); #if 0 { diff --git a/src/mame/video/seta2.c b/src/mame/video/seta2.c index 89c76900d54..cae4ca4cf4f 100644 --- a/src/mame/video/seta2.c +++ b/src/mame/video/seta2.c @@ -374,8 +374,8 @@ VIDEO_START( seta2_offset ) VIDEO_UPDATE( seta2 ) { - /* Black or pens[0]? */ - fillbitmap(bitmap,machine->pens[0],cliprect); + /* Black or pen 0? */ + fillbitmap(bitmap,0,cliprect); if (seta2_vregs[0x30/2] & 1) return 0; // BLANK SCREEN diff --git a/src/mame/video/sf.c b/src/mame/video/sf.c index f6edef6fb5a..8357e40e261 100644 --- a/src/mame/video/sf.c +++ b/src/mame/video/sf.c @@ -228,7 +228,7 @@ VIDEO_UPDATE( sf ) if (sf_active & 0x20) tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); else - fillbitmap(bitmap,machine->pens[0],cliprect); + fillbitmap(bitmap,0,cliprect); tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); diff --git a/src/mame/video/shangha3.c b/src/mame/video/shangha3.c index 26159e1d939..27981d39ff0 100644 --- a/src/mame/video/shangha3.c +++ b/src/mame/video/shangha3.c @@ -82,12 +82,11 @@ VIDEO_START( shangha3 ) int i; /* Prepare the shadow table */ - /* We draw in a raw bitmap so we don't have to remap pens through machine->pens */ for (i = 0;i < 14;i++) gfx_drawmode_table[i] = DRAWMODE_SOURCE; gfx_drawmode_table[14] = DRAWMODE_SHADOW; for (i = 0;i < 128;i++) - machine->shadow_table[machine->pens[i]] = machine->pens[i+128]; + machine->shadow_table[i] = i+128; } } diff --git a/src/mame/video/simpl156.c b/src/mame/video/simpl156.c index 5567e5748e3..ad39d3f539f 100644 --- a/src/mame/video/simpl156.c +++ b/src/mame/video/simpl156.c @@ -117,7 +117,7 @@ VIDEO_UPDATE( simpl156 ) deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll); - fillbitmap(bitmap,machine->pens[256],cliprect); + fillbitmap(bitmap,256,cliprect); deco16_tilemap_2_draw(bitmap,cliprect,0,2); deco16_tilemap_1_draw(bitmap,cliprect,0,4); diff --git a/src/mame/video/simpsons.c b/src/mame/video/simpsons.c index 1ff4195fedf..3747d104fcf 100644 --- a/src/mame/video/simpsons.c +++ b/src/mame/video/simpsons.c @@ -162,7 +162,7 @@ VIDEO_UPDATE( simpsons ) sortlayers(layer,layerpri); fillbitmap(priority_bitmap,0,cliprect); - fillbitmap(bitmap,machine->pens[16 * bg_colorbase],cliprect); + fillbitmap(bitmap,16 * bg_colorbase,cliprect); tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[0]],0,1); tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[1]],0,2); tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[2]],0,4); diff --git a/src/mame/video/skyfox.c b/src/mame/video/skyfox.c index eda5ef103dd..4efa1f94df5 100644 --- a/src/mame/video/skyfox.c +++ b/src/mame/video/skyfox.c @@ -243,7 +243,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re ***************************************************************************/ -static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) +static void draw_background(mame_bitmap *bitmap, const rectangle *cliprect) { UINT8 *RAM = memory_region(REGION_GFX2); int x,y,i; @@ -271,7 +271,7 @@ static void draw_background(running_machine *machine, mame_bitmap *bitmap, const for (j = 0 ; j <= ((pen&0x80)?0:3); j++) *BITMAP_ADDR16(bitmap, ( ((j/2)&1) + y ) % 256, - ( (j&1) + x ) % 512) = machine->pens[256+(pen&0x7f)]; + ( (j&1) + x ) % 512) = 256+(pen&0x7f); } } @@ -287,8 +287,8 @@ static void draw_background(running_machine *machine, mame_bitmap *bitmap, const VIDEO_UPDATE( skyfox ) { - fillbitmap(bitmap,machine->pens[255],cliprect); // the bg is black - draw_background(machine, bitmap, cliprect); + fillbitmap(bitmap,255,cliprect); // the bg is black + draw_background(bitmap, cliprect); draw_sprites(machine, bitmap, cliprect); return 0; } diff --git a/src/mame/video/skyraid.c b/src/mame/video/skyraid.c index 22cda7c4570..c039c6439b3 100644 --- a/src/mame/video/skyraid.c +++ b/src/mame/video/skyraid.c @@ -35,15 +35,12 @@ static void draw_text(running_machine *machine, mame_bitmap* bitmap, const recta y = 136 + 16 * (i ^ 1); for (x = 0; x < bitmap->width; x += 16) - { - drawgfx(bitmap, machine->gfx[0], *p++, 0, 0, 0, - x, y, cliprect, TRANSPARENCY_PEN, 0); - } + drawgfx(bitmap, machine->gfx[0], *p++, 0, 0, 0, x, y, cliprect, TRANSPARENCY_PEN, 0); } } -static void draw_terrain(running_machine *machine, mame_bitmap* bitmap, const rectangle *cliprect) +static void draw_terrain(mame_bitmap* bitmap, const rectangle *cliprect) { const UINT8* p = memory_region(REGION_USER1); @@ -70,7 +67,7 @@ static void draw_terrain(running_machine *machine, mame_bitmap* bitmap, const re r.max_y = y + 1; r.max_x = x + 31 - count; - fillbitmap(bitmap, machine->pens[color], &r); + fillbitmap(bitmap, color, &r); x += 32 - count; } @@ -92,11 +89,9 @@ static void draw_sprites(running_machine *machine, mame_bitmap* bitmap, const re vert -= 31; if (flag & 1) - { drawgfx(bitmap, machine->gfx[1], code ^ 15, code >> 3, 0, 0, horz / 2, vert, cliprect, TRANSPARENCY_PEN, 2); - } } } @@ -139,18 +134,16 @@ static void draw_trapezoid(mame_bitmap* dst, mame_bitmap* src) int x2 = 0x100 + p[(y & ~1) + 1]; for (x = x1; x < x2; x++) - { pDst[x] = pSrc[128 * (x - x1) / (x2 - x1)]; - } } } VIDEO_UPDATE( skyraid ) { - fillbitmap(bitmap, machine->pens[0], cliprect); + fillbitmap(bitmap, 0, cliprect); - draw_terrain(machine, helper, cliprect); + draw_terrain(helper, cliprect); draw_sprites(machine, helper, cliprect); draw_missiles(machine, helper, cliprect); draw_trapezoid(bitmap, helper); diff --git a/src/mame/video/slapshot.c b/src/mame/video/slapshot.c index 18aaf975c2e..2f918f01142 100644 --- a/src/mame/video/slapshot.c +++ b/src/mame/video/slapshot.c @@ -581,7 +581,7 @@ VIDEO_UPDATE( slapshot ) spritepri[3] = TC0360PRI_regs[7] >> 4; fillbitmap(priority_bitmap,0,cliprect); - fillbitmap(bitmap,machine->pens[0],cliprect); + fillbitmap(bitmap,0,cliprect); #ifdef MAME_DEBUG if (dislayer[layer[0]]==0) diff --git a/src/mame/video/snk68.c b/src/mame/video/snk68.c index 5f587c51a35..c3e1a97db69 100644 --- a/src/mame/video/snk68.c +++ b/src/mame/video/snk68.c @@ -202,7 +202,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re VIDEO_UPDATE( pow ) { - fillbitmap(bitmap,machine->pens[2047],cliprect); + fillbitmap(bitmap,2047,cliprect); /* This appears to be correct priority */ draw_sprites(machine, bitmap,cliprect,1,0x000); @@ -284,7 +284,7 @@ static void draw_sprites2(running_machine *machine, mame_bitmap *bitmap, const r VIDEO_UPDATE( searchar ) { - fillbitmap(bitmap,machine->pens[2047],cliprect); + fillbitmap(bitmap,2047,cliprect); /* This appears to be correct priority */ draw_sprites2(machine, bitmap,cliprect,8,0x2000,0x000); diff --git a/src/mame/video/spcforce.c b/src/mame/video/spcforce.c index 3cfbbf6ecb5..d9939d50e65 100644 --- a/src/mame/video/spcforce.c +++ b/src/mame/video/spcforce.c @@ -25,7 +25,7 @@ VIDEO_UPDATE( spcforce ) /* draw the characters as sprites because they could be overlapping */ - fillbitmap(bitmap,machine->pens[0],&machine->screen[0].visarea); + fillbitmap(bitmap,0,&machine->screen[0].visarea); for (offs = 0; offs < videoram_size; offs++) diff --git a/src/mame/video/splash.c b/src/mame/video/splash.c index f99c36c1a84..6106577b7ee 100644 --- a/src/mame/video/splash.c +++ b/src/mame/video/splash.c @@ -89,7 +89,7 @@ WRITE16_HANDLER( splash_vram_w ) tilemap_mark_tile_dirty(bg_tilemap[offset >> 11],((offset << 1) & 0x0fff) >> 1); } -static void draw_bitmap(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect) +static void draw_bitmap(mame_bitmap *bitmap,const rectangle *cliprect) { int sx,sy,color,count,colxor,bitswap; colxor = 0; /* splash and some bitmap modes in roldfrog */ @@ -165,7 +165,7 @@ static void draw_bitmap(running_machine *machine, mame_bitmap *bitmap,const rect } if (sy >= cliprect->min_y && sy <= cliprect->max_y && sx-9 >= cliprect->min_x && sx-9 <= cliprect->max_x) - *BITMAP_ADDR16(bitmap, sy, sx-9) = machine->pens[0x300+(color^colxor)]; + *BITMAP_ADDR16(bitmap, sy, sx-9) = 0x300+(color^colxor); } } @@ -268,7 +268,7 @@ VIDEO_UPDATE( splash ) tilemap_set_scrolly(bg_tilemap[0], 0, splash_vregs[0]); tilemap_set_scrolly(bg_tilemap[1], 0, splash_vregs[1]); - draw_bitmap(machine, bitmap,cliprect); + draw_bitmap(bitmap,cliprect); tilemap_draw(bitmap,cliprect,bg_tilemap[1],0,0); splash_draw_sprites(machine, bitmap,cliprect); @@ -282,7 +282,7 @@ VIDEO_UPDATE( funystrp ) tilemap_set_scrolly(bg_tilemap[0], 0, splash_vregs[0]); tilemap_set_scrolly(bg_tilemap[1], 0, splash_vregs[1]); - draw_bitmap(machine, bitmap,cliprect); + draw_bitmap(bitmap,cliprect); tilemap_draw(bitmap,cliprect,bg_tilemap[1],0,0); /*Sprite chip is similar but not the same*/ diff --git a/src/mame/video/sprint8.c b/src/mame/video/sprint8.c index 821bf297e2a..dab7af9513e 100644 --- a/src/mame/video/sprint8.c +++ b/src/mame/video/sprint8.c @@ -182,7 +182,7 @@ VIDEO_EOF( sprint8 ) tilemap_draw(helper2, &machine->screen[0].visarea, tilemap2, 0, 0); - fillbitmap(helper1, machine->pens[0x20], &machine->screen[0].visarea); + fillbitmap(helper1, 0x20, &machine->screen[0].visarea); draw_sprites(machine, helper1, &machine->screen[0].visarea); diff --git a/src/mame/video/spy.c b/src/mame/video/spy.c index 58a7b84164a..d84fa2bc7ad 100644 --- a/src/mame/video/spy.c +++ b/src/mame/video/spy.c @@ -71,14 +71,14 @@ VIDEO_UPDATE( spy ) fillbitmap(priority_bitmap, 0, cliprect); if (!spy_video_enable) + fillbitmap(bitmap,16 * layer_colorbase[0],cliprect); + else { - fillbitmap(bitmap,machine->pens[16 * layer_colorbase[0]],cliprect); - return 0; + tilemap_draw(bitmap,cliprect,K052109_tilemap[1],TILEMAP_DRAW_OPAQUE,1); + tilemap_draw(bitmap,cliprect,K052109_tilemap[2],0,2); + K051960_sprites_draw(bitmap,cliprect,-1,-1); + tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,0); } - tilemap_draw(bitmap,cliprect,K052109_tilemap[1],TILEMAP_DRAW_OPAQUE,1); - tilemap_draw(bitmap,cliprect,K052109_tilemap[2],0,2); - K051960_sprites_draw(bitmap,cliprect,-1,-1); - tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,0); return 0; } diff --git a/src/mame/video/srmp2.c b/src/mame/video/srmp2.c index 134e72d2984..87e52abb967 100644 --- a/src/mame/video/srmp2.c +++ b/src/mame/video/srmp2.c @@ -434,7 +434,7 @@ static void mjyuugi_draw_sprites(running_machine *machine, mame_bitmap *bitmap, VIDEO_UPDATE( srmp2 ) { - fillbitmap(bitmap, machine->pens[0x1f0], cliprect); + fillbitmap(bitmap, 0x1f0, cliprect); srmp2_draw_sprites(machine, bitmap, cliprect); return 0; } @@ -442,7 +442,7 @@ VIDEO_UPDATE( srmp2 ) VIDEO_UPDATE( srmp3 ) { - fillbitmap(bitmap, machine->pens[0x1f0], cliprect); + fillbitmap(bitmap, 0x1f0, cliprect); srmp3_draw_sprites(machine, bitmap, cliprect); return 0; } @@ -450,7 +450,7 @@ VIDEO_UPDATE( srmp3 ) VIDEO_UPDATE( mjyuugi ) { - fillbitmap(bitmap, machine->pens[0x1f0], cliprect); + fillbitmap(bitmap, 0x1f0, cliprect); mjyuugi_draw_sprites(machine, bitmap, cliprect); return 0; } diff --git a/src/mame/video/sshangha.c b/src/mame/video/sshangha.c index c53fbf4acee..b73e4df9584 100644 --- a/src/mame/video/sshangha.c +++ b/src/mame/video/sshangha.c @@ -30,7 +30,7 @@ WRITE16_HANDLER( sshangha_palette_24bit_w ) palette_set_color(Machine,offset/2,MAKE_RGB(r,g,b)); } -static void sshangha_tilemap_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) +static void sshangha_tilemap_draw(mame_bitmap *bitmap, const rectangle *cliprect) { const mame_bitmap *bitmap0 = tilemap_get_pixmap(pf1_16x16_tilemap); const mame_bitmap *bitmap1 = tilemap_get_pixmap(pf2_tilemap); @@ -41,7 +41,7 @@ static void sshangha_tilemap_draw(running_machine *machine, mame_bitmap *bitmap, p=*BITMAP_ADDR16(bitmap0, y, x)&0xf; p|=(*BITMAP_ADDR16(bitmap1, y, x)&0xf)<<4; - *BITMAP_ADDR16(bitmap, y, x) = machine->pens[p|0x300]; + *BITMAP_ADDR16(bitmap, y, x) = p|0x300; } } } @@ -240,7 +240,7 @@ VIDEO_UPDATE( sshangha ) produce a 6bpp tilemap. We can't precompute this as any tiles can be used in any tilemap, so we plot it on the fly */ if ((sshangha_video_control&4)==0) { - sshangha_tilemap_draw(machine, bitmap, cliprect); + sshangha_tilemap_draw(bitmap, cliprect); draw_sprites(machine, bitmap, cliprect, spriteram16,0x4000,0x4000); } else { diff --git a/src/mame/video/ssv.c b/src/mame/video/ssv.c index 1525efbf99f..64a11f066f5 100644 --- a/src/mame/video/ssv.c +++ b/src/mame/video/ssv.c @@ -1159,7 +1159,7 @@ VIDEO_UPDATE( ssv ) } /* The background color is the first one in the palette */ - fillbitmap(bitmap,machine->pens[0], cliprect); + fillbitmap(bitmap,0, cliprect); if (!enable_video) return 0; diff --git a/src/mame/video/st0016.c b/src/mame/video/st0016.c index f86eb4bd1dd..e8fd023a29d 100644 --- a/src/mame/video/st0016.c +++ b/src/mame/video/st0016.c @@ -635,7 +635,7 @@ VIDEO_UPDATE( st0016 ) //super eagle shot int x,y,dy; - fillbitmap(speglsht_bitmap,machine->pens[0],&machine->screen[0].visarea); + fillbitmap(speglsht_bitmap,0,&machine->screen[0].visarea); dy=(speglsht_videoreg&0x20)?(256*512):0; //visible frame for(y=0;y<256;y++) @@ -676,7 +676,7 @@ VIDEO_UPDATE( st0016 ) } } - fillbitmap(bitmap,machine->pens[UNUSED_PEN],&machine->screen[0].visarea); + fillbitmap(bitmap,UNUSED_PEN,&machine->screen[0].visarea); draw_bgmap(machine, bitmap,cliprect,0); draw_sprites(machine, bitmap,cliprect); draw_bgmap(machine, bitmap,cliprect,1); diff --git a/src/mame/video/starcrus.c b/src/mame/video/starcrus.c index 26b5e9ea989..93b56f050a6 100644 --- a/src/mame/video/starcrus.c +++ b/src/mame/video/starcrus.c @@ -197,8 +197,8 @@ static int collision_check_s1s2(running_machine *machine) clip.min_y=0; clip.max_y=15; - fillbitmap(ship1_vid,machine->pens[0],&clip); - fillbitmap(ship2_vid,machine->pens[0],&clip); + fillbitmap(ship1_vid,0,&clip); + fillbitmap(ship2_vid,0,&clip); /* origin is with respect to ship1 */ @@ -229,17 +229,10 @@ static int collision_check_s1s2(running_machine *machine) /* Now check for collisions */ for (sy=0;sy<16;sy++) - { for (sx=0;sx<16;sx++) - { - if (*BITMAP_ADDR16(ship1_vid, sy, sx)==machine->pens[1]) - { - /* Condition 1 - ship 1 = ship 2 */ - if (*BITMAP_ADDR16(ship2_vid, sy, sx)==machine->pens[1]) - return 1; - } - } - } + /* Condition 1 - ship 1 = ship 2 */ + if ((*BITMAP_ADDR16(ship1_vid, sy, sx)==1) && (*BITMAP_ADDR16(ship2_vid, sy, sx)==1)) + return 1; return 0; } @@ -262,8 +255,8 @@ static int collision_check_p1p2(running_machine *machine) clip.min_y=0; clip.max_y=15; - fillbitmap(proj1_vid,machine->pens[0],&clip); - fillbitmap(proj2_vid,machine->pens[0],&clip); + fillbitmap(proj1_vid,0,&clip); + fillbitmap(proj2_vid,0,&clip); /* origin is with respect to proj1 */ @@ -300,17 +293,10 @@ static int collision_check_p1p2(running_machine *machine) /* Now check for collisions */ for (sy=0;sy<16;sy++) - { for (sx=0;sx<16;sx++) - { - if (*BITMAP_ADDR16(proj1_vid, sy, sx)==machine->pens[1]) - { - /* Condition 1 - proj 1 = proj 2 */ - if (*BITMAP_ADDR16(proj2_vid, sy, sx)==machine->pens[1]) - return 1; - } - } - } + /* Condition 1 - proj 1 = proj 2 */ + if ((*BITMAP_ADDR16(proj1_vid, sy, sx)==1) && (*BITMAP_ADDR16(proj2_vid, sy, sx)==1)) + return 1; return 0; } @@ -333,9 +319,9 @@ static int collision_check_s1p1p2(running_machine *machine) clip.min_y=0; clip.max_y=15; - fillbitmap(ship1_vid,machine->pens[0],&clip); - fillbitmap(proj1_vid,machine->pens[0],&clip); - fillbitmap(proj2_vid,machine->pens[0],&clip); + fillbitmap(ship1_vid,0,&clip); + fillbitmap(proj1_vid,0,&clip); + fillbitmap(proj2_vid,0,&clip); /* origin is with respect to ship1 */ @@ -383,20 +369,16 @@ static int collision_check_s1p1p2(running_machine *machine) /* Now check for collisions */ for (sy=0;sy<16;sy++) - { for (sx=0;sx<16;sx++) - { - if (*BITMAP_ADDR16(ship1_vid, sy, sx)==machine->pens[1]) + if (*BITMAP_ADDR16(ship1_vid, sy, sx)==1) { /* Condition 1 - ship 1 = proj 1 */ - if (*BITMAP_ADDR16(proj1_vid, sy, sx)==machine->pens[1]) + if (*BITMAP_ADDR16(proj1_vid, sy, sx)==1) return 1; /* Condition 2 - ship 1 = proj 2 */ - if (*BITMAP_ADDR16(proj2_vid, sy, sx)==machine->pens[1]) + if (*BITMAP_ADDR16(proj2_vid, sy, sx)==1) return 1; } - } - } return 0; } @@ -419,9 +401,9 @@ static int collision_check_s2p1p2(running_machine *machine) clip.min_y=0; clip.max_y=15; - fillbitmap(ship2_vid,machine->pens[0],&clip); - fillbitmap(proj1_vid,machine->pens[0],&clip); - fillbitmap(proj2_vid,machine->pens[0],&clip); + fillbitmap(ship2_vid,0,&clip); + fillbitmap(proj1_vid,0,&clip); + fillbitmap(proj2_vid,0,&clip); /* origin is with respect to ship2 */ @@ -469,27 +451,23 @@ static int collision_check_s2p1p2(running_machine *machine) /* Now check for collisions */ for (sy=0;sy<16;sy++) - { for (sx=0;sx<16;sx++) - { - if (*BITMAP_ADDR16(ship2_vid, sy, sx)==machine->pens[1]) + if (*BITMAP_ADDR16(ship2_vid, sy, sx)==1) { /* Condition 1 - ship 2 = proj 1 */ - if (*BITMAP_ADDR16(proj1_vid, sy, sx)==machine->pens[1]) + if (*BITMAP_ADDR16(proj1_vid, sy, sx)==1) return 1; /* Condition 2 - ship 2 = proj 2 */ - if (*BITMAP_ADDR16(proj2_vid, sy, sx)==machine->pens[1]) + if (*BITMAP_ADDR16(proj2_vid, sy, sx)==1) return 1; } - } - } return 0; } VIDEO_UPDATE( starcrus ) { - fillbitmap(bitmap,machine->pens[0],cliprect); + fillbitmap(bitmap,0,cliprect); /* Draw ship 1 */ drawgfx(bitmap, diff --git a/src/mame/video/starshp1.c b/src/mame/video/starshp1.c index 3cc16ad43d1..32ffebebd38 100644 --- a/src/mame/video/starshp1.c +++ b/src/mame/video/starshp1.c @@ -379,7 +379,7 @@ VIDEO_UPDATE( starshp1 ) { set_pens(machine->colortable); - fillbitmap(bitmap, machine->pens[0], cliprect); + fillbitmap(bitmap, 0, cliprect); if (starshp1_starfield_kill == 0) draw_starfield(bitmap); @@ -422,7 +422,7 @@ VIDEO_EOF( starshp1 ) if (rect.max_y > helper->height - 1) rect.max_y = helper->height - 1; - fillbitmap(helper, machine->pens[0], &machine->screen[0].visarea); + fillbitmap(helper, 0, &machine->screen[0].visarea); if (starshp1_attract == 0) draw_spaceship(machine, helper, &machine->screen[0].visarea); diff --git a/src/mame/video/stfight.c b/src/mame/video/stfight.c index 44ec2871211..150537b0fb7 100644 --- a/src/mame/video/stfight.c +++ b/src/mame/video/stfight.c @@ -298,7 +298,7 @@ VIDEO_UPDATE( stfight ) fillbitmap(priority_bitmap,0,cliprect); - fillbitmap(bitmap,machine->pens[0],cliprect); /* in case bg_tilemap is disabled */ + fillbitmap(bitmap,0,cliprect); /* in case bg_tilemap is disabled */ tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); tilemap_draw(bitmap,cliprect,fg_tilemap,0,1); diff --git a/src/mame/video/suna16.c b/src/mame/video/suna16.c index 5d8fa9661b7..1d3ae79fea5 100644 --- a/src/mame/video/suna16.c +++ b/src/mame/video/suna16.c @@ -220,7 +220,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re VIDEO_UPDATE( suna16 ) { /* Suna Quiz indicates the background is the last pen */ - fillbitmap(bitmap,machine->pens[0xff],cliprect); + fillbitmap(bitmap,0xff,cliprect); draw_sprites(machine, bitmap, cliprect, spriteram16, 0); return 0; } @@ -239,7 +239,7 @@ if (input_code_pressed(KEYCODE_Z)) #endif /* Suna Quiz indicates the background is the last pen */ - fillbitmap(bitmap,machine->pens[0xff],cliprect); + fillbitmap(bitmap,0xff,cliprect); if (layers_ctrl & 1) draw_sprites(machine, bitmap, cliprect, spriteram16, 0); if (layers_ctrl & 2) draw_sprites(machine, bitmap, cliprect, spriteram16_2, 1); return 0; diff --git a/src/mame/video/suna8.c b/src/mame/video/suna8.c index b3d17eda82e..25ad9952ed4 100644 --- a/src/mame/video/suna8.c +++ b/src/mame/video/suna8.c @@ -410,7 +410,7 @@ static void draw_text_sprites(running_machine *machine, mame_bitmap *bitmap,cons VIDEO_UPDATE( suna8 ) { /* see hardhead, hardhea2 test mode (press button 2 for both players) */ - fillbitmap(bitmap,machine->pens[0xff],cliprect); + fillbitmap(bitmap,0xff,cliprect); #ifdef MAME_DEBUG #if TILEMAPS diff --git a/src/mame/video/supbtime.c b/src/mame/video/supbtime.c index 891206ef7db..d0dbc130fa2 100644 --- a/src/mame/video/supbtime.c +++ b/src/mame/video/supbtime.c @@ -94,7 +94,7 @@ VIDEO_UPDATE(supbtime) flip_screen_set( deco16_pf12_control[0]&0x80 ); deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll); - fillbitmap(bitmap,machine->pens[768],cliprect); + fillbitmap(bitmap,768,cliprect); deco16_tilemap_2_draw(bitmap,cliprect,0,0); draw_sprites(machine, bitmap,cliprect); diff --git a/src/mame/video/suprloco.c b/src/mame/video/suprloco.c index 97e1fc96acb..db63b35bc2b 100644 --- a/src/mame/video/suprloco.c +++ b/src/mame/video/suprloco.c @@ -176,11 +176,11 @@ INLINE void draw_pixel(mame_bitmap *bitmap,const rectangle *cliprect,int x,int y } -static void draw_sprite(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int spr_number) +static void draw_sprite(mame_bitmap *bitmap,const rectangle *cliprect,int spr_number) { int sx,sy,col,row,height,src,adjy,dy; UINT8 *spr_reg; - const pen_t *spr_palette; + pen_t pen_base; short skip; /* bytes to skip before drawing each row (can be negative) */ @@ -190,7 +190,7 @@ static void draw_sprite(running_machine *machine, mame_bitmap *bitmap,const rect skip = spr_reg[SPR_SKIP_LO] + (spr_reg[SPR_SKIP_HI] << 8); height = spr_reg[SPR_Y_BOTTOM] - spr_reg[SPR_Y_TOP]; - spr_palette = machine->pens + 0x100 + 0x10 * (spr_reg[SPR_COL]&0x03) + ((control & 0x20)?0x100:0); + pen_base = 0x100 + 0x10 * (spr_reg[SPR_COL]&0x03) + ((control & 0x20)?0x100:0); sx = spr_reg[SPR_X]; sy = spr_reg[SPR_Y_TOP] + 1; @@ -236,18 +236,18 @@ static void draw_sprite(running_machine *machine, mame_bitmap *bitmap,const rect if (color1 == 15) break; if (color1) - draw_pixel(bitmap,cliprect,sx+col, adjy,spr_palette[color1]); + draw_pixel(bitmap,cliprect,sx+col, adjy,pen_base + color1); if (color2 == 15) break; if (color2) - draw_pixel(bitmap,cliprect,sx+col+1,adjy,spr_palette[color2]); + draw_pixel(bitmap,cliprect,sx+col+1,adjy,pen_base + color2); col += 2; } } } -static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) +static void draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect) { int spr_number; UINT8 *spr_reg; @@ -257,14 +257,14 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re { spr_reg = spriteram + 0x10 * spr_number; if (spr_reg[SPR_X] != 0xff) - draw_sprite(machine, bitmap, cliprect, spr_number); + draw_sprite(bitmap, cliprect, spr_number); } } VIDEO_UPDATE( suprloco ) { tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); - draw_sprites(machine, bitmap,cliprect); + draw_sprites(bitmap,cliprect); tilemap_draw(bitmap,cliprect,bg_tilemap,1,0); return 0; } diff --git a/src/mame/video/surpratk.c b/src/mame/video/surpratk.c index d625f659dc5..89c713dc72b 100644 --- a/src/mame/video/surpratk.c +++ b/src/mame/video/surpratk.c @@ -89,7 +89,7 @@ VIDEO_UPDATE( surpratk ) sortlayers(layer,layerpri); fillbitmap(priority_bitmap,0,cliprect); - fillbitmap(bitmap,machine->pens[16 * bg_colorbase],cliprect); + fillbitmap(bitmap,16 * bg_colorbase,cliprect); tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[0]],0,1); tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[1]],0,2); tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[2]],0,4); diff --git a/src/mame/video/system1.c b/src/mame/video/system1.c index 6318dc8aa7b..4ee35af03ae 100644 --- a/src/mame/video/system1.c +++ b/src/mame/video/system1.c @@ -535,7 +535,7 @@ VIDEO_UPDATE( system1 ) /* even if screen is off, sprites must still be drawn to update the collision table */ if (system1_video_mode & 0x10) /* screen off */ - fillbitmap(bitmap,machine->pens[0],cliprect); + fillbitmap(bitmap,0,cliprect); return 0; } @@ -676,7 +676,7 @@ VIDEO_UPDATE( choplifter ) /* even if screen is off, sprites must still be drawn to update the collision table */ if (system1_video_mode & 0x10) /* screen off */ - fillbitmap(bitmap,machine->pens[0],cliprect); + fillbitmap(bitmap,0,cliprect); #ifdef MAME_DEBUG @@ -807,7 +807,7 @@ VIDEO_UPDATE( wbml ) /* even if screen is off, sprites must still be drawn to update the collision table */ if (system1_video_mode & 0x10) /* screen off */ - fillbitmap(bitmap,machine->pens[0],cliprect); + fillbitmap(bitmap,0,cliprect); return 0; } @@ -877,7 +877,7 @@ VIDEO_UPDATE( ufosensi ) /* even if screen is off, sprites must still be drawn to update the collision table */ if (system1_video_mode & 0x10) /* screen off */ - fillbitmap(bitmap,machine->pens[0],cliprect); + fillbitmap(bitmap,0,cliprect); return 0; } @@ -898,7 +898,7 @@ VIDEO_UPDATE( blockgal ) /* even if screen is off, sprites must still be drawn to update the collision table */ if (system1_video_mode & 0x10) /* screen off */ - fillbitmap(bitmap,machine->pens[0],cliprect); + fillbitmap(bitmap,0,cliprect); blockgal_kludgeoffset = 0; return 0; diff --git a/src/mame/video/system16.c b/src/mame/video/system16.c index 06dfd53a404..29780c0b540 100644 --- a/src/mame/video/system16.c +++ b/src/mame/video/system16.c @@ -201,7 +201,7 @@ static void draw_sprite(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, const UINT8 *addr, int pitch, - const pen_t *paldata, + pen_t pen_base, int x0, int y0, int screen_width, int screen_height, int width, int height, int flipx, int flipy, @@ -209,7 +209,7 @@ static void draw_sprite(running_machine *machine, int shadow, int shadow_pen, int eos ) { - const pen_t *shadow_base = machine->pens + machine->gfx[0]->color_base + (machine->config->total_colors/2); + pen_t shadow_pen_base = machine->gfx[0]->color_base + (machine->config->total_colors/2); const UINT8 *source; int full_shadow=shadow&SYS16_SPR_SHADOW; int partial_shadow=shadow&SYS16_SPR_PARTIAL_SHADOW; @@ -260,11 +260,11 @@ static void draw_sprite(running_machine *machine, if( pen && pen!=0xf && sx>=cliprect->min_x && sx<=cliprect->max_x ){ if(!(pri[sx]&priority)){ if (full_shadow) - dest[sx] = shadow_base[dest[sx]&shadow_mask]; + dest[sx] = shadow_pen_base + (dest[sx]&shadow_mask); else if (partial_shadow && pen==shadow_pen) - dest[sx] = shadow_base[dest[sx]&shadow_mask]; + dest[sx] = shadow_pen_base + (dest[sx]&shadow_mask); else - dest[sx] = paldata[pen]; + dest[sx] = pen_base + pen; } } xcount -= width; @@ -277,11 +277,11 @@ static void draw_sprite(running_machine *machine, if( pen && pen!=0xf && sx>=cliprect->min_x && sx<=cliprect->max_x ){ if(!(pri[sx]&priority)){ if (full_shadow) - dest[sx] = shadow_base[dest[sx]&shadow_mask]; + dest[sx] = shadow_pen_base + (dest[sx]&shadow_mask); else if (partial_shadow && pen==shadow_pen) - dest[sx] = shadow_base[dest[sx]&shadow_mask]; + dest[sx] = shadow_pen_base + (dest[sx]&shadow_mask); else - dest[sx] = paldata[pen]; + dest[sx] = pen_base + pen; } } xcount -= width; @@ -315,7 +315,7 @@ static void draw_sprite(running_machine *machine, while( xcount>=width ) { if( pen && pen!=0xf && sx>=cliprect->min_x && sx<=cliprect->max_x ) - if(!(pri[sx]&priority)) dest[sx] = paldata[pen]; + if(!(pri[sx]&priority)) dest[sx] = pen_base + pen; xcount -= width; sx+=dx; } @@ -324,7 +324,7 @@ static void draw_sprite(running_machine *machine, while( xcount>=width ) { if( pen && pen!=0xf && sx>=cliprect->min_x && sx<=cliprect->max_x ) - if(!(pri[sx]&priority)) dest[sx] = paldata[pen]; + if(!(pri[sx]&priority)) dest[sx] = pen_base + pen; xcount -= width; sx+=dx; } @@ -340,7 +340,7 @@ static void draw_sprite(running_machine *machine, static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int b3d ) //* { - const pen_t *base_pal = machine->pens + machine->gfx[0]->color_base; + pen_t pen_base = machine->gfx[0]->color_base; const UINT8 *base_gfx = memory_region(REGION_GFX2); const int gfx_rom_size = memory_region_length(REGION_GFX2); const UINT16 *source = sys16_spriteram; @@ -423,7 +423,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re draw_sprite(machine, bitmap,cliprect, base_gfx + gfx, pitch, - base_pal + (sprite.color<<4), + pen_base + (sprite.color<<4), xpos, ypos, screen_width, sprite.screen_height, width, logical_height, flipx, flipy, @@ -1112,7 +1112,7 @@ VIDEO_UPDATE( system18old ){ if(sys18_bg2_active) tilemap_draw( bitmap,cliprect, background2, 0, 0 ); else - fillbitmap(bitmap,machine->pens[0],cliprect); + fillbitmap(bitmap,0,cliprect); tilemap_draw( bitmap,cliprect, background, TILEMAP_DRAW_OPAQUE, 0 ); tilemap_draw( bitmap,cliprect, background, TILEMAP_DRAW_OPAQUE | 1, 0 ); //??