mirror of
https://github.com/holub/mame
synced 2025-10-05 16:50:57 +03:00
Modernization of drivers part 9 (no whatsnew)
This commit is contained in:
parent
64763777a1
commit
285f060f02
@ -1440,12 +1440,12 @@ DRIVER_INIT_MEMBER(jack_state,zzyzzyxx)
|
||||
}
|
||||
|
||||
|
||||
static void treahunt_decode( running_machine &machine )
|
||||
void jack_state::treahunt_decode( )
|
||||
{
|
||||
int A;
|
||||
address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
|
||||
UINT8 *rom = machine.root_device().memregion("maincpu")->base();
|
||||
UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x4000);
|
||||
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||
UINT8 *rom = machine().root_device().memregion("maincpu")->base();
|
||||
UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x4000);
|
||||
int data;
|
||||
|
||||
space.set_decrypted_region(0x0000, 0x3fff, decrypt);
|
||||
@ -1488,7 +1488,7 @@ static void treahunt_decode( running_machine &machine )
|
||||
DRIVER_INIT_MEMBER(jack_state,treahunt)
|
||||
{
|
||||
m_timer_rate = 256;
|
||||
treahunt_decode(machine());
|
||||
treahunt_decode();
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,7 +137,7 @@ WRITE8_MEMBER(jackal_state::jackal_zram_w)
|
||||
WRITE8_MEMBER(jackal_state::jackal_voram_w)
|
||||
{
|
||||
if ((offset & 0xf800) == 0)
|
||||
jackal_mark_tile_dirty(machine(), offset & 0x3ff);
|
||||
jackal_mark_tile_dirty(offset & 0x3ff);
|
||||
|
||||
m_rambank[0x2000 + offset] = data;
|
||||
}
|
||||
|
@ -434,14 +434,14 @@ void jaguar_state::machine_reset()
|
||||
*
|
||||
********************************************************************/
|
||||
/*
|
||||
static emu_file *jaguar_nvram_fopen( running_machine &machine, UINT32 openflags)
|
||||
emu_file jaguar_state::*jaguar_nvram_fopen( UINT32 openflags)
|
||||
{
|
||||
device_image_interface *image = dynamic_cast<device_image_interface *>(machine.device("cart"));
|
||||
device_image_interface *image = dynamic_cast<device_image_interface *>(machine().device("cart"));
|
||||
file_error filerr;
|
||||
emu_file *file;
|
||||
if (image->exists())
|
||||
{
|
||||
astring fname(machine.system().name, PATH_SEPARATOR, image->basename_noext(), ".nv");
|
||||
astring fname(machine().system().name, PATH_SEPARATOR, image->basename_noext(), ".nv");
|
||||
filerr = mame_fopen( SEARCHPATH_NVRAM, fname, openflags, &file);
|
||||
return (filerr == FILERR_NONE) ? file : NULL;
|
||||
}
|
||||
@ -449,12 +449,12 @@ static emu_file *jaguar_nvram_fopen( running_machine &machine, UINT32 openflags)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void jaguar_nvram_load(running_machine &machine)
|
||||
void jaguar_state::jaguar_nvram_load()
|
||||
{
|
||||
emu_file *nvram_file = NULL;
|
||||
device_t *device;
|
||||
|
||||
for (device = machine.m_devicelist.first(); device != NULL; device = device->next())
|
||||
for (device = machine().m_devicelist.first(); device != NULL; device = device->next())
|
||||
{
|
||||
device_nvram_func nvram = (device_nvram_func)device->get_config_fct(DEVINFO_FCT_NVRAM);
|
||||
if (nvram != NULL)
|
||||
@ -469,12 +469,12 @@ static void jaguar_nvram_load(running_machine &machine)
|
||||
}
|
||||
|
||||
|
||||
static void jaguar_nvram_save(running_machine &machine)
|
||||
void jaguar_state::jaguar_nvram_save()
|
||||
{
|
||||
emu_file *nvram_file = NULL;
|
||||
device_t *device;
|
||||
|
||||
for (device = machine.m_devicelist.first(); device != NULL; device = device->next())
|
||||
for (device = machine().m_devicelist.first(); device != NULL; device = device->next())
|
||||
{
|
||||
device_nvram_func nvram = (device_nvram_func)device->get_config_fct(DEVINFO_FCT_NVRAM);
|
||||
if (nvram != NULL)
|
||||
|
@ -129,11 +129,10 @@ Thanks to Tony Friery and JPeMU for I/O routines and documentation.
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void update_irqs(running_machine &machine)
|
||||
void jpmimpct_state::update_irqs()
|
||||
{
|
||||
jpmimpct_state *state = machine.driver_data<jpmimpct_state>();
|
||||
machine.device("maincpu")->execute().set_input_line(2, state->m_tms_irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
machine.device("maincpu")->execute().set_input_line(5, state->m_duart_1_irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
machine().device("maincpu")->execute().set_input_line(2, m_tms_irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
machine().device("maincpu")->execute().set_input_line(5, m_duart_1_irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -220,7 +219,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(jpmimpct_state::duart_1_timer_event)
|
||||
m_duart_1.ISR |= 0x08;
|
||||
|
||||
m_duart_1_irq = 1;
|
||||
update_irqs(machine());
|
||||
update_irqs();
|
||||
}
|
||||
|
||||
READ16_MEMBER(jpmimpct_state::duart_1_r)
|
||||
@ -279,7 +278,7 @@ READ16_MEMBER(jpmimpct_state::duart_1_r)
|
||||
case 0xf:
|
||||
{
|
||||
m_duart_1_irq = 0;
|
||||
update_irqs(machine());
|
||||
update_irqs();
|
||||
duart_1.ISR |= ~0x8;
|
||||
break;
|
||||
}
|
||||
@ -844,7 +843,7 @@ static void jpmimpct_tms_irq(device_t *device, int state)
|
||||
{
|
||||
jpmimpct_state *drvstate = device->machine().driver_data<jpmimpct_state>();
|
||||
drvstate->m_tms_irq = state;
|
||||
update_irqs(device->machine());
|
||||
drvstate->update_irqs();
|
||||
}
|
||||
|
||||
static const tms34010_config tms_config =
|
||||
|
@ -72,4 +72,7 @@ public:
|
||||
virtual void video_start();
|
||||
|
||||
INTERRUPT_GEN_MEMBER(joinem_vblank_irq);
|
||||
void jack_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void joinem_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void treahunt_decode( );
|
||||
};
|
||||
|
@ -44,6 +44,11 @@ public:
|
||||
virtual void palette_init();
|
||||
UINT32 screen_update_jackal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(jackal_interrupt);
|
||||
void set_pens( );
|
||||
void jackal_mark_tile_dirty( int offset );
|
||||
void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void draw_sprites_region( bitmap_ind16 &bitmap, const rectangle &cliprect, const UINT8 *sram, int length, int bank );
|
||||
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
};
|
||||
|
||||
/*----------- defined in video/jackal.c -----------*/
|
||||
|
@ -311,4 +311,7 @@ protected:
|
||||
void blitter_01800001_xxxxxx_xxxxxx(UINT32 command, UINT32 a1flags, UINT32 a2flags);
|
||||
void blitter_x1800x01_xxxxxx_xxxxxx(UINT32 command, UINT32 a1flags, UINT32 a2flags);
|
||||
|
||||
emu_file *jaguar_nvram_fopen( UINT32 openflags);
|
||||
void jaguar_nvram_load();
|
||||
void jaguar_nvram_save();
|
||||
};
|
||||
|
@ -45,4 +45,5 @@ public:
|
||||
UINT32 screen_update_jailbrek(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(jb_interrupt);
|
||||
INTERRUPT_GEN_MEMBER(jb_interrupt_nmi);
|
||||
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
};
|
||||
|
@ -78,6 +78,10 @@ public:
|
||||
DECLARE_VIDEO_START(jedi);
|
||||
UINT32 screen_update_jedi(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
TIMER_CALLBACK_MEMBER(generate_interrupt);
|
||||
void get_pens(pen_t *pens);
|
||||
void do_pen_lookup(bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
void draw_background_and_text(bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
};
|
||||
|
||||
/*----------- defined in audio/jedi.c -----------*/
|
||||
|
@ -110,6 +110,7 @@ public:
|
||||
DECLARE_MACHINE_START(impctawp);
|
||||
DECLARE_MACHINE_RESET(impctawp);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(duart_1_timer_event);
|
||||
void update_irqs();
|
||||
};
|
||||
|
||||
|
||||
|
@ -67,13 +67,12 @@ void jack_state::video_start()
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
static void jack_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void jack_state::jack_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
jack_state *state = machine.driver_data<jack_state>();
|
||||
UINT8 *spriteram = state->m_spriteram;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
|
||||
for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
|
||||
{
|
||||
int sy = spriteram[offs];
|
||||
int sx = spriteram[offs + 1];
|
||||
@ -82,7 +81,7 @@ static void jack_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, c
|
||||
int flipx = (spriteram[offs + 3] & 0x80) >> 7;
|
||||
int flipy = (spriteram[offs + 3] & 0x40) >> 6;
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
sx = 248 - sx;
|
||||
sy = 248 - sy;
|
||||
@ -90,7 +89,7 @@ static void jack_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, c
|
||||
flipy = !flipy;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
|
||||
code,
|
||||
color,
|
||||
flipx,flipy,
|
||||
@ -101,7 +100,7 @@ static void jack_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, c
|
||||
UINT32 jack_state::screen_update_jack(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
jack_draw_sprites(machine(), bitmap, cliprect);
|
||||
jack_draw_sprites(bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -188,22 +187,21 @@ VIDEO_START_MEMBER(jack_state,joinem)
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
static void joinem_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void jack_state::joinem_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
jack_state *state = machine.driver_data<jack_state>();
|
||||
UINT8 *spriteram = state->m_spriteram;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
|
||||
for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
|
||||
{
|
||||
int sy = spriteram[offs];
|
||||
int sx = spriteram[offs + 1];
|
||||
int code = spriteram[offs + 2] | ((spriteram[offs + 3] & 0x03) << 8);
|
||||
int color = (spriteram[offs + 3] & 0x38) >> 3 | state->m_joinem_palette_bank;
|
||||
int color = (spriteram[offs + 3] & 0x38) >> 3 | m_joinem_palette_bank;
|
||||
int flipx = (spriteram[offs + 3] & 0x80) >> 7;
|
||||
int flipy = (spriteram[offs + 3] & 0x40) >> 6;
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
sx = 248 - sx;
|
||||
sy = 248 - sy;
|
||||
@ -211,7 +209,7 @@ static void joinem_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,
|
||||
flipy = !flipy;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
|
||||
code,
|
||||
color,
|
||||
flipx,flipy,
|
||||
@ -222,6 +220,6 @@ static void joinem_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,
|
||||
UINT32 jack_state::screen_update_joinem(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
joinem_draw_sprites(machine(), bitmap, cliprect);
|
||||
joinem_draw_sprites(bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -40,26 +40,24 @@ void jackal_state::palette_init()
|
||||
}
|
||||
|
||||
|
||||
static void set_pens( running_machine &machine )
|
||||
void jackal_state::set_pens( )
|
||||
{
|
||||
jackal_state *state = machine.driver_data<jackal_state>();
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 0x400; i += 2)
|
||||
{
|
||||
UINT16 data = state->m_paletteram[i] | (state->m_paletteram[i | 1] << 8);
|
||||
UINT16 data = m_paletteram[i] | (m_paletteram[i | 1] << 8);
|
||||
|
||||
rgb_t color = MAKE_RGB(pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10));
|
||||
|
||||
colortable_palette_set_color(machine.colortable, i >> 1, color);
|
||||
colortable_palette_set_color(machine().colortable, i >> 1, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void jackal_mark_tile_dirty( running_machine &machine, int offset )
|
||||
void jackal_state::jackal_mark_tile_dirty( int offset )
|
||||
{
|
||||
jackal_state *state = machine.driver_data<jackal_state>();
|
||||
state->m_bg_tilemap->mark_tile_dirty(offset);
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(jackal_state::get_bg_tile_info)
|
||||
@ -79,47 +77,45 @@ void jackal_state::video_start()
|
||||
m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(jackal_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
}
|
||||
|
||||
static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void jackal_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
jackal_state *state = machine.driver_data<jackal_state>();
|
||||
UINT8 *RAM = state->memregion("master")->base();
|
||||
UINT8 *RAM = memregion("master")->base();
|
||||
int i;
|
||||
|
||||
state->m_scrollram = &RAM[0x0020];
|
||||
m_scrollram = &RAM[0x0020];
|
||||
|
||||
state->m_bg_tilemap->set_scroll_rows(1);
|
||||
state->m_bg_tilemap->set_scroll_cols(1);
|
||||
m_bg_tilemap->set_scroll_rows(1);
|
||||
m_bg_tilemap->set_scroll_cols(1);
|
||||
|
||||
state->m_bg_tilemap->set_scrolly(0, state->m_videoctrl[0]);
|
||||
state->m_bg_tilemap->set_scrollx(0, state->m_videoctrl[1]);
|
||||
m_bg_tilemap->set_scrolly(0, m_videoctrl[0]);
|
||||
m_bg_tilemap->set_scrollx(0, m_videoctrl[1]);
|
||||
|
||||
if (state->m_videoctrl[2] & 0x02)
|
||||
if (m_videoctrl[2] & 0x02)
|
||||
{
|
||||
if (state->m_videoctrl[2] & 0x08)
|
||||
if (m_videoctrl[2] & 0x08)
|
||||
{
|
||||
state->m_bg_tilemap->set_scroll_rows(32);
|
||||
m_bg_tilemap->set_scroll_rows(32);
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
state->m_bg_tilemap->set_scrollx(i, state->m_scrollram[i]);
|
||||
m_bg_tilemap->set_scrollx(i, m_scrollram[i]);
|
||||
}
|
||||
|
||||
if (state->m_videoctrl[2] & 0x04)
|
||||
if (m_videoctrl[2] & 0x04)
|
||||
{
|
||||
state->m_bg_tilemap->set_scroll_cols(32);
|
||||
m_bg_tilemap->set_scroll_cols(32);
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
state->m_bg_tilemap->set_scrolly(i, state->m_scrollram[i]);
|
||||
m_bg_tilemap->set_scrolly(i, m_scrollram[i]);
|
||||
}
|
||||
}
|
||||
|
||||
state->m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
}
|
||||
|
||||
#define DRAW_SPRITE(bank, code, sx, sy) drawgfx_transpen(bitmap, cliprect, machine.gfx[bank], code, color, flipx, flipy, sx, sy, 0);
|
||||
#define DRAW_SPRITE(bank, code, sx, sy) drawgfx_transpen(bitmap, cliprect, machine().gfx[bank], code, color, flipx, flipy, sx, sy, 0);
|
||||
|
||||
static void draw_sprites_region( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, const UINT8 *sram, int length, int bank )
|
||||
void jackal_state::draw_sprites_region( bitmap_ind16 &bitmap, const rectangle &cliprect, const UINT8 *sram, int length, int bank )
|
||||
{
|
||||
jackal_state *state = machine.driver_data<jackal_state>();
|
||||
int offs;
|
||||
|
||||
for (offs = 0; offs < length; offs += 5)
|
||||
@ -138,7 +134,7 @@ static void draw_sprites_region( running_machine &machine, bitmap_ind16 &bitmap,
|
||||
if (sy > 0xf0)
|
||||
sy = sy - 256;
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
sx = 240 - sx;
|
||||
sy = 240 - sy;
|
||||
@ -151,7 +147,7 @@ static void draw_sprites_region( running_machine &machine, bitmap_ind16 &bitmap,
|
||||
int spritenum = sn1 * 4 + ((sn2 & (8 + 4)) >> 2) + ((sn2 & (2 + 1)) << 10);
|
||||
int mod = -8;
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
sx += 8;
|
||||
sy -= 8;
|
||||
@ -160,7 +156,7 @@ static void draw_sprites_region( running_machine &machine, bitmap_ind16 &bitmap,
|
||||
|
||||
if ((attr & 0x0C) == 0x0C)
|
||||
{
|
||||
if (state->flip_screen()) sy += 16;
|
||||
if (flip_screen()) sy += 16;
|
||||
DRAW_SPRITE(bank + 1, spritenum, sx, sy)
|
||||
}
|
||||
|
||||
@ -183,7 +179,7 @@ static void draw_sprites_region( running_machine &machine, bitmap_ind16 &bitmap,
|
||||
|
||||
if (attr & 0x10)
|
||||
{
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
sx -= 16;
|
||||
sy -= 16;
|
||||
@ -202,13 +198,12 @@ static void draw_sprites_region( running_machine &machine, bitmap_ind16 &bitmap,
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void jackal_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
jackal_state *state = machine.driver_data<jackal_state>();
|
||||
UINT8 *RAM = state->memregion("master")->base();
|
||||
UINT8 *RAM = memregion("master")->base();
|
||||
UINT8 *sr, *ss;
|
||||
|
||||
if (state->m_videoctrl[0x03] & 0x08)
|
||||
if (m_videoctrl[0x03] & 0x08)
|
||||
{
|
||||
sr = &RAM[0x03800]; // Sprite 2
|
||||
ss = &RAM[0x13800]; // Additional Sprite 2
|
||||
@ -219,14 +214,14 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
ss = &RAM[0x13000]; // Additional Sprite 1
|
||||
}
|
||||
|
||||
draw_sprites_region(machine, bitmap, cliprect, ss, 0x0f5, 3);
|
||||
draw_sprites_region(machine, bitmap, cliprect, sr, 0x500, 1);
|
||||
draw_sprites_region(bitmap, cliprect, ss, 0x0f5, 3);
|
||||
draw_sprites_region(bitmap, cliprect, sr, 0x500, 1);
|
||||
}
|
||||
|
||||
UINT32 jackal_state::screen_update_jackal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
set_pens(machine());
|
||||
draw_background(machine(), bitmap, cliprect);
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
set_pens();
|
||||
draw_background(bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -62,13 +62,12 @@ void jailbrek_state::video_start()
|
||||
m_bg_tilemap->set_scrolldx(0, 396 - 256);
|
||||
}
|
||||
|
||||
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void jailbrek_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
jailbrek_state *state = machine.driver_data<jailbrek_state>();
|
||||
UINT8 *spriteram = state->m_spriteram;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < state->m_spriteram.bytes(); i += 4)
|
||||
for (i = 0; i < m_spriteram.bytes(); i += 4)
|
||||
{
|
||||
int attr = spriteram[i + 1]; // attributes = ?tyxcccc
|
||||
int code = spriteram[i] + ((attr & 0x40) << 2);
|
||||
@ -78,7 +77,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
int sx = spriteram[i + 2] - ((attr & 0x80) << 1);
|
||||
int sy = spriteram[i + 3];
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
sx = 240 - sx;
|
||||
sy = 240 - sy;
|
||||
@ -86,9 +85,9 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
flipy = !flipy;
|
||||
}
|
||||
|
||||
drawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy,
|
||||
drawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy,
|
||||
sx, sy,
|
||||
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0));
|
||||
colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,6 +117,6 @@ UINT32 jailbrek_state::screen_update_jailbrek(screen_device &screen, bitmap_ind1
|
||||
}
|
||||
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ VIDEO_START_MEMBER(jedi_state,jedi)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void get_pens(jedi_state *state, pen_t *pens)
|
||||
void jedi_state::get_pens(pen_t *pens)
|
||||
{
|
||||
offs_t offs;
|
||||
|
||||
@ -71,7 +71,7 @@ static void get_pens(jedi_state *state, pen_t *pens)
|
||||
{
|
||||
int r, g, b, bits, intensity;
|
||||
|
||||
UINT16 color = state->m_paletteram[offs] | (state->m_paletteram[offs | 0x400] << 8);
|
||||
UINT16 color = m_paletteram[offs] | (m_paletteram[offs | 0x400] << 8);
|
||||
|
||||
intensity = (color >> 9) & 7;
|
||||
bits = (color >> 6) & 7;
|
||||
@ -86,12 +86,12 @@ static void get_pens(jedi_state *state, pen_t *pens)
|
||||
}
|
||||
|
||||
|
||||
static void do_pen_lookup(jedi_state *state, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
void jedi_state::do_pen_lookup(bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int y, x;
|
||||
pen_t pens[NUM_PENS];
|
||||
|
||||
get_pens(state, pens);
|
||||
get_pens(pens);
|
||||
|
||||
for (y = cliprect.min_y; y <= cliprect.max_y; y++)
|
||||
for(x = cliprect.min_x; x <= cliprect.max_x; x++)
|
||||
@ -126,20 +126,20 @@ WRITE8_MEMBER(jedi_state::jedi_hscroll_w)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void draw_background_and_text(running_machine &machine, jedi_state *state, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
void jedi_state::draw_background_and_text(bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int y;
|
||||
int background_line_buffer[0x200]; /* RAM chip at 2A */
|
||||
|
||||
UINT8 *tx_gfx = machine.root_device().memregion("gfx1")->base();
|
||||
UINT8 *bg_gfx = machine.root_device().memregion("gfx2")->base();
|
||||
UINT8 *prom1 = &machine.root_device().memregion("proms")->base()[0x0000 | ((*state->m_smoothing_table & 0x03) << 8)];
|
||||
UINT8 *prom2 = &machine.root_device().memregion("proms")->base()[0x0800 | ((*state->m_smoothing_table & 0x03) << 8)];
|
||||
int vscroll = state->m_vscroll;
|
||||
int hscroll = state->m_hscroll;
|
||||
int tx_bank = *state->m_foreground_bank;
|
||||
UINT8 *tx_ram = state->m_foregroundram;
|
||||
UINT8 *bg_ram = state->m_backgroundram;
|
||||
UINT8 *tx_gfx = machine().root_device().memregion("gfx1")->base();
|
||||
UINT8 *bg_gfx = machine().root_device().memregion("gfx2")->base();
|
||||
UINT8 *prom1 = &machine().root_device().memregion("proms")->base()[0x0000 | ((*m_smoothing_table & 0x03) << 8)];
|
||||
UINT8 *prom2 = &machine().root_device().memregion("proms")->base()[0x0800 | ((*m_smoothing_table & 0x03) << 8)];
|
||||
int vscroll = m_vscroll;
|
||||
int hscroll = m_hscroll;
|
||||
int tx_bank = *m_foreground_bank;
|
||||
UINT8 *tx_ram = m_foregroundram;
|
||||
UINT8 *bg_ram = m_backgroundram;
|
||||
|
||||
memset(background_line_buffer, 0, 0x200 * sizeof(int));
|
||||
|
||||
@ -226,11 +226,11 @@ static void draw_background_and_text(running_machine &machine, jedi_state *state
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void draw_sprites(running_machine &machine, jedi_state *state, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
void jedi_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
offs_t offs;
|
||||
UINT8 *spriteram = state->m_spriteram;
|
||||
UINT8 *gfx3 = machine.root_device().memregion("gfx3")->base();
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
UINT8 *gfx3 = machine().root_device().memregion("gfx3")->base();
|
||||
|
||||
for (offs = 0x00; offs < 0x30; offs++)
|
||||
{
|
||||
@ -330,9 +330,9 @@ UINT32 jedi_state::screen_update_jedi(screen_device &screen, bitmap_rgb32 &bitma
|
||||
{
|
||||
/* draw the background/text layers, followed by the sprites
|
||||
- it needs to be done in this order*/
|
||||
draw_background_and_text(machine(), this, bitmap, cliprect);
|
||||
draw_sprites(machine(), this, bitmap, cliprect);
|
||||
do_pen_lookup(this, bitmap, cliprect);
|
||||
draw_background_and_text(bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
do_pen_lookup(bitmap, cliprect);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user