ecbackg: make removing piece on bear off optional

This commit is contained in:
hap 2024-02-02 15:15:15 +01:00
parent db82052c9a
commit eac483ad45
2 changed files with 11 additions and 6 deletions

View File

@ -6981,7 +6981,7 @@ static INPUT_PORTS_START( tddragon2 )
PORT_BIT( 0x09, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x09, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("IN.2") // S3 PORT_START("IN.2") // S3
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_CB(input_changed) PORT_NAME("Down") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_CB(input_changed) // Down
PORT_BIT( 0x0d, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x0d, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("IN.3") // S4 PORT_START("IN.3") // S4

View File

@ -12,9 +12,9 @@ This program got 3rd place in the first Computer Olympiad in 1989 (backgammon
category). It also includes several game variations like Jacquet or Trictrac. category). It also includes several game variations like Jacquet or Trictrac.
MAME's sensorboard interface is a bit different compared to chess. Pieces can be MAME's sensorboard interface is a bit different compared to chess. Pieces can be
stacked up to 3. Pressing the Bear Off button (Del / Backspace) will also remove stacked up to 3. Pressing the Bear Off button (Del / Backspace) will optionally
the currently held piece. Capturing pieces is disabled, except when hitting a remove the currently held piece. Capturing pieces is disabled, except when hitting
blot, in which case the captured piece is held. a blot, in which case the piece in hand is swapped with the one on the board.
Hardware notes: Hardware notes:
- PCB label: GT4-PE-009 - PCB label: GT4-PE-009
@ -74,7 +74,7 @@ private:
required_device<pwm_display_device> m_lcd_pwm; required_device<pwm_display_device> m_lcd_pwm;
required_device<pwm_display_device> m_led_pwm; required_device<pwm_display_device> m_led_pwm;
required_device<dac_bit_interface> m_dac; required_device<dac_bit_interface> m_dac;
required_ioport_array<5> m_inputs; required_ioport_array<6> m_inputs;
output_finder<2, 24> m_out_lcd; output_finder<2, 24> m_out_lcd;
bool m_power = false; bool m_power = false;
@ -210,7 +210,7 @@ u8 ecbackg_state::board_spawn_cb(offs_t offset)
INPUT_CHANGED_MEMBER(ecbackg_state::bear_off) INPUT_CHANGED_MEMBER(ecbackg_state::bear_off)
{ {
if (newval) if (newval && m_inputs[5]->read() & 1)
{ {
// remove piece when Bear Off button is pressed // remove piece when Bear Off button is pressed
board_remove_cb(); board_remove_cb();
@ -464,6 +464,11 @@ static INPUT_PORTS_START( ecbackg )
PORT_START("IN.4") PORT_START("IN.4")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_NAME("New Game") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_NAME("New Game")
PORT_START("IN.5")
PORT_CONFNAME( 0x01, 0x01, "Remove Piece on Bear Off" )
PORT_CONFSETTING( 0x00, DEF_STR( No ) )
PORT_CONFSETTING( 0x01, DEF_STR( Yes ) )
PORT_START("POWER") // needs to be triggered for nvram to work PORT_START("POWER") // needs to be triggered for nvram to work
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, ecbackg_state, power_off, 0) PORT_NAME("Stop") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, ecbackg_state, power_off, 0) PORT_NAME("Stop")