diff options
author | 2011-03-29 15:50:04 +0000 | |
---|---|---|
committer | 2011-03-29 15:50:04 +0000 | |
commit | 2ad50720237fdd19cf5ab45b8cb6bb21119c00b8 (patch) | |
tree | db21eee69668a06abc3f310ebbd51f5dbadf2de7 /src/mame/video/tigeroad.c | |
parent | b72cf3c5702b749c7bf26383ff05a9ab55022d31 (diff) |
BIG update.
Remove redundant machine items from address_space and device_t.
Neither machine nor m_machine are directly accessible anymore.
Instead a new getter machine() is available which returns a
machine reference. So:
space->machine->xxx ==> space->machine().xxx
device->machine->yyy ==> device->machine().yyy
Globally changed all running_machine pointers to running_machine
references. Any function/method that takes a running_machine takes
it as a required parameter (1 or 2 exceptions). Being consistent
here gets rid of a lot of odd &machine or *machine, but it does
mean a very large bulk change across the project.
Structs which have a running_machine * now have that variable
renamed to m_machine, and now have a shiny new machine() method
that works like the space and device methods above. Since most of
these are things that should eventually be devices anyway, consider
this a step in that direction.
98% of the update was done with regex searches. The changes are
architected such that the compiler will catch the remaining
errors:
// find things that use an embedded machine directly and replace
// with a machine() getter call
S: ->machine->
R: ->machine\(\)\.
// do the same if via a reference
S: \.machine->
R: \.machine\(\)\.
// convert function parameters to running_machine &
S: running_machine \*machine([^;])
R: running_machine \&machine\1
// replace machine-> with machine.
S: machine->
R: machine\.
// replace &machine() with machine()
S: \&([()->a-z0-9_]+machine\(\))
R: \1
// sanity check: look for this used as a cast
(running_machine &)
// and change to this:
*(running_machine *)
Diffstat (limited to 'src/mame/video/tigeroad.c')
-rw-r--r-- | src/mame/video/tigeroad.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/mame/video/tigeroad.c b/src/mame/video/tigeroad.c index 3dfdf739077..53143f16e38 100644 --- a/src/mame/video/tigeroad.c +++ b/src/mame/video/tigeroad.c @@ -4,7 +4,7 @@ WRITE16_HANDLER( tigeroad_videoram_w ) { - tigeroad_state *state = space->machine->driver_data<tigeroad_state>(); + tigeroad_state *state = space->machine().driver_data<tigeroad_state>(); UINT16 *videoram = state->videoram; COMBINE_DATA(&videoram[offset]); tilemap_mark_tile_dirty(state->fg_tilemap, offset); @@ -12,7 +12,7 @@ WRITE16_HANDLER( tigeroad_videoram_w ) WRITE16_HANDLER( tigeroad_videoctrl_w ) { - tigeroad_state *state = space->machine->driver_data<tigeroad_state>(); + tigeroad_state *state = space->machine().driver_data<tigeroad_state>(); int bank; if (ACCESSING_BITS_8_15) @@ -21,10 +21,10 @@ WRITE16_HANDLER( tigeroad_videoctrl_w ) /* bit 1 flips screen */ - if (flip_screen_get(space->machine) != (data & 0x02)) + if (flip_screen_get(space->machine()) != (data & 0x02)) { - flip_screen_set(space->machine, data & 0x02); - tilemap_mark_all_tiles_dirty_all(space->machine); + flip_screen_set(space->machine(), data & 0x02); + tilemap_mark_all_tiles_dirty_all(space->machine()); } /* bit 2 selects bg char bank */ @@ -39,19 +39,19 @@ WRITE16_HANDLER( tigeroad_videoctrl_w ) /* bits 4-5 are coin lockouts */ - coin_lockout_w(space->machine, 0, !(data & 0x10)); - coin_lockout_w(space->machine, 1, !(data & 0x20)); + coin_lockout_w(space->machine(), 0, !(data & 0x10)); + coin_lockout_w(space->machine(), 1, !(data & 0x20)); /* bits 6-7 are coin counters */ - coin_counter_w(space->machine, 0, data & 0x40); - coin_counter_w(space->machine, 1, data & 0x80); + coin_counter_w(space->machine(), 0, data & 0x40); + coin_counter_w(space->machine(), 1, data & 0x80); } } WRITE16_HANDLER( tigeroad_scroll_w ) { - tigeroad_state *state = space->machine->driver_data<tigeroad_state>(); + tigeroad_state *state = space->machine().driver_data<tigeroad_state>(); int scroll = 0; COMBINE_DATA(&scroll); @@ -67,10 +67,10 @@ WRITE16_HANDLER( tigeroad_scroll_w ) } } -static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority ) +static void draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int priority ) { - UINT16 *source = &machine->generic.buffered_spriteram.u16[machine->generic.spriteram_size/2] - 4; - UINT16 *finish = machine->generic.buffered_spriteram.u16; + UINT16 *source = &machine.generic.buffered_spriteram.u16[machine.generic.spriteram_size/2] - 4; + UINT16 *finish = machine.generic.buffered_spriteram.u16; // TODO: The Track Map should probably be drawn on top of the background tilemap... // Also convert the below into a for loop! @@ -100,7 +100,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta } drawgfx_transpen(bitmap, cliprect, - machine->gfx[2], + machine.gfx[2], tile_number, color, flipx, flipy, @@ -113,8 +113,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta static TILE_GET_INFO( get_bg_tile_info ) { - tigeroad_state *state = machine->driver_data<tigeroad_state>(); - UINT8 *tilerom = machine->region("gfx4")->base(); + tigeroad_state *state = machine.driver_data<tigeroad_state>(); + UINT8 *tilerom = machine.region("gfx4")->base(); int data = tilerom[tile_index]; int attr = tilerom[tile_index + 1]; @@ -128,7 +128,7 @@ static TILE_GET_INFO( get_bg_tile_info ) static TILE_GET_INFO( get_fg_tile_info ) { - tigeroad_state *state = machine->driver_data<tigeroad_state>(); + tigeroad_state *state = machine.driver_data<tigeroad_state>(); UINT16 *videoram = state->videoram; int data = videoram[tile_index]; int attr = data >> 8; @@ -147,7 +147,7 @@ static TILEMAP_MAPPER( tigeroad_tilemap_scan ) VIDEO_START( tigeroad ) { - tigeroad_state *state = machine->driver_data<tigeroad_state>(); + tigeroad_state *state = machine.driver_data<tigeroad_state>(); state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tigeroad_tilemap_scan, 32, 32, 128, 128); @@ -162,18 +162,18 @@ VIDEO_START( tigeroad ) SCREEN_UPDATE( tigeroad ) { - tigeroad_state *state = screen->machine->driver_data<tigeroad_state>(); + tigeroad_state *state = screen->machine().driver_data<tigeroad_state>(); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1, 0); - draw_sprites(screen->machine, bitmap, cliprect, 0); + draw_sprites(screen->machine(), bitmap, cliprect, 0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0, 1); - //draw_sprites(screen->machine, bitmap, cliprect, 1); draw priority sprites? + //draw_sprites(screen->machine(), bitmap, cliprect, 1); draw priority sprites? tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 2); return 0; } SCREEN_EOF( tigeroad ) { - address_space *space = machine->device("maincpu")->memory().space(AS_PROGRAM); + address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM); buffer_spriteram16_w(space, 0, 0, 0xffff); } |