From c4de91c44e89aa2f53e6824ac6d9908a9d00be4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Banaan=20Ananas?= Date: Thu, 25 Oct 2012 13:37:21 +0000 Subject: [PATCH] improve timecris/timecrs2 gun accuracy --- src/mame/drivers/namcos22.c | 85 ++++++++++++++++++------------------- src/mame/drivers/namcos23.c | 19 ++++----- 2 files changed, 51 insertions(+), 53 deletions(-) diff --git a/src/mame/drivers/namcos22.c b/src/mame/drivers/namcos22.c index 369accf271f..cd34d24c11c 100644 --- a/src/mame/drivers/namcos22.c +++ b/src/mame/drivers/namcos22.c @@ -2434,22 +2434,22 @@ WRITE32_MEMBER(namcos22_state::namcos22_mcuram_w) READ32_MEMBER(namcos22_state::namcos22_gun_r) { - int xpos = ioport("LIGHTX")->read_safe(0) * 640 / 0xff; - int ypos = ioport("LIGHTY")->read_safe(0) * 240 / 0xff + 0x10; + UINT16 xpos = ioport("LIGHTX")->read(); + UINT16 ypos = ioport("LIGHTY")->read(); + switch( offset ) { - case 0: /* 430000 */ - return xpos<<16; + case 0: /* 430000 */ + return xpos<<16; - case 1: /* 430004 */ - case 2: /* 430008 */ - return ypos<<16; + case 1: /* 430004 */ + case 2: /* 430008 */ + return ypos<<16; - case 3: - default: - return 0; + default: + return 0; } -} /* namcos22_gun_r */ +} WRITE32_MEMBER(namcos22_state::namcos22_cpuleds_w) { @@ -2458,14 +2458,8 @@ WRITE32_MEMBER(namcos22_state::namcos22_cpuleds_w) if (ACCESSING_BITS_0_15) data &= 0xff; else data = (data>>16) & 0xff; - output_set_lamp_value(0, data>>7 & 1); - output_set_lamp_value(1, data>>6 & 1); - output_set_lamp_value(2, data>>5 & 1); - output_set_lamp_value(3, data>>4 & 1); - output_set_lamp_value(4, data>>3 & 1); - output_set_lamp_value(5, data>>2 & 1); - output_set_lamp_value(6, data>>1 & 1); - output_set_lamp_value(7, data>>0 & 1); + for (int i = 0; i < 8; i++) + output_set_lamp_value(i, (~data<>i & 1); + output_set_lamp_value(i, (~data<read() & 1; + UINT8 sb = (ioport("SERVICE")->read() & 1) << 4; // other bits: unknown - return sb<<4; + return sb | 0; } WRITE8_MEMBER(namcos23_state::s23_iob_p6_w) @@ -3159,10 +3159,9 @@ WRITE8_MEMBER(namcos23_state::s23_iob_p6_w) READ8_MEMBER(namcos23_state::s23_gun_r) { - UINT16 xpos = ioport("LIGHTX")->read_safe(0) * 640 / 0xff + 0x80; - UINT16 ypos = ioport("LIGHTY")->read_safe(0) * 240 / 0xff + 0x20; + UINT16 xpos = ioport("LIGHTX")->read(); + UINT16 ypos = ioport("LIGHTY")->read(); - // note: will need angle adjustments for accurate aiming at screen sides switch(offset) { case 0: return xpos&0xff;