trunk/src/mame/drivers/prehisle.c
| r241913 | r241914 | |
| 100 | 100 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:1") |
| 101 | 101 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 102 | 102 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 103 | | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Level_Select ) ) PORT_DIPLOCATION("SW1:2") |
| 103 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Level_Select ) ) PORT_DIPLOCATION("SW1:2") |
| 104 | 104 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 105 | 105 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 106 | 106 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:3") |
| r241913 | r241914 | |
| 126 | 126 | PORT_DIPSETTING( 0x03, DEF_STR( Standard ) ) |
| 127 | 127 | PORT_DIPSETTING( 0x01, "Middle" ) |
| 128 | 128 | PORT_DIPSETTING( 0x00, DEF_STR( Difficult ) ) |
| 129 | | PORT_DIPNAME( 0x0c, 0x0c, "Game Mode" ) PORT_DIPLOCATION("SW2:3,4") |
| 129 | PORT_DIPNAME( 0x0c, 0x0c, "Game Mode" ) PORT_DIPLOCATION("SW2:3,4") |
| 130 | 130 | PORT_DIPSETTING( 0x08, "Demo Sounds Off" ) |
| 131 | 131 | PORT_DIPSETTING( 0x0c, "Demo Sounds On" ) |
| 132 | 132 | PORT_DIPSETTING( 0x00, "Freeze" ) |
| r241913 | r241914 | |
| 136 | 136 | PORT_DIPSETTING( 0x20, "150K 300K" ) |
| 137 | 137 | PORT_DIPSETTING( 0x10, "300K 500K" ) |
| 138 | 138 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 139 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:7") |
| 139 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:7") |
| 140 | 140 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 141 | 141 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) |
| 142 | 142 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") |
trunk/src/mame/video/prehisle.c
| r241913 | r241914 | |
| 27 | 27 | switch (offset) |
| 28 | 28 | { |
| 29 | 29 | case 0x08: return ioport("P2")->read(); // Player 2 |
| 30 | | case 0x10: return ioport("COIN")->read(); // Coins, Tilt, Service |
| 31 | | case 0x20: return ioport("P1")->read() ^ m_invert_controls; // Player 1 |
| 32 | | case 0x21: return ioport("DSW0")->read(); // DIPs |
| 33 | | case 0x22: return ioport("DSW1")->read(); // DIPs + VBLANK |
| 30 | case 0x10: return ioport("COIN")->read(); // Coins, Tilt, Service |
| 31 | case 0x20: return ioport("P1")->read() ^ m_invert_controls; // Player 1 |
| 32 | case 0x21: return ioport("DSW0")->read(); // DIPs |
| 33 | case 0x22: return ioport("DSW1")->read(); // DIPs + VBLANK |
| 34 | 34 | default: return 0; |
| 35 | 35 | } |
| 36 | 36 | } |
| r241913 | r241914 | |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | /* tile layout |
| 58 | 0 xxxx.... color |
| 59 | 0 ....x... flip x |
| 60 | 0 .....xxx gfx code high bits |
| 61 | 1 xxxxxxxx gfx code low bits |
| 62 | */ |
| 57 | 63 | TILE_GET_INFO_MEMBER(prehisle_state::get_bg2_tile_info) |
| 58 | 64 | { |
| 59 | | UINT8 *tilerom = memregion("gfx5")->base(); |
| 65 | UINT8 const *const tilerom = memregion("gfx5")->base(); |
| 60 | 66 | |
| 61 | | int offs = tile_index * 2; |
| 62 | | int attr = tilerom[offs + 1] + (tilerom[offs] << 8); |
| 63 | | int code = (attr & 0x7ff) | 0x800; |
| 64 | | int color = attr >> 12; |
| 65 | | int flags = (attr & 0x800) ? TILE_FLIPX : 0; |
| 67 | int const offs = tile_index * 2; |
| 68 | int const attr = tilerom[offs + 1] + (tilerom[offs] << 8); |
| 69 | int const code = (attr & 0x7ff) | 0x800; |
| 70 | int const color = attr >> 12; |
| 71 | int const flags = (attr & 0x800) ? TILE_FLIPX : 0; |
| 66 | 72 | |
| 67 | 73 | SET_TILE_INFO_MEMBER(1, code, color, flags); |
| 68 | 74 | } |
| 69 | 75 | |
| 76 | /* tile layout |
| 77 | 0 xxxx.... ........ color |
| 78 | 0 ....x... ........ flip y |
| 79 | 0 .....xxx xxxxxxxx gfx code |
| 80 | */ |
| 70 | 81 | TILE_GET_INFO_MEMBER(prehisle_state::get_bg_tile_info) |
| 71 | 82 | { |
| 72 | | int attr = m_bg_videoram16[tile_index]; |
| 73 | | int code = attr & 0x7ff; |
| 74 | | int color = attr >> 12; |
| 75 | | int flags = (attr & 0x800) ? TILE_FLIPY : 0; |
| 83 | int const attr = m_bg_videoram16[tile_index]; |
| 84 | int const code = attr & 0x7ff; |
| 85 | int const color = attr >> 12; |
| 86 | int const flags = (attr & 0x800) ? TILE_FLIPY : 0; |
| 76 | 87 | |
| 77 | 88 | SET_TILE_INFO_MEMBER(2, code, color, flags); |
| 78 | 89 | } |
| 79 | 90 | |
| 91 | /* tile layout |
| 92 | 0 xxxx.... ........ color |
| 93 | 0 ....xxxx xxxxxxxx gfx code |
| 94 | */ |
| 80 | 95 | TILE_GET_INFO_MEMBER(prehisle_state::get_fg_tile_info) |
| 81 | 96 | { |
| 82 | | int attr = m_videoram[tile_index]; |
| 83 | | int code = attr & 0xfff; |
| 84 | | int color = attr >> 12; |
| 97 | int const attr = m_videoram[tile_index]; |
| 98 | int const code = attr & 0xfff; |
| 99 | int const color = attr >> 12; |
| 85 | 100 | |
| 86 | 101 | SET_TILE_INFO_MEMBER(0, code, color, 0); |
| 87 | 102 | } |
| 88 | 103 | |
| 89 | 104 | void prehisle_state::video_start() |
| 90 | 105 | { |
| 91 | | m_bg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(prehisle_state::get_bg2_tile_info),this), TILEMAP_SCAN_COLS, |
| 92 | | 16, 16, 1024, 32); |
| 106 | // ROM-based background layer |
| 107 | m_bg2_tilemap = &machine().tilemap().create( |
| 108 | m_gfxdecode, |
| 109 | tilemap_get_info_delegate(FUNC(prehisle_state::get_bg2_tile_info), this), |
| 110 | TILEMAP_SCAN_COLS, // scan order |
| 111 | 16, 16, // tile size |
| 112 | 1024, 32); // tilemap size |
| 93 | 113 | |
| 94 | | m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(prehisle_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, |
| 95 | | 16, 16, 256, 32); |
| 114 | // RAM-based background layer (overlays most sprites) |
| 115 | m_bg_tilemap = &machine().tilemap().create( |
| 116 | m_gfxdecode, |
| 117 | tilemap_get_info_delegate(FUNC(prehisle_state::get_bg_tile_info), this), |
| 118 | TILEMAP_SCAN_COLS, // scan order |
| 119 | 16, 16, // tile size |
| 120 | 256, 32); // tilemap size |
| 121 | m_bg_tilemap->set_transparent_pen(15); |
| 96 | 122 | |
| 97 | | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(prehisle_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, |
| 98 | | 8, 8, 32, 32); |
| 99 | | |
| 100 | | m_bg_tilemap->set_transparent_pen(15); |
| 123 | // text layer |
| 124 | m_fg_tilemap = &machine().tilemap().create( |
| 125 | m_gfxdecode, |
| 126 | tilemap_get_info_delegate(FUNC(prehisle_state::get_fg_tile_info), this), |
| 127 | TILEMAP_SCAN_ROWS, // scan order |
| 128 | 8, 8, // tile size |
| 129 | 32, 32); // tilemap size |
| 101 | 130 | m_fg_tilemap->set_transparent_pen(15); |
| 102 | 131 | |
| 103 | 132 | /* register for saving */ |
| r241913 | r241914 | |
| 105 | 134 | } |
| 106 | 135 | |
| 107 | 136 | /* sprite layout |
| 108 | | o fedcba9876543210 |
| 109 | 137 | |
| 110 | | 0 .......xxxxxxxxx y, other bits unused? |
| 111 | | 1 .......xxxxxxxxx x, other bits unused? |
| 112 | | |
| 113 | | 2 ...xxxxxxxxxxxxx code |
| 114 | | 2 ..x............. ? |
| 115 | | 2 .x.............. flipx |
| 116 | | 2 x............... flipy |
| 117 | | |
| 118 | | 3 xxxx............ color+priority, other bits unknown |
| 138 | 0 .......x xxxxxxxx y, other bits unused? |
| 139 | 1 .......x xxxxxxxx x, other bits unused? |
| 140 | 2 x....... ........ flip y |
| 141 | 2 .x...... ........ flip x |
| 142 | 2 ..x..... ........ ? |
| 143 | 2 ...xxxxx xxxxxxxx gfx code |
| 144 | 3 xxxx.... ........ color+priority, other bits unknown |
| 119 | 145 | */ |
| 120 | | void prehisle_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int foreground ) |
| 146 | void prehisle_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 121 | 147 | { |
| 122 | | UINT16 *spriteram16 = m_spriteram; |
| 123 | | int offs; |
| 148 | UINT16 const *const spriteram16 = m_spriteram; |
| 124 | 149 | |
| 125 | | for (offs = 0; offs < 1024; offs += 4) |
| 150 | for (int offs = 0; offs < 1024; offs += 4) |
| 126 | 151 | { |
| 127 | | int attr = spriteram16[offs + 2]; |
| 128 | | int code = attr & 0x1fff; |
| 129 | | int color = spriteram16[offs + 3] >> 12; |
| 130 | | int priority = (color < 0x4); // correct? |
| 131 | | int flipx = attr & 0x4000; |
| 132 | | int flipy = attr & 0x8000; |
| 133 | | int sx = spriteram16[offs + 1]&0x1ff; |
| 134 | | int sy = spriteram16[offs]&0x1ff; |
| 152 | int const attr = spriteram16[offs + 2]; |
| 153 | int const code = attr & 0x1fff; |
| 154 | int const color = spriteram16[offs + 3] >> 12; |
| 155 | int const priority = (color < 0x4) ? 0x04 : 0x06; |
| 156 | bool flipx = attr & 0x4000; |
| 157 | bool flipy = attr & 0x8000; |
| 158 | int sx = spriteram16[offs + 1] & 0x1ff; |
| 159 | int sy = spriteram16[offs] & 0x1ff; |
| 135 | 160 | |
| 136 | 161 | // coordinates are 9-bit signed |
| 137 | | if (sx&0x100) sx=-0x100+(sx&0xff); |
| 138 | | if (sy&0x100) sy=-0x100+(sy&0xff); |
| 162 | if (sx & 0x100) sx = -0x100 + (sx & 0xff); |
| 163 | if (sy & 0x100) sy = -0x100 + (sy & 0xff); |
| 139 | 164 | |
| 140 | 165 | if (flip_screen()) |
| 141 | 166 | { |
| r241913 | r241914 | |
| 145 | 170 | flipy = !flipy; |
| 146 | 171 | } |
| 147 | 172 | |
| 148 | | if ((foreground && priority) || (!foreground && !priority)) |
| 149 | | { |
| 150 | | m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, code, color, flipx, flipy, sx, sy, 15); |
| 151 | | } |
| 173 | m_gfxdecode->gfx(3)->prio_transpen( |
| 174 | bitmap, cliprect, |
| 175 | code, color, |
| 176 | flipx, flipy, |
| 177 | sx, sy, |
| 178 | screen.priority(), priority, |
| 179 | 15); // transparent pen |
| 152 | 180 | } |
| 153 | 181 | } |
| 154 | 182 | |
| 155 | 183 | UINT32 prehisle_state::screen_update_prehisle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 156 | 184 | { |
| 185 | screen.priority().fill(0, cliprect); |
| 186 | |
| 157 | 187 | m_bg2_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 158 | | draw_sprites(bitmap, cliprect, 0); |
| 159 | | m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 160 | | draw_sprites(bitmap, cliprect, 1); |
| 161 | | m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 188 | m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1); |
| 189 | m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2); |
| 190 | draw_sprites(screen, bitmap, cliprect); |
| 191 | |
| 162 | 192 | return 0; |
| 163 | 193 | } |