diff options
author | 2015-08-14 09:58:05 +0200 | |
---|---|---|
committer | 2015-08-14 10:45:18 +0200 | |
commit | eee4cc6a373400cf26ef8a4154cb9ba06d0f0f2b (patch) | |
tree | 0e93b570c929395fc439f88afaa5fb94b46bc320 /src | |
parent | 30f1de6c831ecd15c1bf06b5d1dd875063a0b9b3 (diff) |
lethalj.c: reduce tagmap lookups (nw)
Diffstat (limited to 'src')
-rw-r--r-- | src/mame/drivers/lethalj.c | 9 | ||||
-rw-r--r-- | src/mame/includes/lethalj.h | 19 | ||||
-rw-r--r-- | src/mame/video/lethalj.c | 13 |
3 files changed, 32 insertions, 9 deletions
diff --git a/src/mame/drivers/lethalj.c b/src/mame/drivers/lethalj.c index 47704031630..f4454127dc8 100644 --- a/src/mame/drivers/lethalj.c +++ b/src/mame/drivers/lethalj.c @@ -142,7 +142,6 @@ Pin #11(+) | | R | #include "emu.h" #include "cpu/tms34010/tms34010.h" #include "includes/lethalj.h" -#include "machine/ticket.h" #include "sound/okim6295.h" @@ -162,7 +161,7 @@ Pin #11(+) | | R | CUSTOM_INPUT_MEMBER(lethalj_state::cclownz_paddle) { - int value = ioport("PADDLE")->read(); + int value = m_paddle->read(); return ((value << 4) & 0xf00) | (value & 0x00f); } @@ -177,14 +176,14 @@ CUSTOM_INPUT_MEMBER(lethalj_state::cclownz_paddle) WRITE16_MEMBER(lethalj_state::ripribit_control_w) { coin_counter_w(machine(), 0, data & 1); - machine().device<ticket_dispenser_device>("ticket")->write(space, 0, ((data >> 1) & 1) << 7); + m_ticket->write(space, 0, ((data >> 1) & 1) << 7); output_set_lamp_value(0, (data >> 2) & 1); } WRITE16_MEMBER(lethalj_state::cfarm_control_w) { - machine().device<ticket_dispenser_device>("ticket")->write(space, 0, ((data >> 0) & 1) << 7); + m_ticket->write(space, 0, ((data >> 0) & 1) << 7); output_set_lamp_value(0, (data >> 2) & 1); output_set_lamp_value(1, (data >> 3) & 1); output_set_lamp_value(2, (data >> 4) & 1); @@ -194,7 +193,7 @@ WRITE16_MEMBER(lethalj_state::cfarm_control_w) WRITE16_MEMBER(lethalj_state::cclownz_control_w) { - machine().device<ticket_dispenser_device>("ticket")->write(space, 0, ((data >> 0) & 1) << 7); + m_ticket->write(space, 0, ((data >> 0) & 1) << 7); output_set_lamp_value(0, (data >> 2) & 1); output_set_lamp_value(1, (data >> 4) & 1); output_set_lamp_value(2, (data >> 5) & 1); diff --git a/src/mame/includes/lethalj.h b/src/mame/includes/lethalj.h index ed70bdf3453..390f889ef3c 100644 --- a/src/mame/includes/lethalj.h +++ b/src/mame/includes/lethalj.h @@ -6,6 +6,9 @@ **************************************************************************/ +#include "machine/ticket.h" + + class lethalj_state : public driver_device { public: @@ -17,10 +20,24 @@ public: lethalj_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu"), - m_screen(*this, "screen") { } + m_screen(*this, "screen"), + m_ticket(*this, "ticket"), + m_paddle(*this, "PADDLE"), + m_light0_x(*this, "LIGHT0_X"), + m_light0_y(*this, "LIGHT0_Y"), + m_light1_x(*this, "LIGHT1_X"), + m_light1_y(*this, "LIGHT1_Y") + { } required_device<cpu_device> m_maincpu; required_device<screen_device> m_screen; + required_device<ticket_dispenser_device> m_ticket; + optional_ioport m_paddle; + optional_ioport m_light0_x; + optional_ioport m_light0_y; + optional_ioport m_light1_x; + optional_ioport m_light1_y; + UINT16 m_blitter_data[8]; UINT16 *m_screenram; UINT8 m_vispage; diff --git a/src/mame/video/lethalj.c b/src/mame/video/lethalj.c index d34a017623b..3fdc4027ede 100644 --- a/src/mame/video/lethalj.c +++ b/src/mame/video/lethalj.c @@ -24,13 +24,20 @@ inline void lethalj_state::get_crosshair_xy(int player, int *x, int *y) { - static const char *const gunnames[] = { "LIGHT0_X", "LIGHT0_Y", "LIGHT1_X", "LIGHT1_Y" }; const rectangle &visarea = m_screen->visible_area(); int width = visarea.width(); int height = visarea.height(); - *x = ((ioport(gunnames[player * 2])->read_safe(0x00) & 0xff) * width) / 255; - *y = ((ioport(gunnames[1 + player * 2])->read_safe(0x00) & 0xff) * height) / 255; + if (player) + { + *x = (((m_light1_x ? m_light1_x->read() : 0) & 0xff) * width) / 255; + *y = (((m_light1_y ? m_light1_y->read() : 0) & 0xff) * height) / 255; + } + else + { + *x = (((m_light0_x ? m_light0_x->read() : 0) & 0xff) * width) / 255; + *y = (((m_light0_y ? m_light0_y->read() : 0) & 0xff) * height) / 255; + } } |