Previous 199869 Revisions Next

r17911 Sunday 16th September, 2012 at 00:15:50 UTC by hap
improved gfx bankswitching
[src/mame/drivers]homerun.c
[src/mame/includes]homerun.h
[src/mame/video]homerun.c

trunk/src/mame/video/homerun.c
r17910r17911
88#include "includes/homerun.h"
99
1010
11#define half_screen 116
12
1311/**************************************************************************/
1412
1513WRITE8_MEMBER(homerun_state::homerun_scrollhi_w)
r17910r17911
3432WRITE8_DEVICE_HANDLER(homerun_banking_w)
3533{
3634   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;
4244   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);
4646}
4747
4848WRITE8_MEMBER(homerun_state::homerun_videoram_w)
r17910r17911
8989
9090TILE_GET_INFO_MEMBER(homerun_state::get_homerun_tile_info)
9191{
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);
9494
9595   SET_TILE_INFO_MEMBER(0, tileno, palno, 0);
9696}
r17910r17911
108108   UINT8 *spriteram = state->m_spriteram;
109109   int offs;
110110
111   for (offs = state->m_spriteram.bytes() - 4; offs >=0; offs -= 4)
111   for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
112112   {
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
120120      drawgfx_transpen(bitmap, cliprect, machine.gfx[1],
121121            code,
122122            color,
123123            flipx,flipy,
124124            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);
125132   }
126133}
127134
128135SCREEN_UPDATE_IND16(homerun)
129136{
130137   homerun_state *state = screen.machine().driver_data<homerun_state>();
131   rectangle myclip = cliprect;
132138
133   /* upper part */
134139   state->m_tilemap->set_scrolly(0, state->m_scrolly);
135140   state->m_tilemap->set_scrollx(0, state->m_scrollx);
136141
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);
141144
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;
150145   return 0;
151146}
trunk/src/mame/includes/homerun.h
r17910r17911
3030
3131   tilemap_t *m_tilemap;
3232   int m_gfx_ctrl;
33   int m_gc_up;
34   int m_gc_down;
3533   int m_scrollx;
3634   int m_scrolly;
3735   
trunk/src/mame/drivers/homerun.c
r17910r17911
1616Todo :
1717 - dump homerun sample rom
1818 - 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
2021
2122-----------------------------------
2223Moero!! Pro Yakyuu Homerun Kyousou
r17910r17911
123124
124125CUSTOM_INPUT_MEMBER(homerun_state::homerun_40_r)
125126{
127   // screen split location is a guess, but works in homerun
126128   UINT8 ret = (machine().primary_screen->vpos() > 116) ? 1 : 0;
127129
128130   return ret;
r17910r17911
269271
270272***************************************************************************/
271273
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
274275static const char *const homerun_sample_names[] =
275276{
276277   "*homerun",
r17910r17911
366367   save_item(NAME(m_control));
367368   save_item(NAME(m_sample));
368369   save_item(NAME(m_gfx_ctrl));
369   save_item(NAME(m_gc_up));
370   save_item(NAME(m_gc_down));
371370   save_item(NAME(m_scrolly));
372371   save_item(NAME(m_scrollx));
373372}
374373
375374void homerun_state::machine_reset()
376375{
377
378376   m_control = 0;
379377   m_sample = 0;
380378   m_gfx_ctrl = 0;
381   m_gc_up = 0;
382   m_gc_down = 0;
383379   m_scrolly = 0;
384380   m_scrollx = 0;
385381}
r17910r17911
401397   MCFG_SCREEN_ADD("screen", RASTER)
402398   MCFG_SCREEN_REFRESH_RATE(60)
403399   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)
406401   MCFG_SCREEN_UPDATE_STATIC(homerun)
407402
408403   MCFG_GFXDECODE(homerun)
409404   MCFG_PALETTE_LENGTH(16*4)
410405
411
412406   /* sound hardware */
413407   MCFG_SPEAKER_STANDARD_MONO("mono")
414408
r17910r17911
489483
490484GAME( 1988, homerun,  0, homerun,  homerun,  driver_device, 0, ROT0, "Jaleco", "Moero!! Pro Yakyuu Homerun Kyousou", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
491485GAME( 1988, dynashot, 0, dynashot, dynashot, driver_device, 0, ROT0, "Jaleco", "Dynamic Shoot Kyousou", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
492GAME( 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 )
486GAME( 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 )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team