trunk/src/mame/drivers/kaneko16.c
| r29233 | r29234 | |
| 232 | 232 | The Berlin Wall |
| 233 | 233 | ***************************************************************************/ |
| 234 | 234 | |
| 235 | READ16_MEMBER(kaneko16_berlwall_state::berlwall_oki_r) |
| 236 | { |
| 237 | UINT16 ret; |
| 238 | |
| 239 | if (mem_mask == 0xff00) // reads / writes to the upper byte only appear to act as a mirror to the lower byte, 16-bit reads/writes only access the lower byte. |
| 240 | { |
| 241 | mem_mask >>= 8; |
| 242 | } |
| 243 | |
| 244 | ret = m_oki->read(space, offset, mem_mask); |
| 245 | ret = ret | ret << 8; |
| 246 | |
| 247 | return ret; |
| 248 | } |
| 249 | |
| 250 | WRITE16_MEMBER(kaneko16_berlwall_state::berlwall_oki_w) |
| 251 | { |
| 252 | if (mem_mask == 0xff00) // reads / writes to the upper byte only appear to act as a mirror to the lower byte, 16-bit reads/writes only access the lower byte. |
| 253 | { |
| 254 | data >>= 8; |
| 255 | mem_mask >>= 8; |
| 256 | } |
| 257 | |
| 258 | m_oki->write(space, offset, data, mem_mask); |
| 259 | } |
| 260 | |
| 235 | 261 | static ADDRESS_MAP_START( berlwall, AS_PROGRAM, 16, kaneko16_berlwall_state ) |
| 236 | 262 | AM_RANGE(0x000000, 0x03ffff) AM_ROM // ROM |
| 237 | 263 | AM_RANGE(0x200000, 0x20ffff) AM_RAM // Work RAM |
| r29233 | r29234 | |
| 251 | 277 | AM_RANGE(0x800000, 0x80001f) AM_READWRITE(kaneko16_ay1_YM2149_r, kaneko16_ay1_YM2149_w) // Sound |
| 252 | 278 | AM_RANGE(0x800200, 0x80021f) AM_READWRITE(kaneko16_ay2_YM2149_r, kaneko16_ay2_YM2149_w) |
| 253 | 279 | AM_RANGE(0x8003fe, 0x8003ff) AM_NOP // for OKI when accessed as .l |
| 254 | | AM_RANGE(0x800400, 0x800401) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) |
| 280 | AM_RANGE(0x800400, 0x800401) AM_READWRITE( berlwall_oki_r, berlwall_oki_w ) |
| 255 | 281 | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device, kaneko_tmap_vram_r, kaneko_tmap_vram_w ) |
| 256 | 282 | AM_RANGE(0xd00000, 0xd0001f) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device, kaneko_tmap_regs_r, kaneko_tmap_regs_w) |
| 257 | 283 | ADDRESS_MAP_END |
| r29233 | r29234 | |
| 1630 | 1656 | MCFG_SCREEN_SIZE(256, 256) |
| 1631 | 1657 | MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 240-1) |
| 1632 | 1658 | MCFG_SCREEN_UPDATE_DRIVER(kaneko16_berlwall_state, screen_update_berlwall) |
| 1633 | | MCFG_SCREEN_PALETTE("palette") |
| 1659 | // MCFG_SCREEN_PALETTE("palette") |
| 1634 | 1660 | |
| 1635 | 1661 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", 1x4bit_1x4bit) |
| 1636 | | MCFG_PALETTE_ADD("palette", 2048 + 32768) /* 32768 static colors for the bg */ |
| 1662 | MCFG_PALETTE_ADD("palette", 2048 ) |
| 1637 | 1663 | MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB) |
| 1664 | |
| 1665 | MCFG_PALETTE_ADD("bgpalette", 32768) /* 32768 static colors for the bg */ |
| 1666 | MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB) |
| 1638 | 1667 | MCFG_PALETTE_INIT_OWNER(kaneko16_berlwall_state,berlwall) |
| 1639 | 1668 | |
| 1640 | 1669 | MCFG_DEVICE_ADD("view2_0", KANEKO_TMAP, 0) |
| r29233 | r29234 | |
| 1764 | 1793 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", 1x4bit_1x4bit) |
| 1765 | 1794 | MCFG_PALETTE_ADD("palette", 2048) |
| 1766 | 1795 | MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB) |
| 1767 | | |
| 1796 | |
| 1768 | 1797 | MCFG_DEVICE_ADD("view2_0", KANEKO_TMAP, 0) |
| 1769 | 1798 | kaneko_view2_tilemap_device::set_gfx_region(*device, 1); |
| 1770 | 1799 | kaneko_view2_tilemap_device::set_offset(*device, 0x33, 0x8, 320, 240); |
| r29233 | r29234 | |
| 2486 | 2515 | ROM_END |
| 2487 | 2516 | |
| 2488 | 2517 | |
| 2518 | |
| 2489 | 2519 | /*************************************************************************** |
| 2490 | 2520 | |
| 2491 | 2521 | Blaze On (Japan version) |
| r29233 | r29234 | |
| 3854 | 3884 | GAME( 1991, berlwall, 0, berlwall, berlwall, kaneko16_berlwall_state, berlwall, ROT0, "Kaneko", "The Berlin Wall", 0 ) |
| 3855 | 3885 | GAME( 1991, berlwallt,berlwall, berlwall, berlwalt, kaneko16_berlwall_state, berlwall, ROT0, "Kaneko", "The Berlin Wall (bootleg ?)", 0 ) |
| 3856 | 3886 | |
| 3887 | |
| 3857 | 3888 | GAME( 1991, mgcrystl, 0, mgcrystl, mgcrystl, kaneko16_state, kaneko16, ROT0, "Kaneko", "Magical Crystals (World, 92/01/10)", 0 ) |
| 3858 | 3889 | GAME( 1991, mgcrystlo,mgcrystl, mgcrystl, mgcrystl, kaneko16_state, kaneko16, ROT0, "Kaneko", "Magical Crystals (World, 91/12/10)", 0 ) |
| 3859 | 3890 | GAME( 1991, mgcrystlj,mgcrystl, mgcrystl, mgcrystl, kaneko16_state, kaneko16, ROT0, "Kaneko (Atlus license)", "Magical Crystals (Japan, 92/01/13)", 0 ) |
trunk/src/mame/includes/kaneko16.h
| r29233 | r29234 | |
| 31 | 31 | m_view2_0(*this, "view2_0"), |
| 32 | 32 | m_view2_1(*this, "view2_1"), |
| 33 | 33 | m_kaneko_spr(*this, "kan_spr"), |
| 34 | | m_pandora(*this, "pandora") |
| 34 | m_pandora(*this, "pandora"), |
| 35 | m_palette(*this, "palette") |
| 35 | 36 | { } |
| 36 | 37 | |
| 37 | 38 | required_device<cpu_device> m_maincpu; |
| r29233 | r29234 | |
| 45 | 46 | optional_device<kaneko_view2_tilemap_device> m_view2_1; |
| 46 | 47 | optional_device<kaneko16_sprite_device> m_kaneko_spr; |
| 47 | 48 | optional_device<kaneko_pandora_device> m_pandora; |
| 49 | required_device<palette_device> m_palette; |
| 48 | 50 | |
| 49 | 51 | UINT16 m_disp_enable; |
| 50 | 52 | |
| r29233 | r29234 | |
| 72 | 74 | DECLARE_VIDEO_START(kaneko16); |
| 73 | 75 | DECLARE_MACHINE_RESET(mgcrystl); |
| 74 | 76 | UINT32 screen_update_kaneko16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 75 | | UINT32 screen_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 77 | |
| 78 | template<class _BitmapClass> |
| 79 | UINT32 screen_update_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect); |
| 80 | |
| 81 | |
| 82 | |
| 76 | 83 | TIMER_DEVICE_CALLBACK_MEMBER(kaneko16_interrupt); |
| 77 | 84 | TIMER_DEVICE_CALLBACK_MEMBER(shogwarr_interrupt); |
| 78 | | void kaneko16_fill_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 85 | |
| 86 | template<class _BitmapClass> |
| 87 | void kaneko16_fill_bitmap(palette_device* palette, _BitmapClass &bitmap, const rectangle &cliprect); |
| 88 | |
| 89 | |
| 79 | 90 | void kaneko16_common_oki_bank_w( const char *bankname, const char* tag, int bank, size_t fixedsize, size_t bankedsize ); |
| 80 | 91 | void kaneko16_unscramble_tiles(const char *region); |
| 81 | 92 | void kaneko16_expand_sample_banks(const char *region); |
| r29233 | r29234 | |
| 111 | 122 | kaneko16_berlwall_state(const machine_config &mconfig, device_type type, const char *tag) |
| 112 | 123 | : kaneko16_state(mconfig, type, tag), |
| 113 | 124 | m_bg15_reg(*this, "bg15_reg"), |
| 114 | | m_bg15_select(*this, "bg15_select") |
| 125 | m_bg15_select(*this, "bg15_select"), |
| 126 | m_bgpalette(*this, "bgpalette") |
| 127 | |
| 115 | 128 | { |
| 116 | 129 | } |
| 117 | 130 | |
| 118 | 131 | optional_shared_ptr<UINT16> m_bg15_reg; |
| 119 | 132 | optional_shared_ptr<UINT16> m_bg15_select; |
| 133 | required_device<palette_device> m_bgpalette; |
| 120 | 134 | |
| 121 | 135 | bitmap_ind16 m_bg15_bitmap; |
| 122 | 136 | |
| r29233 | r29234 | |
| 125 | 139 | DECLARE_READ16_MEMBER(kaneko16_bg15_reg_r); |
| 126 | 140 | DECLARE_WRITE16_MEMBER(kaneko16_bg15_reg_w); |
| 127 | 141 | |
| 142 | DECLARE_READ16_MEMBER(berlwall_oki_r); |
| 143 | DECLARE_WRITE16_MEMBER(berlwall_oki_w); |
| 144 | |
| 128 | 145 | DECLARE_DRIVER_INIT(berlwall); |
| 129 | 146 | DECLARE_PALETTE_INIT(berlwall); |
| 130 | 147 | DECLARE_VIDEO_START(berlwall); |
| 131 | | UINT32 screen_update_berlwall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 132 | | void kaneko16_render_15bpp_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 148 | UINT32 screen_update_berlwall(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 149 | void kaneko16_render_15bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 133 | 150 | }; |
| 134 | 151 | |
| 135 | 152 | class kaneko16_shogwarr_state : public kaneko16_state |
trunk/src/mame/video/kaneko_spr.c
| r29233 | r29234 | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // custom function to draw a single sprite. needed to keep correct sprites - sprites and sprites - tilemaps priorities |
| 232 | | void kaneko16_sprite_device::kaneko16_draw_sprites_custom(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx, |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | template<class _BitmapClass> |
| 237 | void kaneko16_sprite_device::kaneko16_draw_sprites_custom(_BitmapClass &dest_bmp,const rectangle &clip,gfx_element *gfx, |
| 233 | 238 | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 234 | 239 | bitmap_ind8 &priority_bitmap, int priority) |
| 235 | 240 | { |
| r29233 | r29234 | |
| 294 | 299 | ey -= pixels; |
| 295 | 300 | } |
| 296 | 301 | |
| 297 | | if( ex>sx ) |
| 302 | if (ex > sx) |
| 298 | 303 | { /* skip if inner loop doesn't draw anything */ |
| 299 | | int y; |
| 300 | 304 | |
| 301 | | for( y=sy; y<ey; y++ ) |
| 305 | typename _BitmapClass::pixel_t *dest; |
| 306 | int rgb; |
| 307 | if (sizeof(*dest) == 2) rgb = 0; |
| 308 | else rgb = 1; |
| 309 | |
| 310 | const pen_t *pal = gfx->palette()->pens(); |
| 311 | |
| 312 | for (int y = sy; y < ey; y++) |
| 302 | 313 | { |
| 303 | | const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes(); |
| 304 | | UINT16 *dest = &dest_bmp.pix16(y); |
| 314 | const UINT8 *source = source_base + (y_index >> 16) * gfx->rowbytes(); |
| 315 | dest = &dest_bmp.pix(y); |
| 305 | 316 | UINT8 *pri = &priority_bitmap.pix8(y); |
| 306 | 317 | |
| 307 | | int x, x_index = x_index_base; |
| 308 | | for( x=sx; x<ex; x++ ) |
| 318 | int x_index = x_index_base; |
| 319 | for (int x = sx; x < ex; x++) |
| 309 | 320 | { |
| 310 | | int c = source[x_index>>16]; |
| 311 | | if( c != 0 ) |
| 321 | int c = source[x_index >> 16]; |
| 322 | if (c != 0) |
| 312 | 323 | { |
| 313 | 324 | if (pri[x] < priority) |
| 314 | | dest[x] = pen_base + c; |
| 315 | | pri[x] = 0xff; // mark it "already drawn" |
| 325 | { |
| 326 | |
| 327 | if (!rgb) dest[x] = pen_base + c; |
| 328 | else dest[x] = pal[pen_base + c]; |
| 329 | |
| 330 | pri[x] = 0xff; // mark it "already drawn" |
| 331 | } |
| 316 | 332 | } |
| 317 | 333 | x_index += dx; |
| 318 | 334 | } |
| r29233 | r29234 | |
| 323 | 339 | } |
| 324 | 340 | } |
| 325 | 341 | |
| 342 | |
| 343 | |
| 344 | |
| 326 | 345 | /* Build a list of sprites to display & draw them */ |
| 327 | | |
| 328 | | void kaneko16_sprite_device::kaneko16_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes) |
| 346 | template<class _BitmapClass> |
| 347 | void kaneko16_sprite_device::kaneko16_draw_sprites(running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes) |
| 329 | 348 | { |
| 330 | 349 | /* Sprites *must* be parsed from the first in RAM to the last, |
| 331 | 350 | because of the multisprite feature. But they *must* be drawn |
| r29233 | r29234 | |
| 550 | 569 | } |
| 551 | 570 | |
| 552 | 571 | |
| 572 | void kaneko16_sprite_device::kaneko16_copybitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 573 | { |
| 574 | copybitmap_trans(bitmap,m_sprites_bitmap,0,0,0,0,cliprect,0); |
| 575 | } |
| 553 | 576 | |
| 554 | | void kaneko16_sprite_device::kaneko16_render_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes) |
| 577 | void kaneko16_sprite_device::kaneko16_copybitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 555 | 578 | { |
| 579 | const pen_t *pal = m_gfxdecode->gfx(0)->palette()->pens(); |
| 580 | UINT16* srcbitmap; |
| 581 | UINT32* dstbitmap; |
| 582 | |
| 583 | for (int y = cliprect.min_y; y <= cliprect.max_y; y++) |
| 584 | { |
| 585 | srcbitmap = &m_sprites_bitmap.pix16(y); |
| 586 | dstbitmap = &bitmap.pix32(y); |
| 587 | |
| 588 | for (int x = cliprect.min_x; x <= cliprect.max_x; x++) |
| 589 | { |
| 590 | UINT16 pix = srcbitmap[x]; |
| 591 | if (pix) dstbitmap[x] = pal[pix]; |
| 592 | } |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | |
| 597 | |
| 598 | void kaneko16_sprite_device::kaneko16_render_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes) { kaneko16_render_sprites_common(machine, bitmap, cliprect, priority_bitmap, spriteram16, spriteram16_bytes); } |
| 599 | void kaneko16_sprite_device::kaneko16_render_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes) { kaneko16_render_sprites_common(machine, bitmap, cliprect, priority_bitmap, spriteram16, spriteram16_bytes); } |
| 600 | |
| 601 | template<class _BitmapClass> |
| 602 | void kaneko16_sprite_device::kaneko16_render_sprites_common(running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes) |
| 603 | { |
| 556 | 604 | /* Sprites last (rendered with pdrawgfx, so they can slip |
| 557 | 605 | in between the layers) */ |
| 558 | 606 | |
| 559 | 607 | if(m_keep_sprites) |
| 560 | 608 | { |
| 561 | | /* keep sprites on screen */ |
| 609 | /* keep sprites on screen - used by mgcrystl when you get the first gem and it shows instructions */ |
| 562 | 610 | kaneko16_draw_sprites(machine,m_sprites_bitmap, cliprect, priority_bitmap, spriteram16, spriteram16_bytes); |
| 563 | | copybitmap_trans(bitmap,m_sprites_bitmap,0,0,0,0,cliprect,0); |
| 611 | kaneko16_copybitmap(bitmap,cliprect); |
| 564 | 612 | } |
| 565 | 613 | else |
| 566 | 614 | { |
trunk/src/mame/video/kaneko_spr.h
| r29233 | r29234 | |
| 42 | 42 | virtual int get_sprite_type(void) =0; |
| 43 | 43 | |
| 44 | 44 | void kaneko16_render_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes); |
| 45 | void kaneko16_render_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes); |
| 45 | 46 | |
| 46 | 47 | |
| 48 | template<class _BitmapClass> |
| 49 | void kaneko16_render_sprites_common(running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes); |
| 50 | |
| 51 | |
| 47 | 52 | DECLARE_READ16_MEMBER(kaneko16_sprites_regs_r); |
| 48 | 53 | DECLARE_WRITE16_MEMBER(kaneko16_sprites_regs_w); |
| 49 | 54 | |
| r29233 | r29234 | |
| 81 | 86 | int m_keep_sprites; |
| 82 | 87 | bitmap_ind16 m_sprites_bitmap; |
| 83 | 88 | |
| 84 | | void kaneko16_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes); |
| 85 | 89 | |
| 86 | | void kaneko16_draw_sprites_custom(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx, |
| 90 | template<class _BitmapClass> |
| 91 | void kaneko16_draw_sprites(running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes); |
| 92 | |
| 93 | |
| 94 | template<class _BitmapClass> |
| 95 | void kaneko16_draw_sprites_custom(_BitmapClass &dest_bmp,const rectangle &clip,gfx_element *gfx, |
| 87 | 96 | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 88 | 97 | bitmap_ind8 &priority_bitmap, int priority); |
| 89 | 98 | |
| 90 | 99 | int kaneko16_parse_sprite_type012(running_machine &machine, int i, struct tempsprite *s, UINT16* spriteram16, int spriteram16_bytes); |
| 91 | 100 | |
| 101 | void kaneko16_copybitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 102 | void kaneko16_copybitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 92 | 103 | |
| 93 | 104 | required_device<gfxdecode_device> m_gfxdecode; |
| 94 | 105 | |
trunk/src/mame/video/kaneko_tmap.c
| r29233 | r29234 | |
| 195 | 195 | m_tmap[_N_]->mark_tile_dirty(offset/2); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | void kaneko_view2_tilemap_device::kaneko16_prepare(bitmap_ind16 &bitmap, const rectangle &cliprect) { kaneko16_prepare_common(bitmap, cliprect); }; |
| 199 | void kaneko_view2_tilemap_device::kaneko16_prepare(bitmap_rgb32 &bitmap, const rectangle &cliprect) { kaneko16_prepare_common(bitmap, cliprect); }; |
| 198 | 200 | |
| 199 | | void kaneko_view2_tilemap_device::kaneko16_prepare(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 201 | template<class _BitmapClass> |
| 202 | void kaneko_view2_tilemap_device::kaneko16_prepare_common(_BitmapClass &bitmap, const rectangle &cliprect) |
| 200 | 203 | { |
| 201 | 204 | int layers_flip_0; |
| 202 | 205 | UINT16 layer0_scrollx, layer0_scrolly; |
| r29233 | r29234 | |
| 244 | 247 | } |
| 245 | 248 | } |
| 246 | 249 | |
| 247 | | void kaneko_view2_tilemap_device::render_tilemap_chip(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri) |
| 250 | void kaneko_view2_tilemap_device::render_tilemap_chip(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri) { render_tilemap_chip_common(screen, bitmap, cliprect, pri); } |
| 251 | void kaneko_view2_tilemap_device::render_tilemap_chip(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri) { render_tilemap_chip_common(screen, bitmap, cliprect, pri); } |
| 252 | |
| 253 | template<class _BitmapClass> |
| 254 | void kaneko_view2_tilemap_device::render_tilemap_chip_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect, int pri) |
| 248 | 255 | { |
| 249 | 256 | m_tmap[0]->draw(screen, bitmap, cliprect, pri, pri, 0); |
| 250 | 257 | m_tmap[1]->draw(screen, bitmap, cliprect, pri, pri, 0); |
| 251 | 258 | } |
| 252 | 259 | |
| 253 | | void kaneko_view2_tilemap_device::render_tilemap_chip_alt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int v2pri) |
| 260 | void kaneko_view2_tilemap_device::render_tilemap_chip_alt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int v2pri) { render_tilemap_chip_alt_common(screen, bitmap, cliprect, pri, v2pri); } |
| 261 | void kaneko_view2_tilemap_device::render_tilemap_chip_alt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri, int v2pri) { render_tilemap_chip_alt_common(screen, bitmap, cliprect, pri, v2pri); } |
| 262 | |
| 263 | template<class _BitmapClass> |
| 264 | void kaneko_view2_tilemap_device::render_tilemap_chip_alt_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect, int pri, int v2pri) |
| 254 | 265 | { |
| 255 | 266 | m_tmap[0]->draw(screen, bitmap, cliprect, pri, v2pri ? pri : 0, 0); |
| 256 | 267 | m_tmap[1]->draw(screen, bitmap, cliprect, pri, v2pri ? pri : 0, 0); |
trunk/src/mame/video/kaneko_tmap.h
| r29233 | r29234 | |
| 26 | 26 | void kaneko16_vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_); |
| 27 | 27 | |
| 28 | 28 | // call to do the rendering etc. |
| 29 | template<class _BitmapClass> |
| 30 | void kaneko16_prepare_common(_BitmapClass &bitmap, const rectangle &cliprect); |
| 31 | template<class _BitmapClass> |
| 32 | void render_tilemap_chip_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect, int pri); |
| 33 | template<class _BitmapClass> |
| 34 | void render_tilemap_chip_alt_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect, int pri, int v2pri); |
| 35 | |
| 29 | 36 | void kaneko16_prepare(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 37 | void kaneko16_prepare(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 30 | 38 | void render_tilemap_chip(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri); |
| 39 | void render_tilemap_chip(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri); |
| 31 | 40 | void render_tilemap_chip_alt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int v2pri); |
| 41 | void render_tilemap_chip_alt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri, int v2pri); |
| 32 | 42 | |
| 43 | |
| 33 | 44 | // access |
| 34 | 45 | DECLARE_READ16_MEMBER( kaneko_tmap_vram_r ); |
| 35 | 46 | DECLARE_WRITE16_MEMBER( kaneko_tmap_vram_w ); |
trunk/src/mame/video/kaneko16.c
| r29233 | r29234 | |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | |
| 27 | | void kaneko16_state::kaneko16_fill_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 27 | /* Fill the bitmap with a single colour. This is wrong, but will work most of |
| 28 | the times. To do it right, each pixel should be drawn with pen 0 |
| 29 | of the bottomost tile that covers it (which is pretty tricky to do) */ |
| 30 | template<class _BitmapClass> |
| 31 | void kaneko16_state::kaneko16_fill_bitmap(palette_device* palette, _BitmapClass &bitmap, const rectangle &cliprect) |
| 28 | 32 | { |
| 33 | int pen = 0; |
| 34 | |
| 29 | 35 | if (m_kaneko_spr) |
| 30 | | if(m_kaneko_spr->get_sprite_type()== 1) |
| 36 | { |
| 37 | if (m_kaneko_spr->get_sprite_type() == 1) |
| 31 | 38 | { |
| 32 | | bitmap.fill(0x7f00, cliprect); |
| 33 | | return; |
| 39 | pen = 0x7f00; |
| 34 | 40 | } |
| 41 | } |
| 35 | 42 | |
| 36 | 43 | |
| 44 | typename _BitmapClass::pixel_t *dest; |
| 45 | if (sizeof(*dest) == 2) |
| 46 | { |
| 47 | bitmap.fill(pen, cliprect); |
| 48 | } |
| 49 | else |
| 50 | { |
| 51 | const pen_t *pal = palette->pens(); |
| 52 | bitmap.fill(pal[pen], cliprect); |
| 53 | } |
| 54 | } |
| 37 | 55 | |
| 38 | | /* Fill the bitmap with pen 0. This is wrong, but will work most of |
| 39 | | the times. To do it right, each pixel should be drawn with pen 0 |
| 40 | | of the bottomost tile that covers it (which is pretty tricky to do) */ |
| 41 | | bitmap.fill(0, cliprect); |
| 42 | 56 | |
| 43 | | } |
| 44 | 57 | |
| 45 | | UINT32 kaneko16_state::screen_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 58 | |
| 59 | template<class _BitmapClass> |
| 60 | UINT32 kaneko16_state::screen_update_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect) |
| 46 | 61 | { |
| 47 | 62 | int i; |
| 48 | 63 | |
| r29233 | r29234 | |
| 66 | 81 | |
| 67 | 82 | UINT32 kaneko16_state::screen_update_kaneko16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 68 | 83 | { |
| 69 | | kaneko16_fill_bitmap(bitmap,cliprect); |
| 84 | kaneko16_fill_bitmap(m_palette, bitmap,cliprect); |
| 70 | 85 | |
| 71 | 86 | // if the display is disabled, do nothing? |
| 72 | 87 | if (!m_disp_enable) return 0; |
| r29233 | r29234 | |
| 91 | 106 | |
| 92 | 107 | /* initialize 555 RGB lookup */ |
| 93 | 108 | for (i = 0; i < 32768; i++) |
| 94 | | palette.set_pen_color(2048 + i,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0)); |
| 109 | palette.set_pen_color(i,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0)); |
| 95 | 110 | } |
| 96 | 111 | |
| 97 | 112 | VIDEO_START_MEMBER(kaneko16_berlwall_state,berlwall) |
| r29233 | r29234 | |
| 134 | 149 | if ((r & 0x10) && (b & 0x10)) |
| 135 | 150 | g = (g - 1) & 0x1f; /* decrease with wraparound */ |
| 136 | 151 | |
| 137 | | m_bg15_bitmap.pix16(y, sx * 256 + x) = 2048 + ((g << 10) | (r << 5) | b); |
| 152 | m_bg15_bitmap.pix16(y, sx * 256 + x) = ((g << 10) | (r << 5) | b); |
| 138 | 153 | } |
| 139 | 154 | |
| 140 | 155 | VIDEO_START_CALL_MEMBER(kaneko16); |
| r29233 | r29234 | |
| 164 | 179 | WRITE16_MEMBER(kaneko16_berlwall_state::kaneko16_bg15_reg_w) |
| 165 | 180 | { |
| 166 | 181 | COMBINE_DATA(&m_bg15_reg[0]); |
| 182 | // printf("kaneko16_bg15_reg_w %04x\n", m_bg15_reg[0]); |
| 183 | double brt1 = data & 0xff; |
| 184 | brt1 = brt1 / 255.0; |
| 185 | |
| 186 | for (int i = 0; i < 0x8000;i++) |
| 187 | m_bgpalette->set_pen_contrast(i, brt1); |
| 167 | 188 | } |
| 168 | 189 | |
| 169 | 190 | |
| 170 | | void kaneko16_berlwall_state::kaneko16_render_15bpp_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 191 | void kaneko16_berlwall_state::kaneko16_render_15bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 171 | 192 | { |
| 172 | 193 | if (m_bg15_bitmap.valid()) |
| 173 | 194 | { |
| 174 | 195 | int select = m_bg15_select[ 0 ]; |
| 175 | 196 | // int reg = m_bg15_reg[ 0 ]; |
| 176 | 197 | int flip = select & 0x20; |
| 177 | | int sx, sy; |
| 198 | int sx;//, sy; |
| 178 | 199 | |
| 179 | | if (flip) select ^= 0x1f; |
| 200 | // if (flip) select ^= 0x1f; |
| 180 | 201 | |
| 181 | 202 | sx = (select & 0x1f) * 256; |
| 182 | | sy = 0; |
| 203 | // sy = 0; |
| 183 | 204 | |
| 184 | | copybitmap(bitmap, m_bg15_bitmap, flip, flip, -sx, -sy, cliprect); |
| 205 | const pen_t *pal = m_bgpalette->pens(); |
| 206 | UINT16* srcbitmap; |
| 207 | UINT32* dstbitmap; |
| 185 | 208 | |
| 209 | for (int y = cliprect.min_y; y <= cliprect.max_y; y++) |
| 210 | { |
| 211 | if (!flip) srcbitmap = &m_bg15_bitmap.pix16(y); |
| 212 | else srcbitmap = &m_bg15_bitmap.pix16(255-y); |
| 213 | dstbitmap = &bitmap.pix32(y); |
| 214 | |
| 215 | for (int x = cliprect.min_x; x <= cliprect.max_x; x++) |
| 216 | { |
| 217 | UINT16 pix = srcbitmap[x + sx]; |
| 218 | dstbitmap[x] = pal[pix&0x7fff]; |
| 219 | } |
| 220 | } |
| 221 | |
| 186 | 222 | // flag = 0; |
| 187 | 223 | } |
| 188 | 224 | } |
| 189 | | UINT32 kaneko16_berlwall_state::screen_update_berlwall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 225 | UINT32 kaneko16_berlwall_state::screen_update_berlwall(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 190 | 226 | { |
| 191 | 227 | // berlwall uses a 15bpp bitmap as a bg, not a solid fill |
| 192 | 228 | kaneko16_render_15bpp_bitmap(bitmap,cliprect); |