Modernization of drivers part 17 (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2013-02-12 10:43:35 +00:00
parent 4a8e6794a0
commit a2a7ff5a58
29 changed files with 296 additions and 289 deletions

View File

@ -573,9 +573,9 @@ READ16_MEMBER(raiden_state::sub_cpu_spin_r)
/* This is based on code by Niclas Karlsson Mate, who figured out the
encryption method! The technique is a combination of a XOR table plus
bit-swapping */
static void common_decrypt(running_machine &machine)
void raiden_state::common_decrypt()
{
UINT16 *RAM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
UINT16 *RAM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
int i;
for (i = 0; i < 0x20000; i++)
@ -587,7 +587,7 @@ static void common_decrypt(running_machine &machine)
RAM[0xc0000/2 + i] = data;
}
RAM = (UINT16 *)machine.root_device().memregion("sub")->base();
RAM = (UINT16 *)machine().root_device().memregion("sub")->base();
for (i = 0; i < 0x20000; i++)
{
@ -612,14 +612,14 @@ DRIVER_INIT_MEMBER(raiden_state,raidena)
DRIVER_INIT_MEMBER(raiden_state,raiden)
{
DRIVER_INIT_CALL(raidena);
common_decrypt(machine());
common_decrypt();
seibu_sound_decrypt(machine(),"audiocpu",0x20000);
}
DRIVER_INIT_MEMBER(raiden_state,raidenk)
{
DRIVER_INIT_CALL(raidena);
common_decrypt(machine());
common_decrypt();
}
DRIVER_INIT_MEMBER(raiden_state,raidenu)

View File

@ -141,14 +141,14 @@ Current Problem(s) - in order of priority
#include "sound/okim6295.h"
#include "includes/raiden2.h"
static UINT16 rps(running_machine &machine)
UINT16 raiden2_state::rps()
{
return machine.device("maincpu")->state().state_int(NEC_CS);
return machine().device("maincpu")->state().state_int(NEC_CS);
}
static UINT16 rpc(running_machine &machine)
UINT16 raiden2_state::rpc()
{
return machine.device("maincpu")->state().state_int(NEC_IP);
return machine().device("maincpu")->state().state_int(NEC_IP);
}
WRITE16_MEMBER(raiden2_state::cop_pgm_data_w)
@ -300,7 +300,7 @@ WRITE16_MEMBER(raiden2_state::cop_pal_brightness_val_w)
}
/* RE from Seibu Cup Soccer bootleg */
static const UINT8 fade_table(int v)
const UINT8 raiden2_state::fade_table(int v)
{
int low = v & 0x001f;
int high = v & 0x03e0;
@ -691,7 +691,7 @@ WRITE16_MEMBER(raiden2_state::cop_cmd_w)
break;
default:
logerror("pcall %04x (%04x:%04x) [%x %x %x %x]\n", data, rps(space.machine()), rpc(space.machine()), cop_regs[0], cop_regs[1], cop_regs[2], cop_regs[3]);
logerror("pcall %04x (%04x:%04x) [%x %x %x %x]\n", data, rps(), rpc(), cop_regs[0], cop_regs[1], cop_regs[2], cop_regs[3]);
}
}
@ -700,7 +700,7 @@ WRITE16_MEMBER(raiden2_state::cop_cmd_w)
// space.machine().root_device().membank("bank1")->set_entry((data >> 15) & 1);
static void combine32(UINT32 *val, int offset, UINT16 data, UINT16 mem_mask)
void raiden2_state::combine32(UINT32 *val, int offset, UINT16 data, UINT16 mem_mask)
{
UINT16 *dest = (UINT16 *)val + BYTE_XOR_LE(offset);
COMBINE_DATA(dest);
@ -1055,7 +1055,7 @@ static UINT16 sprcpt_flags2;
static UINT32 sprcpt_val[2], sprcpt_flags1;
static UINT32 sprcpt_data_1[0x100], sprcpt_data_2[0x40], sprcpt_data_3[6], sprcpt_data_4[4];
static void sprcpt_init(void)
void raiden2_state::sprcpt_init(void)
{
memset(sprcpt_data_1, 0, sizeof(sprcpt_data_1));
memset(sprcpt_data_2, 0, sizeof(sprcpt_data_2));

View File

@ -856,7 +856,7 @@ DRIVER_INIT_MEMBER(rbisland_state,rbisland)
machine().root_device().membank("bank1")->configure_entries(0, 4, &ROM[0xc000], 0x4000);
rbisland_cchip_init(machine(), 0);
rbisland_cchip_init(0);
}
DRIVER_INIT_MEMBER(rbisland_state,rbislande)
@ -865,7 +865,7 @@ DRIVER_INIT_MEMBER(rbisland_state,rbislande)
machine().root_device().membank("bank1")->configure_entries(0, 4, &ROM[0xc000], 0x4000);
rbisland_cchip_init(machine(), 1);
rbisland_cchip_init(1);
}
DRIVER_INIT_MEMBER(rbisland_state,jumping)

View File

@ -41,4 +41,6 @@ public:
DECLARE_VIDEO_START(raidena);
UINT32 screen_update_raiden(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(raiden_interrupt);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri_mask);
void common_decrypt();
};

View File

@ -152,6 +152,11 @@ public:
DECLARE_MACHINE_RESET(raidendx);
UINT32 screen_update_raiden2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(raiden2_interrupt);
UINT16 rps();
UINT16 rpc();
const UINT8 fade_table(int v);
void combine32(UINT32 *val, int offset, UINT16 data, UINT16 mem_mask);
void sprcpt_init(void);
};
/*----------- defined in machine/r2crypt.c -----------*/

View File

@ -50,6 +50,10 @@ public:
UINT32 screen_update_rainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_jumping(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(cchip_timer);
void request_round_data( );
void request_world_data( );
void request_goalin_data( );
void rbisland_cchip_init( int version );
};
/*----------- defined in machine/rainbow.c -----------*/

View File

@ -66,4 +66,15 @@ public:
UINT32 screen_update_locomotn(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(rallyx_vblank_irq);
INTERRUPT_GEN_MEMBER(jungler_vblank_irq);
inline void rallyx_get_tile_info( tile_data &tileinfo, int tile_index, int ram_offs);
inline void locomotn_get_tile_info(tile_data &tileinfo,int tile_index,int ram_offs);
void calculate_star_field( );
void rallyx_video_start_common( );
void plot_star( bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, int color );
void draw_stars( bitmap_ind16 &bitmap, const rectangle &cliprect );
void rallyx_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement );
void locomotn_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement );
void rallyx_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen );
void jungler_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen );
void locomotn_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen );
};

View File

@ -23,4 +23,5 @@ public:
DECLARE_MACHINE_RESET(rampart);
DECLARE_VIDEO_START(rampart);
UINT32 screen_update_rampart(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void rampart_bitmap_render(bitmap_ind16 &bitmap, const rectangle &cliprect);
};

View File

@ -47,4 +47,6 @@ public:
UINT32 screen_update_realbrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_dai2kaku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(realbrk_interrupt);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
void dai2kaku_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer);
};

View File

@ -48,6 +48,8 @@ public:
DECLARE_WRITE8_MEMBER(demoneye_ay8910_latch_1_w);
DECLARE_READ8_MEMBER(demoneye_ay8910_latch_2_r);
DECLARE_WRITE8_MEMBER(demoneye_ay8910_data_w);
void get_pens(pen_t *pens);
void get_panther_pens(pen_t *pens);
};
/*----------- defined in audio/redalert.c -----------*/

View File

@ -75,4 +75,5 @@ public:
UINT32 screen_update_renegade(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(renegade_interrupt);
void setbank();
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
};

View File

@ -64,4 +64,5 @@ public:
UINT32 screen_update_retofinv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(main_vblank_irq);
INTERRUPT_GEN_MEMBER(sub_vblank_irq);
void draw_sprites(bitmap_ind16 &bitmap);
};

View File

@ -30,4 +30,5 @@ public:
virtual void palette_init();
UINT32 screen_update_rocnrope(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_irq);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
};

View File

@ -66,6 +66,7 @@ public:
UINT32 screen_update_rohga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_wizdfire(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
UINT32 screen_update_nitrobal(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void mixwizdfirelayer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int gfxregion, UINT16 pri, UINT16 primask);
};
/*----------- defined in video/rohga.c -----------*/
UINT16 rohga_pri_callback(UINT16 x);

View File

@ -31,4 +31,7 @@ public:
UINT32 screen_update_route16(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
UINT32 screen_update_stratvox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
UINT32 screen_update_ttmahjng(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
pen_t route16_make_pen(UINT8 color);
pen_t ttmajng_make_pen(UINT8 color);
int video_update_stratvox_ttmahjng(bitmap_rgb32 &bitmap,const rectangle &cliprect,pen_t (route16_state::*make_pen)(UINT8));
};

View File

@ -43,4 +43,6 @@ public:
UINT32 screen_update_rpunch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(sound_command_w_callback);
TIMER_CALLBACK_MEMBER(crtc_interrupt_gen);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int start, int stop);
void draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect);
};

View File

@ -642,35 +642,33 @@ static const UINT32 cchip_round_address[] =
0x042C60, 0x042D38
};
static void request_round_data( running_machine &machine )
void rbisland_state::request_round_data( )
{
rbisland_state *state = machine.driver_data<rbisland_state>();
int round = state->m_CRAM[1][0x141]; /* 0...49 */
int round = m_CRAM[1][0x141]; /* 0...49 */
memcpy(state->m_CRAM[1], CROM_BANK1, sizeof CROM_BANK1);
memcpy(state->m_CRAM[2], CROM_BANK2, sizeof CROM_BANK2);
memcpy(m_CRAM[1], CROM_BANK1, sizeof CROM_BANK1);
memcpy(m_CRAM[2], CROM_BANK2, sizeof CROM_BANK2);
state->m_CRAM[1][1] = cchip_round_height[round] >> 0;
state->m_CRAM[1][2] = cchip_round_height[round] >> 8;
m_CRAM[1][1] = cchip_round_height[round] >> 0;
m_CRAM[1][2] = cchip_round_height[round] >> 8;
state->m_CRAM[1][0x142] = cchip_round_address[round] >> 24;
state->m_CRAM[1][0x143] = cchip_round_address[round] >> 16;
state->m_CRAM[1][0x144] = cchip_round_address[round] >> 8;
state->m_CRAM[1][0x145] = cchip_round_address[round] >> 0;
m_CRAM[1][0x142] = cchip_round_address[round] >> 24;
m_CRAM[1][0x143] = cchip_round_address[round] >> 16;
m_CRAM[1][0x144] = cchip_round_address[round] >> 8;
m_CRAM[1][0x145] = cchip_round_address[round] >> 0;
/* set the secret room or boss flag */
state->m_CRAM[1][0x148] = (round >= 40 || round % 4 == 3);
m_CRAM[1][0x148] = (round >= 40 || round % 4 == 3);
}
static void request_world_data( running_machine &machine )
void rbisland_state::request_world_data( )
{
rbisland_state *state = machine.driver_data<rbisland_state>();
int world = state->m_CRAM[0][0x00d] / 4; /* 0...9 */
int world = m_CRAM[0][0x00d] / 4; /* 0...9 */
/* the extra version has the world data swapped around */
if (state->m_extra_version)
if (m_extra_version)
{
static const UINT8 world_swap[] =
{
@ -682,13 +680,13 @@ static void request_world_data( running_machine &machine )
/* first two bytes in each bank are left unchanged */
memcpy(state->m_CRAM[4] + 2, CROM_BANK4[world].data, CROM_BANK4[world].size);
memcpy(state->m_CRAM[5] + 2, CROM_BANK5[world].data, CROM_BANK5[world].size);
memcpy(state->m_CRAM[7] + 2, CROM_BANK7[world].data, CROM_BANK7[world].size);
memcpy(m_CRAM[4] + 2, CROM_BANK4[world].data, CROM_BANK4[world].size);
memcpy(m_CRAM[5] + 2, CROM_BANK5[world].data, CROM_BANK5[world].size);
memcpy(m_CRAM[7] + 2, CROM_BANK7[world].data, CROM_BANK7[world].size);
/* banks 5 and 6 are different in the extra version */
if (state->m_extra_version)
if (m_extra_version)
{
int i;
@ -698,58 +696,57 @@ static void request_world_data( running_machine &machine )
if (patch != 0)
{
state->m_CRAM[5][state->m_CRAM[5][2] + 22 * i + 18] = patch >> 0;
state->m_CRAM[5][state->m_CRAM[5][2] + 22 * i + 19] = patch >> 8;
m_CRAM[5][m_CRAM[5][2] + 22 * i + 18] = patch >> 0;
m_CRAM[5][m_CRAM[5][2] + 22 * i + 19] = patch >> 8;
}
}
memcpy(state->m_CRAM[6] + 2, CROM_BANK6_EXTRA, sizeof CROM_BANK6_EXTRA);
memcpy(m_CRAM[6] + 2, CROM_BANK6_EXTRA, sizeof CROM_BANK6_EXTRA);
}
else
{
memcpy(state->m_CRAM[6] + 2, CROM_BANK6, sizeof CROM_BANK6);
memcpy(m_CRAM[6] + 2, CROM_BANK6, sizeof CROM_BANK6);
}
}
static void request_goalin_data( running_machine &machine )
void rbisland_state::request_goalin_data( )
{
rbisland_state *state = machine.driver_data<rbisland_state>();
int n = machine.rand() % 15;
int n = machine().rand() % 15;
state->m_CRAM[1][0x14B] = 0x00; /* x coordinates */
state->m_CRAM[1][0x14D] = 0x10;
state->m_CRAM[1][0x14F] = 0x20;
state->m_CRAM[1][0x151] = 0x38;
state->m_CRAM[1][0x153] = 0x50;
state->m_CRAM[1][0x155] = 0x60;
m_CRAM[1][0x14B] = 0x00; /* x coordinates */
m_CRAM[1][0x14D] = 0x10;
m_CRAM[1][0x14F] = 0x20;
m_CRAM[1][0x151] = 0x38;
m_CRAM[1][0x153] = 0x50;
m_CRAM[1][0x155] = 0x60;
state->m_CRAM[1][0x14A] = cchip_goalin[n][0]; /* y coordinates */
state->m_CRAM[1][0x14C] = cchip_goalin[n][1];
state->m_CRAM[1][0x14E] = cchip_goalin[n][2];
state->m_CRAM[1][0x150] = cchip_goalin[n][3];
state->m_CRAM[1][0x152] = cchip_goalin[n][4];
state->m_CRAM[1][0x154] = cchip_goalin[n][5];
m_CRAM[1][0x14A] = cchip_goalin[n][0]; /* y coordinates */
m_CRAM[1][0x14C] = cchip_goalin[n][1];
m_CRAM[1][0x14E] = cchip_goalin[n][2];
m_CRAM[1][0x150] = cchip_goalin[n][3];
m_CRAM[1][0x152] = cchip_goalin[n][4];
m_CRAM[1][0x154] = cchip_goalin[n][5];
}
TIMER_CALLBACK_MEMBER(rbisland_state::cchip_timer)
{
if (m_CRAM[1][0x100] == 1)
{
request_round_data(machine());
request_round_data();
m_CRAM[1][0x100] = 0xFF;
}
if (m_CRAM[5][0x000] == 1)
{
request_world_data(machine());
request_world_data();
m_CRAM[5][0x000] = 0xFF;
}
if (m_CRAM[1][0x149] == 1)
{
request_goalin_data(machine());
request_goalin_data();
m_CRAM[1][0x149] = 0xFF;
}
@ -812,21 +809,20 @@ READ16_MEMBER(rbisland_state::rbisland_cchip_ram_r)
*
*************************************/
void rbisland_cchip_init( running_machine &machine, int version )
void rbisland_state::rbisland_cchip_init( int version )
{
rbisland_state *state = machine.driver_data<rbisland_state>();
int i;
state->m_extra_version = version;
m_extra_version = version;
for (i = 0; i < 8; i++)
{
state->m_CRAM[i] = auto_alloc_array(machine, UINT8, 0x400);
m_CRAM[i] = auto_alloc_array(machine(), UINT8, 0x400);
state_save_register_item_pointer(machine, "cchip", NULL, i, state->m_CRAM[i], 0x400);
state_save_register_item_pointer(machine(), "cchip", NULL, i, m_CRAM[i], 0x400);
}
state_save_register_item(machine, "cchip", NULL, 0, state->m_current_bank);
state_save_register_item(machine(), "cchip", NULL, 0, m_current_bank);
machine.scheduler().timer_pulse(attotime::from_hz(60), timer_expired_delegate(FUNC(rbisland_state::cchip_timer),state));
machine().scheduler().timer_pulse(attotime::from_hz(60), timer_expired_delegate(FUNC(rbisland_state::cchip_timer),this));
}

View File

@ -132,7 +132,6 @@ WRITE8_MEMBER(quizdna_state::paletteram_xBGR_RRRR_GGGG_BBBB_w)
void quizdna_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
//OBRISI.ME
UINT8 *spriteram = m_spriteram;
int offs;

View File

@ -109,10 +109,9 @@ WRITE16_MEMBER(raiden_state::raidena_control_w)
}
}
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri_mask)
void raiden_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri_mask)
{
raiden_state *state = machine.driver_data<raiden_state>();
UINT16 *buffered_spriteram16 = state->m_spriteram->buffer();
UINT16 *buffered_spriteram16 = m_spriteram->buffer();
int offs,fx,fy,x,y,color,sprite;
for (offs = 0x1000/2-4;offs >= 0;offs -= 4)
@ -130,14 +129,14 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
x = buffered_spriteram16[offs+2] & 0xff;
if (buffered_spriteram16[offs+2] & 0x100) x=0-(0x100-x);
if (state->m_flipscreen) {
if (m_flipscreen) {
x=240-x;
y=240-y;
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
}
drawgfx_transpen(bitmap,cliprect,machine.gfx[3],
drawgfx_transpen(bitmap,cliprect,machine().gfx[3],
sprite,
color,fx,fy,x,y,15);
}
@ -162,11 +161,11 @@ UINT32 raiden_state::screen_update_raiden(screen_device &screen, bitmap_ind16 &b
m_bg_layer->draw(bitmap, cliprect, 0,0);
/* Draw sprites underneath foreground */
draw_sprites(machine(),bitmap,cliprect,0x40);
draw_sprites(bitmap,cliprect,0x40);
m_fg_layer->draw(bitmap, cliprect, 0,0);
/* Rest of sprites */
draw_sprites(machine(),bitmap,cliprect,0x80);
draw_sprites(bitmap,cliprect,0x80);
/* Text layer */
m_tx_layer->draw(bitmap, cliprect, 0,0);

View File

@ -222,37 +222,35 @@ TILEMAP_MAPPER_MEMBER(rallyx_state::fg_tilemap_scan)
}
INLINE void rallyx_get_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index, int ram_offs)
inline void rallyx_state::rallyx_get_tile_info( tile_data &tileinfo, int tile_index, int ram_offs)
{
rallyx_state *state = machine.driver_data<rallyx_state>();
UINT8 attr = state->m_videoram[ram_offs + tile_index + 0x800];
UINT8 attr = m_videoram[ram_offs + tile_index + 0x800];
tileinfo.category = (attr & 0x20) >> 5;
SET_TILE_INFO(
SET_TILE_INFO_MEMBER(
0,
state->m_videoram[ram_offs + tile_index],
m_videoram[ram_offs + tile_index],
attr & 0x3f,
TILE_FLIPYX(attr >> 6) ^ TILE_FLIPX);
}
TILE_GET_INFO_MEMBER(rallyx_state::rallyx_bg_get_tile_info)
{
rallyx_get_tile_info(machine(), tileinfo, tile_index, 0x400);
rallyx_get_tile_info(tileinfo, tile_index, 0x400);
}
TILE_GET_INFO_MEMBER(rallyx_state::rallyx_fg_get_tile_info)
{
rallyx_get_tile_info(machine(), tileinfo, tile_index, 0x000);
rallyx_get_tile_info(tileinfo, tile_index, 0x000);
}
INLINE void locomotn_get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_index,int ram_offs)
inline void rallyx_state::locomotn_get_tile_info(tile_data &tileinfo,int tile_index,int ram_offs)
{
rallyx_state *state = machine.driver_data<rallyx_state>();
UINT8 attr = state->m_videoram[ram_offs + tile_index + 0x800];
int code = state->m_videoram[ram_offs + tile_index];
UINT8 attr = m_videoram[ram_offs + tile_index + 0x800];
int code = m_videoram[ram_offs + tile_index];
code = (code & 0x7f) + 2 * (attr & 0x40) + 2 * (code & 0x80);
tileinfo.category = (attr & 0x20) >> 5;
SET_TILE_INFO(
SET_TILE_INFO_MEMBER(
0,
code,
attr & 0x3f,
@ -261,12 +259,12 @@ INLINE void locomotn_get_tile_info(running_machine &machine,tile_data &tileinfo,
TILE_GET_INFO_MEMBER(rallyx_state::locomotn_bg_get_tile_info)
{
locomotn_get_tile_info(machine(), tileinfo, tile_index, 0x400);
locomotn_get_tile_info(tileinfo, tile_index, 0x400);
}
TILE_GET_INFO_MEMBER(rallyx_state::locomotn_fg_get_tile_info)
{
locomotn_get_tile_info(machine(), tileinfo, tile_index, 0x000);
locomotn_get_tile_info(tileinfo, tile_index, 0x000);
}
@ -277,14 +275,13 @@ TILE_GET_INFO_MEMBER(rallyx_state::locomotn_fg_get_tile_info)
***************************************************************************/
static void calculate_star_field( running_machine &machine )
void rallyx_state::calculate_star_field( )
{
rallyx_state *state = machine.driver_data<rallyx_state>();
int generator;
int x, y;
/* precalculate the star background */
state->m_total_stars = 0;
m_total_stars = 0;
generator = 0;
for (y = 0; y < 256; y++)
@ -304,39 +301,38 @@ static void calculate_star_field( running_machine &machine )
{
int color = (~(generator >> 8)) & 0x3f;
if (color && state->m_total_stars < JUNGLER_MAX_STARS)
if (color && m_total_stars < JUNGLER_MAX_STARS)
{
state->m_stars[state->m_total_stars].x = x;
state->m_stars[state->m_total_stars].y = y;
state->m_stars[state->m_total_stars].color = color;
m_stars[m_total_stars].x = x;
m_stars[m_total_stars].y = y;
m_stars[m_total_stars].color = color;
state->m_total_stars++;
m_total_stars++;
}
}
}
}
}
static void rallyx_video_start_common( running_machine &machine )
void rallyx_state::rallyx_video_start_common( )
{
rallyx_state *state = machine.driver_data<rallyx_state>();
int i;
state->m_spriteram = state->m_videoram + 0x00;
state->m_spriteram2 = state->m_spriteram + 0x800;
state->m_radarx = state->m_videoram + 0x20;
state->m_radary = state->m_radarx + 0x800;
m_spriteram = m_videoram + 0x00;
m_spriteram2 = m_spriteram + 0x800;
m_radarx = m_videoram + 0x20;
m_radary = m_radarx + 0x800;
for (i = 0; i < 16; i++)
machine.shadow_table[i] = i + 16;
machine().shadow_table[i] = i + 16;
for (i = 16; i < 32; i++)
machine.shadow_table[i] = i;
machine().shadow_table[i] = i;
for (i = 0; i < 3; i++)
state->m_drawmode_table[i] = DRAWMODE_SHADOW;
m_drawmode_table[i] = DRAWMODE_SHADOW;
state->m_drawmode_table[3] = DRAWMODE_NONE;
m_drawmode_table[3] = DRAWMODE_NONE;
}
VIDEO_START_MEMBER(rallyx_state,rallyx)
@ -349,7 +345,7 @@ VIDEO_START_MEMBER(rallyx_state,rallyx)
m_spriteram_base = 0x14;
rallyx_video_start_common(machine());
rallyx_video_start_common();
}
@ -360,8 +356,8 @@ VIDEO_START_MEMBER(rallyx_state,jungler)
m_spriteram_base = 0x14;
rallyx_video_start_common(machine());
calculate_star_field(machine());
rallyx_video_start_common();
calculate_star_field();
}
@ -379,8 +375,8 @@ VIDEO_START_MEMBER(rallyx_state,locomotn)
m_spriteram_base = 0x14;
rallyx_video_start_common(machine());
calculate_star_field(machine());
rallyx_video_start_common();
calculate_star_field();
}
@ -399,8 +395,8 @@ VIDEO_START_MEMBER(rallyx_state,commsega)
/* commsega has more sprites and bullets than the other games */
m_spriteram_base = 0x00;
rallyx_video_start_common(machine());
calculate_star_field(machine());
rallyx_video_start_common();
calculate_star_field();
}
@ -435,155 +431,148 @@ WRITE8_MEMBER(rallyx_state::tactcian_starson_w)
}
static void plot_star( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, int color )
void rallyx_state::plot_star( bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, int color )
{
if (!cliprect.contains(x, y))
return;
rallyx_state *state = machine.driver_data<rallyx_state>();
if (state->flip_screen_x())
if (flip_screen_x())
x = 255 - x;
if (state->flip_screen_y())
if (flip_screen_y())
y = 255 - y;
if (colortable_entry_get_value(machine.colortable, bitmap.pix16(y, x) % 0x144) == 0)
if (colortable_entry_get_value(machine().colortable, bitmap.pix16(y, x) % 0x144) == 0)
bitmap.pix16(y, x) = STARS_COLOR_BASE + color;
}
static void draw_stars( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void rallyx_state::draw_stars( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
rallyx_state *state = machine.driver_data<rallyx_state>();
int offs;
for (offs = 0; offs < state->m_total_stars; offs++)
for (offs = 0; offs < m_total_stars; offs++)
{
int x = state->m_stars[offs].x;
int y = state->m_stars[offs].y;
int x = m_stars[offs].x;
int y = m_stars[offs].y;
if ((y & 0x01) ^ ((x >> 3) & 0x01))
plot_star(machine, bitmap, cliprect, x, y, state->m_stars[offs].color);
plot_star(bitmap, cliprect, x, y, m_stars[offs].color);
}
}
static void rallyx_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement )
void rallyx_state::rallyx_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement )
{
rallyx_state *state = machine.driver_data<rallyx_state>();
UINT8 *spriteram = state->m_spriteram;
UINT8 *spriteram_2 = state->m_spriteram2;
UINT8 *spriteram = m_spriteram;
UINT8 *spriteram_2 = m_spriteram2;
int offs;
for (offs = 0x20 - 2; offs >= state->m_spriteram_base; offs -= 2)
for (offs = 0x20 - 2; offs >= m_spriteram_base; offs -= 2)
{
int sx = spriteram[offs + 1] + ((spriteram_2[offs + 1] & 0x80) << 1) - displacement;
int sy = 241 - spriteram_2[offs] - displacement;
int color = spriteram_2[offs + 1] & 0x3f;
int flipx = spriteram[offs] & 1;
int flipy = spriteram[offs] & 2;
if (state->flip_screen())
if (flip_screen())
sx -= 2 * displacement;
pdrawgfx_transmask(bitmap,cliprect,machine.gfx[1],
pdrawgfx_transmask(bitmap,cliprect,machine().gfx[1],
(spriteram[offs] & 0xfc) >> 2,
color,
flipx,flipy,
sx,sy,
machine.priority_bitmap,0x02,
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0));
machine().priority_bitmap,0x02,
colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0));
}
}
static void locomotn_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement )
void rallyx_state::locomotn_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement )
{
rallyx_state *state = machine.driver_data<rallyx_state>();
UINT8 *spriteram = state->m_spriteram;
UINT8 *spriteram_2 = state->m_spriteram2;
UINT8 *spriteram = m_spriteram;
UINT8 *spriteram_2 = m_spriteram2;
int offs;
for (offs = 0x20 - 2; offs >= state->m_spriteram_base; offs -= 2)
for (offs = 0x20 - 2; offs >= m_spriteram_base; offs -= 2)
{
int sx = spriteram[offs + 1] + ((spriteram_2[offs + 1] & 0x80) << 1);
int sy = 241 - spriteram_2[offs] - displacement;
int color = spriteram_2[offs + 1] & 0x3f;
int flip = spriteram[offs] & 2;
pdrawgfx_transmask(bitmap,cliprect,machine.gfx[1],
pdrawgfx_transmask(bitmap,cliprect,machine().gfx[1],
((spriteram[offs] & 0x7c) >> 2) + 0x20*(spriteram[offs] & 0x01) + ((spriteram[offs] & 0x80) >> 1),
color,
flip,flip,
sx,sy,
machine.priority_bitmap,0x02,
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0));
machine().priority_bitmap,0x02,
colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0));
}
}
static void rallyx_draw_bullets( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen )
void rallyx_state::rallyx_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen )
{
rallyx_state *state = machine.driver_data<rallyx_state>();
int offs;
for (offs = state->m_spriteram_base; offs < 0x20; offs++)
for (offs = m_spriteram_base; offs < 0x20; offs++)
{
int x, y;
x = state->m_radarx[offs] + ((~state->m_radarattr[offs & 0x0f] & 0x01) << 8);
y = 253 - state->m_radary[offs];
if (state->flip_screen())
x = m_radarx[offs] + ((~m_radarattr[offs & 0x0f] & 0x01) << 8);
y = 253 - m_radary[offs];
if (flip_screen())
x -= 3;
if (transpen)
drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
((state->m_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07,
drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
((m_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07,
0,
0,0,
x,y,
3);
else
drawgfx_transtable(bitmap,cliprect,machine.gfx[2],
((state->m_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07,
drawgfx_transtable(bitmap,cliprect,machine().gfx[2],
((m_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07,
0,
0,0,
x,y,
state->m_drawmode_table,machine.shadow_table);
m_drawmode_table,machine().shadow_table);
}
}
static void jungler_draw_bullets( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen )
void rallyx_state::jungler_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen )
{
rallyx_state *state = machine.driver_data<rallyx_state>();
int offs;
for (offs = state->m_spriteram_base; offs < 0x20; offs++)
for (offs = m_spriteram_base; offs < 0x20; offs++)
{
int x, y;
x = state->m_radarx[offs] + ((~state->m_radarattr[offs & 0x0f] & 0x08) << 5);
y = 253 - state->m_radary[offs];
x = m_radarx[offs] + ((~m_radarattr[offs & 0x0f] & 0x08) << 5);
y = 253 - m_radary[offs];
if (transpen)
drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
(state->m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
(m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
0,
0,0,
x,y,
3);
else
drawgfx_transtable(bitmap,cliprect,machine.gfx[2],
(state->m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
drawgfx_transtable(bitmap,cliprect,machine().gfx[2],
(m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
0,
0,0,
x,y,
state->m_drawmode_table,machine.shadow_table);
m_drawmode_table,machine().shadow_table);
}
}
static void locomotn_draw_bullets( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen )
void rallyx_state::locomotn_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen )
{
rallyx_state *state = machine.driver_data<rallyx_state>();
int offs;
for (offs = state->m_spriteram_base; offs < 0x20; offs++)
for (offs = m_spriteram_base; offs < 0x20; offs++)
{
int x, y;
@ -595,23 +584,23 @@ static void locomotn_draw_bullets( running_machine &machine, bitmap_ind16 &bitma
so 8024-8033 and 8824-8833 are not used
*/
x = state->m_radarx[offs] + ((~state->m_radarattr[offs & 0x0f] & 0x08) << 5);
y = 252 - state->m_radary[offs];
x = m_radarx[offs] + ((~m_radarattr[offs & 0x0f] & 0x08) << 5);
y = 252 - m_radary[offs];
if (transpen)
drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
(state->m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
(m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
0,
0,0,
x,y,
3);
else
drawgfx_transtable(bitmap,cliprect,machine.gfx[2],
(state->m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
drawgfx_transtable(bitmap,cliprect,machine().gfx[2],
(m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
0,
0,0,
x,y,
state->m_drawmode_table,machine.shadow_table);
m_drawmode_table,machine().shadow_table);
}
}
@ -641,9 +630,9 @@ UINT32 rallyx_state::screen_update_rallyx(screen_device &screen, bitmap_ind16 &b
m_bg_tilemap->draw(bitmap, bg_clip, 1, 1);
m_fg_tilemap->draw(bitmap, fg_clip, 1, 1);
rallyx_draw_bullets(machine(), bitmap, cliprect, TRUE);
rallyx_draw_sprites(machine(), bitmap, cliprect, 1);
rallyx_draw_bullets(machine(), bitmap, cliprect, FALSE);
rallyx_draw_bullets(bitmap, cliprect, TRUE);
rallyx_draw_sprites(bitmap, cliprect, 1);
rallyx_draw_bullets(bitmap, cliprect, FALSE);
return 0;
}
@ -675,12 +664,12 @@ UINT32 rallyx_state::screen_update_jungler(screen_device &screen, bitmap_ind16 &
m_bg_tilemap->draw(bitmap, bg_clip, 1, 0);
m_fg_tilemap->draw(bitmap, fg_clip, 1, 0);
jungler_draw_bullets(machine(), bitmap, cliprect, TRUE);
rallyx_draw_sprites(machine(), bitmap, cliprect, 0);
jungler_draw_bullets(machine(), bitmap, cliprect, FALSE);
jungler_draw_bullets(bitmap, cliprect, TRUE);
rallyx_draw_sprites(bitmap, cliprect, 0);
jungler_draw_bullets(bitmap, cliprect, FALSE);
if (m_stars_enable)
draw_stars(machine(), bitmap, cliprect);
draw_stars(bitmap, cliprect);
return 0;
}
@ -720,12 +709,12 @@ UINT32 rallyx_state::screen_update_locomotn(screen_device &screen, bitmap_ind16
m_bg_tilemap->draw(bitmap, bg_clip, 1, 1);
m_fg_tilemap->draw(bitmap, fg_clip, 1, 1);
locomotn_draw_bullets(machine(), bitmap, cliprect, TRUE);
locomotn_draw_sprites(machine(), bitmap, cliprect, 0);
locomotn_draw_bullets(machine(), bitmap, cliprect, FALSE);
locomotn_draw_bullets(bitmap, cliprect, TRUE);
locomotn_draw_sprites(bitmap, cliprect, 0);
locomotn_draw_bullets(bitmap, cliprect, FALSE);
if (m_stars_enable)
draw_stars(machine(), bitmap, cliprect);
draw_stars(bitmap, cliprect);
return 0;
}

View File

@ -9,9 +9,6 @@
#include "video/atarimo.h"
#include "includes/rampart.h"
static void rampart_bitmap_render(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
/*************************************
*
* Video system start
@ -79,7 +76,7 @@ UINT32 rampart_state::screen_update_rampart(screen_device &screen, bitmap_ind16
int x, y, r;
/* draw the playfield */
rampart_bitmap_render(machine(), bitmap, cliprect);
rampart_bitmap_render(bitmap, cliprect);
/* draw and merge the MO */
mobitmap = atarimo_render(0, cliprect, &rectlist);
@ -109,15 +106,14 @@ UINT32 rampart_state::screen_update_rampart(screen_device &screen, bitmap_ind16
*
*************************************/
static void rampart_bitmap_render(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
void rampart_state::rampart_bitmap_render(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
rampart_state *state = machine.driver_data<rampart_state>();
int x, y;
/* update any dirty scanlines */
for (y = cliprect.min_y; y <= cliprect.max_y; y++)
{
const UINT16 *src = &state->m_bitmap[256 * y];
const UINT16 *src = &m_bitmap[256 * y];
UINT16 *dst = &bitmap.pix16(y);
/* regenerate the line */

View File

@ -204,14 +204,13 @@ void realbrk_state::video_start()
***************************************************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
void realbrk_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
{
realbrk_state *state = machine.driver_data<realbrk_state>();
UINT16 *spriteram16 = state->m_spriteram;
UINT16 *spriteram16 = m_spriteram;
int offs;
int max_x = machine.primary_screen->width();
int max_y = machine.primary_screen->height();
int max_x = machine().primary_screen->width();
int max_y = machine().primary_screen->height();
rectangle spritetile_clip(0, 31, 0, 31);
@ -252,8 +251,8 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
xdim = ((zoom & 0x00ff) >> 0) << (16-6+4);
ydim = ((zoom & 0xff00) >> 8) << (16-6+4);
if (state->flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; }
if (state->flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; }
if (flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; }
if (flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; }
if (flipx) { xstart = xnum-1; xend = -1; xinc = -1; }
else { xstart = 0; xend = xnum; xinc = +1; }
@ -287,9 +286,9 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
// buffer the tile and rotate it into bitmap
if( rot )
{
state->m_tmpbitmap0->fill(0, spritetile_clip );
state->m_tmpbitmap1->fill(0, spritetile_clip );
drawgfxzoom_transpen( *state->m_tmpbitmap0,spritetile_clip,machine.gfx[gfx],
m_tmpbitmap0->fill(0, spritetile_clip );
m_tmpbitmap1->fill(0, spritetile_clip );
drawgfxzoom_transpen( *m_tmpbitmap0,spritetile_clip,machine().gfx[gfx],
code++,
color,
flipx, flipy,
@ -297,13 +296,13 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
(rot & 1 ? scaley : scalex) << 12, (rot & 1 ? scalex : scaley) << 12,0);
// peek at the unrotated sprite
// copybitmap_trans( bitmap,*state->m_tmpbitmap0, 0,0, 50+(x * xdim/0x10000),50+(y * ydim/0x10000), cliprect, 0 );
// copybitmap_trans( bitmap,*m_tmpbitmap0, 0,0, 50+(x * xdim/0x10000),50+(y * ydim/0x10000), cliprect, 0 );
}
switch( rot )
{
case 0x10: // rot 90
copyrozbitmap_trans( *state->m_tmpbitmap1, state->m_tmpbitmap1->cliprect(), *state->m_tmpbitmap0,
copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
(UINT32)0<<16,
(UINT32)16<<16,
0 << 16,
@ -315,11 +314,11 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
currx = (sx - (y+1) * ydim) / 0x10000;
curry = (sy + x * xdim) / 0x10000;
copybitmap_trans( bitmap,*state->m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
break;
case 0x20: // rot 180
copyrozbitmap_trans( *state->m_tmpbitmap1, state->m_tmpbitmap1->cliprect(), *state->m_tmpbitmap0,
copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
(UINT32)16<<16,
(UINT32)16<<16,
-1 << 16,
@ -331,11 +330,11 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
currx = (sx - (x+1) * xdim) / 0x10000;
curry = (sy - (y+1) * ydim) / 0x10000;
copybitmap_trans( bitmap,*state->m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
break;
case 0x30: // rot 270
copyrozbitmap_trans( *state->m_tmpbitmap1, state->m_tmpbitmap1->cliprect(), *state->m_tmpbitmap0,
copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
(UINT32)16<<16,
(UINT32)0<<16,
0 << 16,
@ -347,11 +346,11 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
currx = (sx + y * ydim) / 0x10000;
curry = (sy - (x+1) * xdim) / 0x10000;
copybitmap_trans( bitmap,*state->m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
break;
default:
drawgfxzoom_transpen( bitmap,cliprect,machine.gfx[gfx],
drawgfxzoom_transpen( bitmap,cliprect,machine().gfx[gfx],
code++,
color,
flipx, flipy,
@ -367,14 +366,13 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
/* DaiDaiKakumei */
/* layer : 0== bghigh<spr 1== bglow<spr<bghigh 2==spr<bglow 3==boarder */
static void dai2kaku_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect, int layer)
void realbrk_state::dai2kaku_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer)
{
realbrk_state *state = machine.driver_data<realbrk_state>();
UINT16 *spriteram16 = state->m_spriteram;
UINT16 *spriteram16 = m_spriteram;
int offs;
int max_x = machine.primary_screen->width();
int max_y = machine.primary_screen->height();
int max_x = machine().primary_screen->width();
int max_y = machine().primary_screen->height();
for ( offs = 0x3000/2; offs < 0x3600/2; offs += 2/2 )
{
@ -414,8 +412,8 @@ static void dai2kaku_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap
xdim = ((zoom & 0x00ff) >> 0) << (16-6+4);
ydim = ((zoom & 0xff00) >> 8) << (16-6+4);
if (state->flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; }
if (state->flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; }
if (flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; }
if (flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; }
if (flipx) { xstart = xnum-1; xend = -1; xinc = -1; }
else { xstart = 0; xend = xnum; xinc = +1; }
@ -433,7 +431,7 @@ static void dai2kaku_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap
int scalex = (sx + (x + 1) * xdim) / 0x10000 - currx;
int scaley = (sy + (y + 1) * ydim) / 0x10000 - curry;
drawgfxzoom_transpen( bitmap,cliprect,machine.gfx[gfx],
drawgfxzoom_transpen( bitmap,cliprect,machine().gfx[gfx],
code++,
color,
flipx, flipy,
@ -516,7 +514,7 @@ if ( machine().input().code_pressed(KEYCODE_Z) )
if (layers_ctrl & 2) m_tilemap_1->draw(bitmap, cliprect, 0,0);
if (layers_ctrl & 1) m_tilemap_0->draw(bitmap, cliprect, 0,0);
if (layers_ctrl & 8) draw_sprites(machine(),bitmap,cliprect);
if (layers_ctrl & 8) draw_sprites(bitmap,cliprect);
if (layers_ctrl & 4) m_tilemap_2->draw(bitmap, cliprect, 0,0);
@ -586,7 +584,7 @@ if ( machine().input().code_pressed(KEYCODE_Z) )
// spr 0
if (layers_ctrl & 8) dai2kaku_draw_sprites(machine(),bitmap,cliprect,2);
if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,2);
// bglow
if( m_vregs[8/2] & (0x8000)){
@ -596,7 +594,7 @@ if ( machine().input().code_pressed(KEYCODE_Z) )
}
// spr 1
if (layers_ctrl & 8) dai2kaku_draw_sprites(machine(),bitmap,cliprect,1);
if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,1);
// bghigh
if( m_vregs[8/2] & (0x8000)){
@ -606,7 +604,7 @@ if ( machine().input().code_pressed(KEYCODE_Z) )
}
// spr 2
if (layers_ctrl & 8) dai2kaku_draw_sprites(machine(),bitmap,cliprect,0);
if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,0);
// fix
if (layers_ctrl & 4) m_tilemap_2->draw(bitmap, cliprect, 0,0);

View File

@ -36,7 +36,7 @@ WRITE8_MEMBER(redalert_state::redalert_bitmap_videoram_w)
*
*************************************/
static void get_pens(running_machine &machine, pen_t *pens)
void redalert_state::get_pens(pen_t *pens)
{
static const int resistances_bitmap[] = { 100 };
static const int resistances_charmap_rg[] = { 390, 220, 180 };
@ -51,7 +51,7 @@ static void get_pens(running_machine &machine, pen_t *pens)
double charmap_b_weights[2];
double back_r_weight[1];
double back_gb_weight[1];
const UINT8 *prom = machine.root_device().memregion("proms")->base();
const UINT8 *prom = machine().root_device().memregion("proms")->base();
scaler = compute_resistor_weights(0, 0xff, -1,
1, resistances_bitmap, bitmap_weight, 470, 0,
@ -101,7 +101,7 @@ static void get_pens(running_machine &machine, pen_t *pens)
/* this uses the same color hook-up between bitmap and chars. */
/* TODO: clean me up */
static void get_panther_pens(running_machine &machine, pen_t *pens)
void redalert_state::get_panther_pens(pen_t *pens)
{
static const int resistances_bitmap[] = { 100 };
static const int resistances_charmap_rg[] = { 390, 220, 180 };
@ -116,7 +116,7 @@ static void get_panther_pens(running_machine &machine, pen_t *pens)
double charmap_b_weights[2];
double back_r_weight[1];
double back_gb_weight[1];
const UINT8 *prom = machine.root_device().memregion("proms")->base();
const UINT8 *prom = machine().root_device().memregion("proms")->base();
scaler = compute_resistor_weights(0, 0xff, -1,
1, resistances_bitmap, bitmap_weight, 470, 0,
@ -188,7 +188,7 @@ UINT32 redalert_state::screen_update_redalert(screen_device &screen, bitmap_rgb3
pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1];
offs_t offs;
get_pens(machine(), pens);
get_pens(pens);
for (offs = 0; offs < 0x2000; offs++)
{
@ -260,7 +260,7 @@ UINT32 redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rgb3
pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1];
offs_t offs;
get_pens(machine(), pens);
get_pens(pens);
for (offs = 0; offs < 0x2000; offs++)
{
@ -334,7 +334,7 @@ UINT32 redalert_state::screen_update_panther(screen_device &screen, bitmap_rgb32
pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1];
offs_t offs;
get_panther_pens(machine(), pens);
get_panther_pens(pens);
for (offs = 0; offs < 0x2000; offs++)
{

View File

@ -72,10 +72,9 @@ void renegade_state::video_start()
state_save_register_global(machine(), m_scrollx);
}
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
void renegade_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
renegade_state *state = machine.driver_data<renegade_state>();
UINT8 *source = state->m_spriteram;
UINT8 *source = m_spriteram;
UINT8 *finish = source + 96 * 4;
while (source < finish)
@ -94,7 +93,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
if (sx > 248)
sx -= 256;
if (state->flip_screen())
if (flip_screen())
{
sx = 240 - sx;
sy = 240 - sy;
@ -104,20 +103,20 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
if (attributes & 0x80) /* big sprite */
{
sprite_number &= ~1;
drawgfx_transpen(bitmap, cliprect, machine.gfx[sprite_bank],
drawgfx_transpen(bitmap, cliprect, machine().gfx[sprite_bank],
sprite_number + 1,
color,
xflip, state->flip_screen(),
sx, sy + (state->flip_screen() ? -16 : 16), 0);
xflip, flip_screen(),
sx, sy + (flip_screen() ? -16 : 16), 0);
}
else
{
sy += (state->flip_screen() ? -16 : 16);
sy += (flip_screen() ? -16 : 16);
}
drawgfx_transpen(bitmap, cliprect, machine.gfx[sprite_bank],
drawgfx_transpen(bitmap, cliprect, machine().gfx[sprite_bank],
sprite_number,
color,
xflip, state->flip_screen(),
xflip, flip_screen(),
sx, sy, 0);
}
source += 4;
@ -128,7 +127,7 @@ UINT32 renegade_state::screen_update_renegade(screen_device &screen, bitmap_ind1
{
m_bg_tilemap->set_scrollx(0, m_scrollx);
m_bg_tilemap->draw(bitmap, cliprect, 0 , 0);
draw_sprites(machine(), bitmap, cliprect);
draw_sprites(bitmap, cliprect);
m_fg_tilemap->draw(bitmap, cliprect, 0 , 0);
return 0;
}

View File

@ -164,12 +164,11 @@ WRITE8_MEMBER(retofinv_state::retofinv_gfx_ctrl_w)
***************************************************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap)
void retofinv_state::draw_sprites(bitmap_ind16 &bitmap)
{
retofinv_state *state = machine.driver_data<retofinv_state>();
UINT8 *spriteram = state->m_sharedram + 0x0780;
UINT8 *spriteram_2 = state->m_sharedram + 0x0f80;
UINT8 *spriteram_3 = state->m_sharedram + 0x1780;
UINT8 *spriteram = m_sharedram + 0x0780;
UINT8 *spriteram_2 = m_sharedram + 0x0f80;
UINT8 *spriteram_3 = m_sharedram + 0x1780;
int offs;
const rectangle spritevisiblearea(2*8, 34*8-1, 0*8, 28*8-1);
@ -194,7 +193,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap)
sprite &= ~sizex;
sprite &= ~(sizey << 1);
if (state->flip_screen())
if (flip_screen())
{
flipx ^= 1;
flipy ^= 1;
@ -207,12 +206,12 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap)
{
for (x = 0;x <= sizex;x++)
{
drawgfx_transmask(bitmap,spritevisiblearea,machine.gfx[1],
drawgfx_transmask(bitmap,spritevisiblearea,machine().gfx[1],
sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)],
color,
flipx,flipy,
sx + 16*x,sy + 16*y,
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0xff));
colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0xff));
}
}
}
@ -223,7 +222,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap)
UINT32 retofinv_state::screen_update_retofinv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(bitmap, cliprect, 0,0);
draw_sprites(machine(), bitmap);
draw_sprites(bitmap);
m_fg_tilemap->draw(bitmap, cliprect, 0,0);
return 0;
}

View File

@ -119,29 +119,28 @@ void rocnrope_state::video_start()
m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(rocnrope_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
}
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void rocnrope_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
{
rocnrope_state *state = machine.driver_data<rocnrope_state>();
UINT8 *spriteram = state->m_spriteram;
UINT8 *spriteram_2 = state->m_spriteram2;
UINT8 *spriteram = m_spriteram;
UINT8 *spriteram_2 = m_spriteram2;
int offs;
for (offs = state->m_spriteram.bytes() - 2;offs >= 0;offs -= 2)
for (offs = m_spriteram.bytes() - 2;offs >= 0;offs -= 2)
{
int color = spriteram_2[offs] & 0x0f;
drawgfx_transmask(bitmap, cliprect, machine.gfx[0],
drawgfx_transmask(bitmap, cliprect, machine().gfx[0],
spriteram[offs + 1],
color,
spriteram_2[offs] & 0x40,~spriteram_2[offs] & 0x80,
240 - spriteram[offs], spriteram_2[offs + 1],
colortable_get_transpen_mask(machine.colortable, machine.gfx[0], color, 0));
colortable_get_transpen_mask(machine().colortable, machine().gfx[0], color, 0));
}
}
UINT32 rocnrope_state::screen_update_rocnrope(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect);
draw_sprites(bitmap, cliprect);
return 0;
}

View File

@ -119,14 +119,14 @@ VIDEO_START_MEMBER(rohga_state,wizdfire)
}
// not amazingly efficient, called multiple times to pull a layer out of the sprite bitmaps, but keeps correct sprite<->sprite priorities
static void mixwizdfirelayer(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int gfxregion, UINT16 pri, UINT16 primask)
void rohga_state::mixwizdfirelayer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int gfxregion, UINT16 pri, UINT16 primask)
{
int y, x;
const pen_t *paldata = machine.pens;
const pen_t *paldata = machine().pens;
bitmap_ind16* sprite_bitmap;
int penbase;
sprite_bitmap = &machine.device<decospr_device>("spritegen2")->get_sprite_temp_bitmap();
sprite_bitmap = &machine().device<decospr_device>("spritegen2")->get_sprite_temp_bitmap();
penbase = 0x600;
UINT16* srcline;
@ -194,7 +194,7 @@ UINT32 rohga_state::screen_update_wizdfire(screen_device &screen, bitmap_rgb32 &
m_sprgen1->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x0000, 0x0400, 0x400, 0x1ff); // 0x000 and 0x200 of 0x600
mixwizdfirelayer(machine(), bitmap, cliprect, 4, 0x000, 0x000);
mixwizdfirelayer(bitmap, cliprect, 4, 0x000, 0x000);
deco16ic_tilemap_1_draw(m_deco_tilegen1, bitmap, cliprect, 0, 0);
return 0;

View File

@ -40,7 +40,7 @@ WRITE8_MEMBER(route16_state::route16_out1_w)
*
*************************************/
static pen_t route16_make_pen(UINT8 color)
pen_t route16_state::route16_make_pen(UINT8 color)
{
return MAKE_RGB(pal1bit((color >> 0) & 0x01),
pal1bit((color >> 1) & 0x01),
@ -49,7 +49,7 @@ static pen_t route16_make_pen(UINT8 color)
}
static pen_t ttmajng_make_pen(UINT8 color)
pen_t route16_state::ttmajng_make_pen(UINT8 color)
{
return MAKE_RGB(pal1bit((color >> 2) & 0x01),
pal1bit((color >> 1) & 0x01),
@ -122,44 +122,43 @@ UINT32 route16_state::screen_update_route16(screen_device &screen, bitmap_rgb32
* The Stratovox video connections have been verified from the schematics
*/
static int video_update_stratvox_ttmahjng(running_machine &machine, bitmap_rgb32 &bitmap,
int route16_state::video_update_stratvox_ttmahjng(bitmap_rgb32 &bitmap,
const rectangle &cliprect,
pen_t (*make_pen)(UINT8))
pen_t (route16_state::*make_pen)(UINT8))
{
route16_state *state = machine.driver_data<route16_state>();
offs_t offs;
UINT8 *color_prom1 = &state->memregion("proms")->base()[0x000];
UINT8 *color_prom2 = &state->memregion("proms")->base()[0x100];
UINT8 *color_prom1 = &memregion("proms")->base()[0x000];
UINT8 *color_prom2 = &memregion("proms")->base()[0x100];
for (offs = 0; offs < state->m_videoram1.bytes(); offs++)
for (offs = 0; offs < m_videoram1.bytes(); offs++)
{
int i;
UINT8 y = offs >> 6;
UINT8 x = offs << 2;
UINT8 data1 = state->m_videoram1[offs];
UINT8 data2 = state->m_videoram2[offs];
UINT8 data1 = m_videoram1[offs];
UINT8 data2 = m_videoram2[offs];
for (i = 0; i < 4; i++)
{
UINT8 color1 = color_prom1[(state->m_palette_1 << 2) |
UINT8 color1 = color_prom1[(m_palette_1 << 2) |
((data1 >> 3) & 0x02) |
((data1 >> 0) & 0x01)];
/* bit 7 of the 2nd color is the OR of the 1st color bits 0 and 1 (verified) */
UINT8 color2 = color_prom2[(((data1 << 3) & 0x80) | ((data1 << 7) & 0x80)) |
(state->m_palette_2 << 2) |
(m_palette_2 << 2) |
((data2 >> 3) & 0x02) |
((data2 >> 0) & 0x01)];
/* the final color is the OR of the two colors */
UINT8 final_color = color1 | color2;
pen_t pen = make_pen(final_color);
pen_t pen = (this->*make_pen)(final_color);
if (state->m_flipscreen)
if (m_flipscreen)
bitmap.pix32(255 - y, 255 - x) = pen;
else
bitmap.pix32(y, x) = pen;
@ -176,11 +175,11 @@ static int video_update_stratvox_ttmahjng(running_machine &machine, bitmap_rgb32
UINT32 route16_state::screen_update_stratvox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
return video_update_stratvox_ttmahjng(machine(), bitmap, cliprect, route16_make_pen);
return video_update_stratvox_ttmahjng(bitmap, cliprect, &route16_state::route16_make_pen);
}
UINT32 route16_state::screen_update_ttmahjng(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
return video_update_stratvox_ttmahjng(machine(), bitmap, cliprect, ttmajng_make_pen);
return video_update_stratvox_ttmahjng(bitmap, cliprect, &route16_state::ttmajng_make_pen);
}

View File

@ -191,10 +191,9 @@ WRITE16_MEMBER(rpunch_state::rpunch_ins_w)
*
*************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int start, int stop)
void rpunch_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int start, int stop)
{
rpunch_state *state = machine.driver_data<rpunch_state>();
UINT16 *spriteram16 = state->m_spriteram;
UINT16 *spriteram16 = m_spriteram;
int offs;
start *= 4;
@ -212,13 +211,13 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
int y = 513 - (data0 & 0x1ff);
int xflip = data1 & 0x1000;
int yflip = data1 & 0x0800;
int color = ((data1 >> 13) & 7) | ((state->m_videoflags & 0x0040) >> 3);
int color = ((data1 >> 13) & 7) | ((m_videoflags & 0x0040) >> 3);
if (x >= BITMAP_WIDTH) x -= 512;
if (y >= BITMAP_HEIGHT) y -= 512;
drawgfx_transpen(bitmap, cliprect, machine.gfx[2],
code, color + (state->m_sprite_palette / 16), xflip, yflip, x, y, 15);
drawgfx_transpen(bitmap, cliprect, machine().gfx[2],
code, color + (m_sprite_palette / 16), xflip, yflip, x, y, 15);
}
}
@ -229,15 +228,14 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
*
*************************************/
static void draw_bitmap(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
void rpunch_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
rpunch_state *state = machine.driver_data<rpunch_state>();
int colourbase;
int xxx=512/4;
int yyy=256;
int x,y,count;
colourbase = 512 + ((state->m_videoflags & 15) * 16);
colourbase = 512 + ((m_videoflags & 15) * 16);
count = 0;
@ -246,10 +244,10 @@ static void draw_bitmap(running_machine &machine, bitmap_ind16 &bitmap, const re
for(x=0;x<xxx;x++)
{
int coldat;
coldat = (state->m_bitmapram[count]>>12)&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+0)-4)&0x1ff) = coldat+colourbase;
coldat = (state->m_bitmapram[count]>>8 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+1)-4)&0x1ff) = coldat+colourbase;
coldat = (state->m_bitmapram[count]>>4 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+2)-4)&0x1ff) = coldat+colourbase;
coldat = (state->m_bitmapram[count]>>0 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+3)-4)&0x1ff) = coldat+colourbase;
coldat = (m_bitmapram[count]>>12)&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+0)-4)&0x1ff) = coldat+colourbase;
coldat = (m_bitmapram[count]>>8 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+1)-4)&0x1ff) = coldat+colourbase;
coldat = (m_bitmapram[count]>>4 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+2)-4)&0x1ff) = coldat+colourbase;
coldat = (m_bitmapram[count]>>0 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+3)-4)&0x1ff) = coldat+colourbase;
count++;
}
}
@ -270,10 +268,10 @@ UINT32 rpunch_state::screen_update_rpunch(screen_device &screen, bitmap_ind16 &b
effbins = (m_bins > m_gins) ? m_gins : m_bins;
m_background[0]->draw(bitmap, cliprect, 0,0);
draw_sprites(machine(), bitmap, cliprect, 0, effbins);
draw_sprites(bitmap, cliprect, 0, effbins);
m_background[1]->draw(bitmap, cliprect, 0,0);
draw_sprites(machine(), bitmap, cliprect, effbins, m_gins);
draw_sprites(bitmap, cliprect, effbins, m_gins);
if (m_bitmapram)
draw_bitmap(machine(), bitmap, cliprect);
draw_bitmap(bitmap, cliprect);
return 0;
}