trunk/src/mame/video/homerun.c
| r17910 | r17911 | |
| 8 | 8 | #include "includes/homerun.h" |
| 9 | 9 | |
| 10 | 10 | |
| 11 | | #define half_screen 116 |
| 12 | | |
| 13 | 11 | /**************************************************************************/ |
| 14 | 12 | |
| 15 | 13 | WRITE8_MEMBER(homerun_state::homerun_scrollhi_w) |
| r17910 | r17911 | |
| 34 | 32 | WRITE8_DEVICE_HANDLER(homerun_banking_w) |
| 35 | 33 | { |
| 36 | 34 | homerun_state *state = device->machine().driver_data<homerun_state>(); |
| 37 | | if (device->machine().primary_screen->vpos() > half_screen) |
| 38 | | state->m_gc_down = data & 3; |
| 39 | | else |
| 40 | | state->m_gc_up = data & 3; |
| 41 | | |
| 35 | |
| 36 | // games do mid-screen gfx bank switching |
| 37 | int vpos = device->machine().primary_screen->vpos(); |
| 38 | device->machine().primary_screen->update_partial(vpos); |
| 39 | |
| 40 | // d0-d1: gfx bank |
| 41 | // d2-d4: ? |
| 42 | // d5-d7: prg bank |
| 43 | state->m_gfx_ctrl = data; |
| 42 | 44 | state->m_tilemap->mark_all_dirty(); |
| 43 | | |
| 44 | | data >>= 5; |
| 45 | | state->membank("bank1")->set_entry(data & 0x07); |
| 45 | state->membank("bank1")->set_entry(data >> 5 & 7); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | WRITE8_MEMBER(homerun_state::homerun_videoram_w) |
| r17910 | r17911 | |
| 89 | 89 | |
| 90 | 90 | TILE_GET_INFO_MEMBER(homerun_state::get_homerun_tile_info) |
| 91 | 91 | { |
| 92 | | int tileno = (m_videoram[tile_index]) + ((m_videoram[tile_index + 0x1000] & 0x38) << 5) + ((m_gfx_ctrl & 1) << 11); |
| 93 | | int palno = (m_videoram[tile_index + 0x1000] & 0x07); |
| 92 | int tileno = (m_videoram[tile_index]) | ((m_videoram[tile_index | 0x1000] & 0x38) << 5) | ((m_gfx_ctrl & 1) << 11); |
| 93 | int palno = (m_videoram[tile_index | 0x1000] & 0x07); |
| 94 | 94 | |
| 95 | 95 | SET_TILE_INFO_MEMBER(0, tileno, palno, 0); |
| 96 | 96 | } |
| r17910 | r17911 | |
| 108 | 108 | UINT8 *spriteram = state->m_spriteram; |
| 109 | 109 | int offs; |
| 110 | 110 | |
| 111 | | for (offs = state->m_spriteram.bytes() - 4; offs >=0; offs -= 4) |
| 111 | for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4) |
| 112 | 112 | { |
| 113 | | int code, color, sx, sy, flipx, flipy; |
| 114 | | sx = spriteram[offs + 3]; |
| 115 | | sy = spriteram[offs + 0] - 16; |
| 116 | | code = (spriteram[offs + 1]) + ((spriteram[offs + 2] & 0x8) << 5) + (state->m_gfx_ctrl << 9); |
| 117 | | color = (spriteram[offs + 2] & 0x7) + 8 ; |
| 118 | | flipx=(spriteram[offs + 2] & 0x40) ; |
| 119 | | flipy=(spriteram[offs + 2] & 0x80) ; |
| 113 | int sx = spriteram[offs + 3]; |
| 114 | int sy = spriteram[offs + 0] - 16; |
| 115 | int code = (spriteram[offs + 1]) | ((spriteram[offs + 2] & 0x8) << 5) | ((state->m_gfx_ctrl & 3) << 9); |
| 116 | int color = (spriteram[offs + 2] & 0x07) | 8; |
| 117 | int flipx = (spriteram[offs + 2] & 0x40) >> 6; |
| 118 | int flipy = (spriteram[offs + 2] & 0x80) >> 7; |
| 119 | |
| 120 | 120 | drawgfx_transpen(bitmap, cliprect, machine.gfx[1], |
| 121 | 121 | code, |
| 122 | 122 | color, |
| 123 | 123 | flipx,flipy, |
| 124 | 124 | sx,sy,0); |
| 125 | |
| 126 | // wraparound |
| 127 | drawgfx_transpen(bitmap, cliprect, machine.gfx[1], |
| 128 | code, |
| 129 | color, |
| 130 | flipx,flipy, |
| 131 | sx-256,sy,0); |
| 125 | 132 | } |
| 126 | 133 | } |
| 127 | 134 | |
| 128 | 135 | SCREEN_UPDATE_IND16(homerun) |
| 129 | 136 | { |
| 130 | 137 | homerun_state *state = screen.machine().driver_data<homerun_state>(); |
| 131 | | rectangle myclip = cliprect; |
| 132 | 138 | |
| 133 | | /* upper part */ |
| 134 | 139 | state->m_tilemap->set_scrolly(0, state->m_scrolly); |
| 135 | 140 | state->m_tilemap->set_scrollx(0, state->m_scrollx); |
| 136 | 141 | |
| 137 | | myclip.max_y /= 2; |
| 138 | | state->m_gfx_ctrl = state->m_gc_up; |
| 139 | | state->m_tilemap->draw(bitmap, myclip, 0, 0); |
| 140 | | draw_sprites(screen.machine(), bitmap, myclip); |
| 142 | state->m_tilemap->draw(bitmap, cliprect, 0, 0); |
| 143 | draw_sprites(screen.machine(), bitmap, cliprect); |
| 141 | 144 | |
| 142 | | /* lower part */ |
| 143 | | myclip.min_y += myclip.max_y; |
| 144 | | myclip.max_y *= 2; |
| 145 | | state->m_gfx_ctrl = state->m_gc_down; |
| 146 | | state->m_tilemap->draw(bitmap, myclip, 0, 0); |
| 147 | | draw_sprites(screen.machine(), bitmap, myclip); |
| 148 | | |
| 149 | | state->m_gc_down = state->m_gc_up; |
| 150 | 145 | return 0; |
| 151 | 146 | } |
trunk/src/mame/drivers/homerun.c
| r17910 | r17911 | |
| 16 | 16 | Todo : |
| 17 | 17 | - dump homerun sample rom |
| 18 | 18 | - improve controls/dips |
| 19 | | - better emulation of gfx bank switching (problematic in ganjaja) |
| 19 | - fix sprite glitches in ganjaja Hop Step & Jump |
| 20 | - fix missing water tiles in ganjaja Hop Step & Jump |
| 20 | 21 | |
| 21 | 22 | ----------------------------------- |
| 22 | 23 | Moero!! Pro Yakyuu Homerun Kyousou |
| r17910 | r17911 | |
| 123 | 124 | |
| 124 | 125 | CUSTOM_INPUT_MEMBER(homerun_state::homerun_40_r) |
| 125 | 126 | { |
| 127 | // screen split location is a guess, but works in homerun |
| 126 | 128 | UINT8 ret = (machine().primary_screen->vpos() > 116) ? 1 : 0; |
| 127 | 129 | |
| 128 | 130 | return ret; |
| r17910 | r17911 | |
| 269 | 271 | |
| 270 | 272 | ***************************************************************************/ |
| 271 | 273 | |
| 272 | | // homerun samples, note that this is the complete rom contents |
| 273 | | // not all samples are used in this game |
| 274 | // homerun samples, note that this is the complete rom contents; not all samples are used in this game |
| 274 | 275 | static const char *const homerun_sample_names[] = |
| 275 | 276 | { |
| 276 | 277 | "*homerun", |
| r17910 | r17911 | |
| 366 | 367 | save_item(NAME(m_control)); |
| 367 | 368 | save_item(NAME(m_sample)); |
| 368 | 369 | save_item(NAME(m_gfx_ctrl)); |
| 369 | | save_item(NAME(m_gc_up)); |
| 370 | | save_item(NAME(m_gc_down)); |
| 371 | 370 | save_item(NAME(m_scrolly)); |
| 372 | 371 | save_item(NAME(m_scrollx)); |
| 373 | 372 | } |
| 374 | 373 | |
| 375 | 374 | void homerun_state::machine_reset() |
| 376 | 375 | { |
| 377 | | |
| 378 | 376 | m_control = 0; |
| 379 | 377 | m_sample = 0; |
| 380 | 378 | m_gfx_ctrl = 0; |
| 381 | | m_gc_up = 0; |
| 382 | | m_gc_down = 0; |
| 383 | 379 | m_scrolly = 0; |
| 384 | 380 | m_scrollx = 0; |
| 385 | 381 | } |
| r17910 | r17911 | |
| 401 | 397 | MCFG_SCREEN_ADD("screen", RASTER) |
| 402 | 398 | MCFG_SCREEN_REFRESH_RATE(60) |
| 403 | 399 | MCFG_SCREEN_SIZE(256, 256) |
| 404 | | MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-25) |
| 405 | | //MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 400 | MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) |
| 406 | 401 | MCFG_SCREEN_UPDATE_STATIC(homerun) |
| 407 | 402 | |
| 408 | 403 | MCFG_GFXDECODE(homerun) |
| 409 | 404 | MCFG_PALETTE_LENGTH(16*4) |
| 410 | 405 | |
| 411 | | |
| 412 | 406 | /* sound hardware */ |
| 413 | 407 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 414 | 408 | |
| r17910 | r17911 | |
| 489 | 483 | |
| 490 | 484 | GAME( 1988, homerun, 0, homerun, homerun, driver_device, 0, ROT0, "Jaleco", "Moero!! Pro Yakyuu Homerun Kyousou", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 491 | 485 | GAME( 1988, dynashot, 0, dynashot, dynashot, driver_device, 0, ROT0, "Jaleco", "Dynamic Shoot Kyousou", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| 492 | | GAME( 1990, ganjaja, 0, ganjaja, ganjaja, driver_device, 0, ROT0, "Jaleco", "Ganbare Jajamaru Saisho wa Goo / Ganbare Jajamaru Hop Step & Jump", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| 486 | GAME( 1990, ganjaja, 0, ganjaja, ganjaja, driver_device, 0, ROT0, "Jaleco", "Ganbare Jajamaru Saisho wa Goo / Ganbare Jajamaru Hop Step & Jump", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |