Example #1
0
Puzzle::Puzzle(const Board &board_arg, std::vector<Piece> &pieces_arg,
               bool piece_flip_flag_arg)
    : board(), pieces(), piece_flip_flag(true) {
    set_board(board_arg);
    set_pieces(pieces_arg);
    set_piece_flip_flag(piece_flip_flag_arg);
}
Example #2
0
Puzzle::Puzzle(const Board &board_arg, const Piece *pieces_arg,
               std::size_t piece_count, bool piece_flip_flag_arg)
    : board(), pieces(), piece_flip_flag(true) {
    set_board(board_arg);
    set_pieces(pieces_arg, piece_count);
    set_piece_flip_flag(piece_flip_flag_arg);
}
Example #3
0
void
Puzzle::set_components(const Board &board_arg,
                       const std::vector<Piece> &pieces_arg, bool piece_flip_flag_arg) {
    set_board(board_arg);
    set_pieces(pieces_arg);
    set_piece_flip_flag(piece_flip_flag_arg);
}
Example #4
0
void
Puzzle::set_components(const Board &board_arg, const Piece *pieces_arg,
                       std::size_t piece_count, bool piece_flip_flag_arg) {
    set_board(board_arg);
    set_pieces(pieces_arg, piece_count);
    set_piece_flip_flag(piece_flip_flag_arg);
}
Example #5
0
static READ8_HANDLER( supercon_port4_r )
{
	supercon_state *state = space->machine().driver_data<supercon_state>();
	int i_18, i_AH;
	UINT8 key_data = 0x00;;

	static const char *const board_lines[8] =
			{ "BOARD_1", "BOARD_2", "BOARD_3", "BOARD_4", "BOARD_5", "BOARD_6", "BOARD_7", "BOARD_8" };

	LOG(("Read from %04x \n",0x1F00));

/* Board buttons */

	i_18=get_first_bit(state->m_data_1E00);
	if (i_18==NOT_VALID)
		return 0xff;

/* if a button was pressed wait til timer -timer_mouse_click- is fired */

	if (state->m_selecting)
		return state->m_save_key_data;
	else
	{
		set_pieces(state);
		output_set_value("MOVING",state->m_moving_piece);
	}

	key_data=input_port_read(space->machine(), board_lines[i_18]);

	if (key_data != 0xff)
	{
		LOG(("%s key_data: %02x \n",board_lines[i_18],key_data));

/* Only if valid data and mouse button is pressed */

		if (key_data && input_port_read(space->machine(), "BUTTON_L")) 
		{

/* Set or remove pieces */

			i_AH=7-get_first_cleared_bit(key_data);
			LOG(("Press -> AH: %d 18: %d Piece: %d\n",i_AH,i_18,state->m_board[i_18*8 + i_AH]););
Example #6
0
static READ8_HANDLER( supercon_port3_r )
{
	supercon_state *state = space->machine().driver_data<supercon_state>();
	int i;
	UINT8 key_data=0;

	static const char *const status_lines[8] =
			{ "STATUS_1", "STATUS_2", "STATUS_3", "STATUS_4", "STATUS_5", "STATUS_6", "STATUS_7", "STATUS_8" };

	LOG(("Read from %04x \n",0x1E00));

/* remove last bit (only if it was not already set) */

	if ( state->m_data_1F00 & LED_LINE_AH )
	{
		if (state->m_last_LED_value != state->m_LED_AH)
			state->m_LED_AH=state->m_LED_AH & ~state->m_data_1E00;
	}
	else if ( state->m_data_1F00 & LED_LINE_ST)
	{
		if (state->m_last_LED_value != state->m_LED_ST)
			state->m_LED_ST=state->m_LED_ST & ~state->m_data_1E00;
	}
	else if ( state->m_data_1F00 & LED_LINE_18 )
	{
		if (state->m_last_LED_value != state->m_LED_18)
			state->m_LED_18=state->m_LED_18 & ~state->m_data_1E00;
	}


	LOG(("LED_18 from %02x \n",state->m_LED_18));
	LOG(("LED_AH from %02x \n",state->m_LED_AH));
	LOG(("LED_ST from %02x \n",state->m_LED_ST));

	if (state->m_led_update)			/*No LED Update if Port 1C00,1D00 was read */
		update_leds(state);

	state->m_remove_led_flag=TRUE;
	state->m_led_update=TRUE;

	state->m_LED_18=0;
	state->m_LED_AH=0;
	state->m_LED_ST=0;


/* Start */

	if (!state->m_emu_started)
		return 0xbf;
	else
		state->m_timer_update_irq->adjust( attotime::zero, 0, attotime::from_hz(598) );  //HACK adjust timer after start ???


/* Buttons */

	i=get_first_bit(state->m_data_1E00);
	if (i==NOT_VALID)
		return 0xff;

	key_data=input_port_read(space->machine(), status_lines[i]);

	if (key_data != 0xc0)
	{
		LOG(("%s, key_data: %02x \n",status_lines[i],key_data));

/* Button: New Game -> initialize board */

		if (i==0 && key_data==0x80)
		{
			set_board(state);
			set_pieces(state);

			state->m_emu_started=FALSE;
		}

/* Button: Clear Board -> remove all pieces */

		if (i==3 && key_data==0x80)
			clear_pieces(state);

		if (key_data != 0xff )
			return key_data;

	}

	return 0xc0;
}