예제 #1
0
static RET_CODE on_othello_board_select(control_t *p_ctrl, u16 msg,
  u32 para1, u32 para2)
{
  BOOL ret;
  
  if (do_move_chess(&chess_board,
                    (u16)((cur_row + 1) * 10 + (cur_col + 1)),
                    (u8)(~computer_side & 3), callback))
  {
    othello_game = OTHELLO_HAPPY;
    get_chess_score(&chess_board, &WhitePoint, &BlackPoint);
    othello_update_status();
    othello_draw_background(FALSE);
    /* computer round */
    ret = computer_play(&chess_board, callback);
    get_chess_score(&chess_board, &WhitePoint, &BlackPoint);
    othello_update_status();
    othello_draw_background(FALSE);
    
    if(!ret)
    {
      game_over(&chess_board, callback);
    }
  }  

  return SUCCESS;
}
예제 #2
0
void othello_initial(BOOL BOW)
{
  control_t *p_mbox, *p_info;

  p_info = ui_game_get_ctrl(ROOT_ID_OTHELLO, GAME_INFO_ID);
  p_info = ctrl_get_child_by_id(p_info, 6);

  g_iGameLevel =
    (text_get_content(p_info) == IDS_GAME_EASY) ? OTHELLO_GAME_LEVEL_PRM :
    (text_get_content(p_info) ==
     IDS_GAME_NORMAL ? OTHELLO_GAME_LEVEL_JUR : OTHELLO_GAME_LEVEL_SER);

  p_info = ctrl_get_child_by_id(p_info->p_parent, 2);

  ctrl_default_proc(p_info, MSG_LOSTFOCUS, 0, 0);
  ctrl_paint_ctrl(p_info, TRUE);
  p_mbox = ui_game_get_ctrl(ROOT_ID_OTHELLO, GAME_BOARD_ID);
  ctrl_default_proc(p_mbox, MSG_GETFOCUS, 0, 0);

  cur_col = 3;
  cur_row = 2;
  BlackPoint = 2;
  WhitePoint = 2;

  if (!BOW) //if user is white, cpu first
  {
    init_board(&chess_board, FALSE);
    cpu_color = CHESS_BLACK;
    computer_play(&chess_board, callback);
    get_chess_score(&chess_board, &WhitePoint, &BlackPoint);
    othello_game = OTHELLO_HAPPY;
  }
  else
  {
    init_board(&chess_board, TRUE);
    cpu_color = CHESS_WHITE;
    othello_game = OTHELLO_HAPPY;
  }

  othello_update_status();
  othello_draw_background(TRUE);
}
예제 #3
0
static void othello_start(void)
{
	UINT8 back_saved;
	//    othello_init();
	othello_draw_background();
	update_status(Class, BlackPoint, WhitePoint);

	win_compopup_init(WIN_POPUP_TYPE_OKNO);
	win_compopup_set_frame(GAME_MSG_LEFT, GAME_MSG_TOP, GAME_MSG_WIDTH, GAME_MSG_HEIGHT);
	win_compopup_set_msg_ext(NULL, NULL, RS_GAME_MSG_DO_YOU_BLACK);
	if (win_compopup_open_ext(&back_saved) == WIN_POP_CHOICE_NO)
	{
		computer_side = CHESS_BLACK;
		/* computer round */
		computer_play(&chess_board, callback);

		get_chess_score(&chess_board, &WhitePoint, &BlackPoint);
		update_status(Class, BlackPoint, WhitePoint);
	}
}
예제 #4
0
static void othello_1st_draw(void)
{
	othello_draw_background();
}