trunk/src/mame/drivers/supduck.c
| r242126 | r242127 | |
| 24 | 24 | #include "cpu/m68000/m68000.h" |
| 25 | 25 | #include "sound/okim6295.h" |
| 26 | 26 | #include "video/bufsprite.h" |
| 27 | #include "video/tigeroad_spr.h" |
| 27 | 28 | |
| 28 | 29 | class supduck_state : public driver_device |
| 29 | 30 | { |
| r242126 | r242127 | |
| 37 | 38 | m_fore_videoram(*this, "forevideoram"), |
| 38 | 39 | m_back_videoram(*this, "backvideoram"), |
| 39 | 40 | m_gfxdecode(*this, "gfxdecode"), |
| 40 | | m_palette(*this, "palette") |
| 41 | m_palette(*this, "palette"), |
| 42 | m_spritegen(*this, "spritegen") |
| 41 | 43 | { } |
| 42 | 44 | |
| 43 | 45 | // devices |
| r242126 | r242127 | |
| 52 | 54 | |
| 53 | 55 | required_device<gfxdecode_device> m_gfxdecode; |
| 54 | 56 | required_device<palette_device> m_palette; |
| 57 | required_device<tigeroad_spr_device> m_spritegen; |
| 55 | 58 | |
| 56 | 59 | tilemap_t *m_text_tilemap; |
| 57 | 60 | tilemap_t *m_fore_tilemap; |
| r242126 | r242127 | |
| 79 | 82 | |
| 80 | 83 | virtual void video_start(); |
| 81 | 84 | |
| 82 | | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority); |
| 83 | 85 | TILE_GET_INFO_MEMBER(get_text_tile_info); |
| 84 | 86 | TILE_GET_INFO_MEMBER(get_fore_tile_info); |
| 85 | 87 | TILE_GET_INFO_MEMBER(get_back_tile_info); |
| r242126 | r242127 | |
| 124 | 126 | m_back_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 125 | 127 | m_fore_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 126 | 128 | |
| 129 | m_spritegen->draw_sprites(bitmap, cliprect, m_gfxdecode, 3, m_spriteram->buffer(), m_spriteram->bytes(), flip_screen(), 1 ); |
| 127 | 130 | |
| 128 | | draw_sprites(bitmap, cliprect, 0); |
| 129 | | draw_sprites(bitmap, cliprect, 1); //draw priority sprites? |
| 130 | | |
| 131 | 131 | m_text_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 132 | 132 | return 0; |
| 133 | 133 | } |
| r242126 | r242127 | |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | |
| 200 | | void supduck_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) |
| 201 | | { |
| 202 | | UINT16 *source = &m_spriteram->buffer()[m_spriteram->bytes()/2] - 4; |
| 203 | | UINT16 *finish = m_spriteram->buffer(); |
| 204 | 200 | |
| 205 | | while (source >= finish) |
| 206 | | { |
| 207 | | int tile_number = source[0]; |
| 208 | | |
| 209 | | if (tile_number != 0xfff) { |
| 210 | | int attr = source[1]; |
| 211 | | int sy = source[2] & 0x1ff; |
| 212 | | int sx = source[3] & 0x1ff; |
| 213 | | |
| 214 | | int flipx = attr & 0x02; |
| 215 | | int flipy = attr & 0x01; |
| 216 | | int color = (attr >> 2) & 0x0f; |
| 217 | | |
| 218 | | if (sx > 0x100) sx -= 0x200; |
| 219 | | if (sy > 0x100) sy -= 0x200; |
| 220 | | |
| 221 | | if (flip_screen()) |
| 222 | | { |
| 223 | | sx = 240 - sx; |
| 224 | | sy = 240 - sy; |
| 225 | | flipx = !flipx; |
| 226 | | flipy = !flipy; |
| 227 | | } |
| 228 | | |
| 229 | | |
| 230 | | m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, |
| 231 | | tile_number, |
| 232 | | color, |
| 233 | | flipx, flipy, |
| 234 | | sx, 240 - sy, 15); |
| 235 | | } |
| 236 | | |
| 237 | | source -= 4; |
| 238 | | } |
| 239 | | } |
| 240 | | |
| 241 | 201 | WRITE16_MEMBER(supduck_state::supduck_4000_w) |
| 242 | 202 | { |
| 243 | 203 | } |
| r242126 | r242127 | |
| 490 | 450 | |
| 491 | 451 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", supduck) |
| 492 | 452 | |
| 453 | MCFG_DEVICE_ADD("spritegen", TIGEROAD_SPRITE, 0) |
| 454 | |
| 493 | 455 | MCFG_PALETTE_ADD("palette", 0x800/2) |
| 494 | 456 | MCFG_PALETTE_FORMAT(xRGBRRRRGGGGBBBB_bit4) |
| 495 | 457 | |
trunk/src/mame/drivers/tigeroad.c
| r242126 | r242127 | |
| 619 | 619 | MCFG_SCREEN_PALETTE("palette") |
| 620 | 620 | |
| 621 | 621 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", tigeroad) |
| 622 | |
| 623 | MCFG_DEVICE_ADD("spritegen", TIGEROAD_SPRITE, 0) |
| 622 | 624 | |
| 623 | 625 | MCFG_PALETTE_ADD("palette", 1024) |
| 624 | 626 | MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB) |
| r242126 | r242127 | |
| 680 | 682 | |
| 681 | 683 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", tigeroad) |
| 682 | 684 | |
| 685 | MCFG_DEVICE_ADD("spritegen", TIGEROAD_SPRITE, 0) |
| 686 | |
| 683 | 687 | MCFG_PALETTE_ADD("palette", 1024) |
| 684 | 688 | MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB) |
| 685 | 689 | |
trunk/src/mame/includes/bionicc.h
| r242126 | r242127 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "video/bufsprite.h" |
| 8 | #include "video/tigeroad_spr.h" |
| 8 | 9 | |
| 9 | 10 | class bionicc_state : public driver_device |
| 10 | 11 | { |
| r242126 | r242127 | |
| 18 | 19 | m_paletteram(*this, "paletteram"), |
| 19 | 20 | m_maincpu(*this, "maincpu"), |
| 20 | 21 | m_gfxdecode(*this, "gfxdecode"), |
| 21 | | m_palette(*this, "palette") { } |
| 22 | m_palette(*this, "palette"), |
| 23 | m_spritegen(*this, "spritegen") |
| 24 | { } |
| 22 | 25 | |
| 23 | 26 | /* memory pointers */ |
| 24 | 27 | required_device<buffered_spriteram16_device> m_spriteram; |
| r242126 | r242127 | |
| 55 | 58 | virtual void video_start(); |
| 56 | 59 | UINT32 screen_update_bionicc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 57 | 60 | TIMER_DEVICE_CALLBACK_MEMBER(bionicc_scanline); |
| 58 | | void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); |
| 59 | 61 | required_device<cpu_device> m_maincpu; |
| 60 | 62 | required_device<gfxdecode_device> m_gfxdecode; |
| 61 | 63 | required_device<palette_device> m_palette; |
| 64 | required_device<tigeroad_spr_device> m_spritegen; |
| 62 | 65 | }; |
trunk/src/mame/includes/tigeroad.h
| r242126 | r242127 | |
| 5 | 5 | #include "sound/2203intf.h" |
| 6 | 6 | #include "sound/msm5205.h" |
| 7 | 7 | #include "cpu/m6805/m6805.h" |
| 8 | #include "video/tigeroad_spr.h" |
| 8 | 9 | |
| 9 | 10 | class tigeroad_state : public driver_device |
| 10 | 11 | { |
| r242126 | r242127 | |
| 20 | 21 | m_gfxdecode(*this, "gfxdecode"), |
| 21 | 22 | m_palette(*this, "palette"), |
| 22 | 23 | m_mcu(*this, "mcu"), |
| 24 | m_spritegen(*this, "spritegen"), |
| 23 | 25 | m_has_coinlock(1) |
| 24 | 26 | { } |
| 25 | 27 | |
| r242126 | r242127 | |
| 43 | 45 | TILEMAP_MAPPER_MEMBER(tigeroad_tilemap_scan); |
| 44 | 46 | virtual void video_start(); |
| 45 | 47 | UINT32 screen_update_tigeroad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 46 | | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ); |
| 47 | 48 | void f1dream_protection_w(address_space &space); |
| 48 | 49 | DECLARE_WRITE_LINE_MEMBER(irqhandler); |
| 49 | 50 | required_device<cpu_device> m_maincpu; |
| r242126 | r242127 | |
| 52 | 53 | required_device<gfxdecode_device> m_gfxdecode; |
| 53 | 54 | required_device<palette_device> m_palette; |
| 54 | 55 | optional_device<cpu_device> m_mcu; |
| 56 | required_device<tigeroad_spr_device> m_spritegen; |
| 55 | 57 | |
| 56 | 58 | UINT16 m_control[2]; |
| 57 | 59 | |
trunk/src/mame/video/bionicc.c
| r242126 | r242127 | |
| 185 | 185 | |
| 186 | 186 | ***************************************************************************/ |
| 187 | 187 | |
| 188 | | void bionicc_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 189 | | { |
| 190 | | UINT16 *buffered_spriteram = m_spriteram->buffer(); |
| 191 | | int offs; |
| 192 | | gfx_element *gfx = m_gfxdecode->gfx(3); |
| 193 | 188 | |
| 194 | | for (offs = (m_spriteram->bytes() - 8) / 2; offs >= 0; offs -= 4) |
| 195 | | { |
| 196 | | int tile_number = buffered_spriteram[offs] & 0x7ff; |
| 197 | | if( tile_number != 0x7ff ) |
| 198 | | { |
| 199 | | int attr = buffered_spriteram[offs + 1]; |
| 200 | | int color = (attr & 0x3c) >> 2; |
| 201 | | int flipx = attr & 0x02; |
| 202 | | int flipy = 0; |
| 203 | | int sx = (INT16)buffered_spriteram[offs + 3]; /* signed */ |
| 204 | | int sy = (INT16)buffered_spriteram[offs + 2]; /* signed */ |
| 205 | 189 | |
| 206 | | if (sy > 512 - 16) |
| 207 | | sy -= 512; |
| 208 | | |
| 209 | | if (flip_screen()) |
| 210 | | { |
| 211 | | sx = 240 - sx; |
| 212 | | sy = 240 - sy; |
| 213 | | flipx = !flipx; |
| 214 | | flipy = !flipy; |
| 215 | | } |
| 216 | | |
| 217 | | gfx->transpen(bitmap,cliprect, |
| 218 | | tile_number, |
| 219 | | color, |
| 220 | | flipx,flipy, |
| 221 | | sx,sy,15); |
| 222 | | } |
| 223 | | } |
| 224 | | } |
| 225 | | |
| 226 | 190 | UINT32 bionicc_state::screen_update_bionicc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 227 | 191 | { |
| 228 | 192 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 229 | 193 | m_fg_tilemap->draw(screen, bitmap, cliprect, 1 | TILEMAP_DRAW_LAYER1, 0); /* nothing in FRONT */ |
| 230 | 194 | m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 231 | 195 | m_fg_tilemap->draw(screen, bitmap, cliprect, 0 | TILEMAP_DRAW_LAYER1, 0); |
| 232 | | draw_sprites(bitmap, cliprect); |
| 196 | m_spritegen->draw_sprites(bitmap, cliprect, m_gfxdecode, 3, m_spriteram->buffer(), m_spriteram->bytes(), flip_screen(), 0 ); |
| 233 | 197 | m_fg_tilemap->draw(screen, bitmap, cliprect, 0 | TILEMAP_DRAW_LAYER0, 0); |
| 234 | 198 | m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 235 | 199 | return 0; |
trunk/src/mame/video/tigeroad.c
| r242126 | r242127 | |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | | void tigeroad_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) |
| 70 | | { |
| 71 | | UINT16 *source = &m_spriteram->buffer()[m_spriteram->bytes()/2] - 4; |
| 72 | | UINT16 *finish = m_spriteram->buffer(); |
| 73 | 69 | |
| 74 | | while (source >= finish) |
| 75 | | { |
| 76 | | int tile_number = source[0]; |
| 77 | 70 | |
| 78 | | if (tile_number != 0xfff) { |
| 79 | | int attr = source[1]; |
| 80 | | int sy = source[2] & 0x1ff; |
| 81 | | int sx = source[3] & 0x1ff; |
| 82 | | |
| 83 | | int flipx = attr & 0x02; |
| 84 | | int flipy = attr & 0x01; |
| 85 | | int color = (attr >> 2) & 0x0f; |
| 86 | | |
| 87 | | if (sx > 0x100) sx -= 0x200; |
| 88 | | if (sy > 0x100) sy -= 0x200; |
| 89 | | |
| 90 | | if (flip_screen()) |
| 91 | | { |
| 92 | | sx = 240 - sx; |
| 93 | | sy = 240 - sy; |
| 94 | | flipx = !flipx; |
| 95 | | flipy = !flipy; |
| 96 | | } |
| 97 | | |
| 98 | | |
| 99 | | m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, |
| 100 | | tile_number, |
| 101 | | color, |
| 102 | | flipx, flipy, |
| 103 | | sx, 240 - sy, 15); |
| 104 | | } |
| 105 | | |
| 106 | | source -= 4; |
| 107 | | } |
| 108 | | } |
| 109 | | |
| 110 | 71 | TILE_GET_INFO_MEMBER(tigeroad_state::get_bg_tile_info) |
| 111 | 72 | { |
| 112 | 73 | UINT8 *tilerom = memregion("bgmap")->base(); |
| r242126 | r242127 | |
| 156 | 117 | UINT32 tigeroad_state::screen_update_tigeroad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 157 | 118 | { |
| 158 | 119 | m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); |
| 159 | | draw_sprites(bitmap, cliprect, 0); |
| 120 | m_spritegen->draw_sprites(bitmap, cliprect, m_gfxdecode, 2, m_spriteram->buffer(), m_spriteram->bytes(), flip_screen(), 1 ); |
| 160 | 121 | m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1); |
| 161 | | //draw_sprites(bitmap, cliprect, 1); draw priority sprites? |
| 162 | 122 | m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2); |
| 163 | 123 | return 0; |
| 164 | 124 | } |
| 125 | |
trunk/src/mame/video/tigeroad_spr.c
| r0 | r242127 | |
| 1 | /* |
| 2 | |
| 3 | very simple sprite scheme, used by some Capcom games and hardware cloned from them |
| 4 | |
| 5 | bionicc.c |
| 6 | tigeroad.c |
| 7 | supduck.c |
| 8 | |
| 9 | it is unknown if this is handled by a custom chip, or simple logic. |
| 10 | y positions are inverted in Bionic Commando, but it seems otherwise the same as |
| 11 | Tiger Road |
| 12 | |
| 13 | */ |
| 14 | |
| 15 | |
| 16 | #include "emu.h" |
| 17 | #include "tigeroad_spr.h" |
| 18 | |
| 19 | |
| 20 | const device_type TIGEROAD_SPRITE = &device_creator<tigeroad_spr_device>; |
| 21 | |
| 22 | tigeroad_spr_device::tigeroad_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 23 | : device_t(mconfig, TIGEROAD_SPRITE, "Simple Capcom (Tiger Road) Sprite", tag, owner, clock, "tigeroad_spr", __FILE__) |
| 24 | { |
| 25 | } |
| 26 | |
| 27 | |
| 28 | void tigeroad_spr_device::device_start() |
| 29 | { |
| 30 | } |
| 31 | |
| 32 | |
| 33 | |
| 34 | void tigeroad_spr_device::device_reset() |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | /* |
| 39 | 4 words per sprite |
| 40 | |
| 41 | 0 ---- ---t tttt tttt = tile number |
| 42 | |
| 43 | 1 ---- ---- --cc cc-- = colour |
| 44 | 1 ---- ---- ---- --x- = flip x |
| 45 | 1 ---- ---- ---- ---y = flip y |
| 46 | |
| 47 | 2 ---- ---x xxxx xxxx = x pos (signed) |
| 48 | |
| 49 | 3 ---- ---y yyyy yyyy = y pos (signed) |
| 50 | |
| 51 | */ |
| 52 | |
| 53 | |
| 54 | void tigeroad_spr_device::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int region, UINT16* ram, UINT32 size, int flip_screen, int rev_y ) |
| 55 | { |
| 56 | UINT16 *source = &ram[size/2] - 4; |
| 57 | UINT16 *finish = ram; |
| 58 | |
| 59 | while (source >= finish) |
| 60 | { |
| 61 | int tile_number = source[0]; |
| 62 | |
| 63 | int attr = source[1]; |
| 64 | int sy = source[2] & 0x1ff; |
| 65 | int sx = source[3] & 0x1ff; |
| 66 | |
| 67 | int flipx = attr & 0x02; |
| 68 | int flipy = attr & 0x01; |
| 69 | int color = (attr >> 2) & 0x0f; |
| 70 | |
| 71 | if (sx > 0x100) sx -= 0x200; |
| 72 | if (sy > 0x100) sy -= 0x200; |
| 73 | |
| 74 | if (flip_screen) |
| 75 | { |
| 76 | sx = 240 - sx; |
| 77 | sy = 240 - sy; |
| 78 | flipx = !flipx; |
| 79 | flipy = !flipy; |
| 80 | } |
| 81 | |
| 82 | if (rev_y) |
| 83 | sy = 240 - sy; |
| 84 | |
| 85 | |
| 86 | gfxdecode->gfx(region)->transpen(bitmap,cliprect, |
| 87 | tile_number, |
| 88 | color, |
| 89 | flipx, flipy, |
| 90 | sx, sy, 15); |
| 91 | |
| 92 | source -= 4; |
| 93 | } |
| 94 | } |