Index: trunk/apps/lang/english.lang
===================================================================
--- trunk/apps/lang/english.lang.orig 2007-10-09 17:38:57.000000000 +0200
+++ trunk/apps/lang/english.lang 2007-10-09 17:58:17.000000000 +0200
@@ -11341,3 +11341,325 @@
lcd_color: "Line Selector Colours"
+
+ id: LANG_CHESSBOX_CHECKMATE
+ desc: in the chessbox menu
+ user:
+
+ *: "Checkmate!"
+
+
+ *: "Checkmate!"
+
+
+ *: "Checkmate!"
+
+
+
+ id: LANG_CHESSBOX_ILLEGAL_MOVE
+ desc: in chessbox
+ user:
+
+ *: "Illegal move!"
+
+
+ *: "Illegal move!"
+
+
+ *: "Illegal move!"
+
+
+
+ id: LANG_CHESSBOX_MENU_NEW_GAME
+ desc: in the chessbox menu
+ user:
+
+ *: "New Game"
+
+
+ *: "New Game"
+
+
+ *: "New Game"
+
+
+
+ id: LANG_CHESSBOX_MENU_RESUME_GAME
+ desc: in the chessbox menu
+ user:
+
+ *: "Resume Game"
+
+
+ *: "Resume Game"
+
+
+ *: "Resume Game"
+
+
+
+ id: LANG_CHESSBOX_MENU_SAVE_GAME
+ desc: in the chessbox menu
+ user:
+
+ *: "Save Game"
+
+
+ *: "Save Game"
+
+
+ *: "Save Game"
+
+
+
+ id: LANG_CHESSBOX_MENU_RESTORE_GAME
+ desc: in the chessbox menu
+ user:
+
+ *: "Restore Game"
+
+
+ *: "Restore Game"
+
+
+ *: "Restore Game"
+
+
+
+ id: LANG_CHESSBOX_MENU_RESTART_GAME
+ desc: in the chessbox menu
+ user:
+
+ *: "Restart Game"
+
+
+ *: "Restart Game"
+
+
+ *: "Restart Game"
+
+
+
+ id: LANG_CHESSBOX_MENU_SELECT_OTHER_GAME
+ desc: in the chessbox menu
+ user:
+
+ *: "Select Other Game"
+
+
+ *: "Select Other Game"
+
+
+ *: "Select Other Game"
+
+
+
+ id: LANG_CHESSBOX_MENU_QUIT
+ desc: in the chessbox menu
+ user:
+
+ *: "Quit"
+
+
+ *: "Quit"
+
+
+ *: "Quit"
+
+
+
+ id: LANG_CHESSBOX_PGN_PARSE_ERROR
+ desc: in the chessbox game viewer
+ user:
+
+ *: "Error parsing game !"
+
+
+ *: "Error parsing game !"
+
+
+ *: "Error parsing game !"
+
+
+
+ id: VOICE_WHITE
+ desc: spoken only, for announcing chess piece color
+ user:
+
+ *: ""
+
+
+ *: ""
+
+
+ *: "White"
+
+
+
+ id: VOICE_BLACK
+ desc: spoken only, for announcing chess piece color
+ user:
+
+ *: ""
+
+
+ *: ""
+
+
+ *: "Black"
+
+
+
+ id: VOICE_CHESSBOX_CHESS
+ desc: spoken only, for announcing chess moves
+ user:
+
+ *: ""
+
+
+ *: ""
+
+
+ *: "Chess!"
+
+
+
+ id: VOICE_CHESSBOX_CAPTURES
+ desc: spoken only, for announcing chess moves
+ user:
+
+ *: ""
+
+
+ *: ""
+
+
+ *: "captures"
+
+
+
+ id: VOICE_CHESSBOX_CASTLE
+ desc: spoken only, for announcing chess moves
+ user:
+
+ *: ""
+
+
+ *: ""
+
+
+ *: "castle"
+
+
+
+ id: VOICE_CHESSBOX_KINGSIDE
+ desc: spoken only, for announcing chess moves
+ user:
+
+ *: ""
+
+
+ *: ""
+
+
+ *: "king side"
+
+
+
+ id: VOICE_CHESSBOX_QUEENSIDE
+ desc: spoken only, for announcing chess moves
+ user:
+
+ *: ""
+
+
+ *: ""
+
+
+ *: "queen side"
+
+
+
+ id: VOICE_PAWN
+ desc: spoken only, for announcing chess piece names
+ user:
+
+ *: ""
+
+
+ *: ""
+
+
+ *: "Pawn"
+
+
+
+ id: VOICE_KNIGHT
+ desc: spoken only, for announcing chess piece names
+ user:
+
+ *: ""
+
+
+ *: ""
+
+
+ *: "Knight"
+
+
+
+ id: VOICE_BISHOP
+ desc: spoken only, for announcing chess piece names
+ user:
+
+ *: ""
+
+
+ *: ""
+
+
+ *: "Bishop"
+
+
+
+ id: VOICE_ROOK
+ desc: spoken only, for announcing chess piece names
+ user:
+
+ *: ""
+
+
+ *: ""
+
+
+ *: "Rook"
+
+
+
+ id: VOICE_QUEEN
+ desc: spoken only, for announcing chess piece names
+ user:
+
+ *: ""
+
+
+ *: ""
+
+
+ *: "Queen"
+
+
+
+ id: VOICE_KING
+ desc: spoken only, for announcing chess piece names
+ user:
+
+ *: ""
+
+
+ *: ""
+
+
+ *: "King"
+
+
Index: trunk/apps/plugins/chessbox/chessbox.c
===================================================================
--- trunk/apps/plugins/chessbox/chessbox.c.orig 2007-10-09 14:57:35.000000000 +0200
+++ trunk/apps/plugins/chessbox/chessbox.c 2007-10-09 17:59:23.000000000 +0200
@@ -349,8 +349,29 @@
rb->lcd_update();
}
+static short oldx, oldy = 0;
/* ---- Switch mark on board ---- */
void cb_switch ( short x , short y ) {
+ if (rb->talk_menus_enabled() && (x != oldx || y != oldy)) {
+ short c, r;
+ short l, piece, p_color;
+
+ rb->do_shutup();
+ cr2xy(x, y, &c, &r);
+ l = locn[r][c];
+ piece = board[l];
+ p_color = color[l];
+ if (piece != no_piece) {
+ rb->talk_id (VOICE_WHITE + p_color, true);
+ if (piece >= pawn && piece <= king) {
+ rb->talk_id (VOICE_PAWN + piece - 1, true);
+ }
+ }
+ rb->talk_id (VOICE_CHAR_A + c, true);
+ rb->talk_id (VOICE_ONE + r, true);
+ oldx = x;
+ oldy = y;
+ }
rb->lcd_set_drawmode ( DRMODE_COMPLEMENT );
rb->lcd_drawrect ( XOFS + x*TILE_WIDTH + 1 ,
YOFS + ( 7 - y )*TILE_HEIGHT +1 ,
@@ -571,9 +592,11 @@
int result = 0;
bool menu_quit = false;
- MENUITEM_STRINGLIST(menu,"Chessbox Menu",NULL,"Restart Game",
- "Select Other Game", "Quit");
-
+ MENUITEM_STRINGLIST(menu,"Chessbox Menu",NULL,
+ ID2P(LANG_CHESSBOX_MENU_RESTART_GAME),
+ ID2P(LANG_CHESSBOX_MENU_SELECT_OTHER_GAME),
+ ID2P(LANG_CHESSBOX_MENU_QUIT));
+
while(!menu_quit)
{
switch(rb->do_menu(&menu, &selection))
@@ -712,6 +735,36 @@
rb->splash ( 200 , "At the end of the game" );
break;
}
+ if (rb->talk_menus_enabled()) {
+ rb->talk_id (VOICE_WHITE + curr_ply->player, false);
+ if (curr_ply->castle){
+ rb->talk_id (VOICE_CHESSBOX_CASTLE, true);
+ if (curr_ply->column_to == 6){
+ rb->talk_id (VOICE_CHESSBOX_KINGSIDE, true);
+ } else {
+ rb->talk_id (VOICE_CHESSBOX_QUEENSIDE, true);
+ }
+ } else {
+ rb->talk_id (VOICE_PAWN +
+ board[locn[curr_ply->row_from]
+ [curr_ply->column_from]]
+ - 1, true);
+ rb->talk_id (VOICE_CHAR_A + curr_ply->column_from,
+ true);
+ rb->talk_id (VOICE_ONE + curr_ply->row_from, true);
+ if (board[locn[curr_ply->row_to]
+ [curr_ply->column_to]] != no_piece) {
+ rb->talk_id (VOICE_CHESSBOX_CAPTURES, true);
+ rb->talk_id (VOICE_PAWN +
+ board[locn[curr_ply->row_to]
+ [curr_ply->column_to]]
+ - 1, true);
+ }
+ rb->talk_id (VOICE_CHAR_A + curr_ply->column_to,
+ true);
+ rb->talk_id (VOICE_ONE + curr_ply->row_to, true);
+ }
+ }
board[locn[curr_ply->row_to][curr_ply->column_to]]
= board[locn[curr_ply->row_from][curr_ply->column_from]];
color[locn[curr_ply->row_to][curr_ply->column_to]]
@@ -738,6 +791,10 @@
color[locn[curr_ply->row_from][curr_ply->column_to]] = neutral;
}
if (curr_ply->promotion){
+ if (rb->talk_menus_enabled())
+ rb->talk_id (VOICE_PAWN +
+ curr_ply->promotion_piece - 1,
+ true);
board[locn[curr_ply->row_to][curr_ply->column_to]]
= curr_ply->promotion_piece;
color[locn[curr_ply->row_to][curr_ply->column_to]]
@@ -761,7 +818,7 @@
}
} while (!exit_game && !exit_viewer);
} else {
- rb->splash ( 200 , "Error parsing game !");
+ rb->splash ( 200 , ID2P(LANG_CHESSBOX_PGN_PARSE_ERROR));
}
} while (!exit_viewer);
}
@@ -773,9 +830,13 @@
int result = 0;
bool menu_quit = false;
- MENUITEM_STRINGLIST(menu,"Chessbox Menu",NULL,"New Game","Resume Game",
- "Save Game", "Restore Game", "Quit");
-
+ MENUITEM_STRINGLIST(menu,"Chessbox Menu",NULL,
+ ID2P(LANG_CHESSBOX_MENU_NEW_GAME),
+ ID2P(LANG_CHESSBOX_MENU_RESUME_GAME),
+ ID2P(LANG_CHESSBOX_MENU_SAVE_GAME),
+ ID2P(LANG_CHESSBOX_MENU_RESTORE_GAME),
+ ID2P(LANG_CHESSBOX_MENU_QUIT));
+
while(!menu_quit)
{
switch(rb->do_menu(&menu, &selection))
@@ -935,6 +996,23 @@
}
+/* Talk a move */
+static void talk_move(char *move_buffer)
+{
+ if (rb->talk_menus_enabled()) {
+ rb->talk_id (VOICE_PAWN +
+ board[locn[move_buffer[3]-'1'][move_buffer[2]-'a']] - 1,
+ false);
+ rb->talk_id(VOICE_CHAR_A + move_buffer[0] - 'a', true);
+ rb->talk_id(VOICE_ONE + move_buffer[1] - '1', true);
+ rb->talk_id(VOICE_CHAR_A + move_buffer[2] - 'a', true);
+ rb->talk_id(VOICE_ONE + move_buffer[3] - '1', true);
+ if (move_buffer[4] == '+') {
+ rb->talk_id(VOICE_CHESSBOX_CHESS, true);
+ }
+ }
+}
+
/* ---- game main loop ---- */
void cb_play_game(void) {
struct cb_command command;
@@ -962,7 +1040,7 @@
while (!exit) {
if ( mate ) {
- rb->splash ( 500 , "Checkmate!" );
+ rb->splash ( 500 , ID2P(LANG_CHESSBOX_CHECKMATE) );
rb->button_get(true);
pgn_store_game(rb, game);
GNUChess_Initialize();
@@ -973,7 +1051,7 @@
switch (command.type) {
case COMMAND_MOVE:
if ( ! VerifyMove (opponent, command.mv_s , 0 , &command.mv, move_buffer ) ) {
- rb->splash ( 50 , "Illegal move!" );
+ rb->splash ( 50 , ID2P(LANG_CHESSBOX_ILLEGAL_MOVE) );
cb_drawboard();
} else {
cb_drawboard();
@@ -981,6 +1059,7 @@
/* Add the ply to the PGN history (in algebraic notation) */
pgn_append_ply(rb, game, opponent, move_buffer, mate);
+ talk_move(move_buffer);
rb->splash ( 0 , "Thinking..." );
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost ( true );
@@ -994,6 +1073,7 @@
*/
if (move_buffer[0] != '\0'){
pgn_append_ply(rb, game, computer, move_buffer, mate);
+ talk_move(move_buffer);
} else {
pgn_set_result(rb, game, mate);
}
@@ -1056,6 +1136,7 @@
*/
if (move_buffer[0] != '\0'){
pgn_append_ply(rb, game, computer, move_buffer, mate);
+ talk_move(move_buffer);
} else {
pgn_set_result(rb, game, mate);
}
Index: trunk/apps/plugins/chessbox/chessbox_pgn.c
===================================================================
--- trunk/apps/plugins/chessbox/chessbox_pgn.c.orig 2007-10-09 14:57:35.000000000 +0200
+++ trunk/apps/plugins/chessbox/chessbox_pgn.c 2007-10-09 17:58:17.000000000 +0200
@@ -795,7 +795,6 @@
temp_node = temp_node->next_node;
}
-
rb->gui_synclist_init(&games_list, &get_game_text, first_game, false, 1);
rb->gui_synclist_set_title(&games_list, "Games", NOICON);
rb->gui_synclist_set_icon_callback(&games_list, NULL);
@@ -807,6 +806,18 @@
rb->gui_syncstatusbar_draw(rb->statusbars, true);
rb->gui_synclist_draw(&games_list);
curr_selection = rb->gui_synclist_get_sel_pos(&games_list);
+ if (rb->talk_menus_enabled()) {
+ temp_node = first_game;
+
+ for (i=0; inext_node;
+ }
+ if (temp_node != NULL){
+ rb->talk_spell(temp_node->white_player, false);
+ rb->talk_spell(temp_node->black_player, true);
+ rb->talk_spell(temp_node->game_date, true);
+ }
+ }
button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
if (rb->gui_synclist_do_button(&games_list,&button,LIST_WRAP_OFF)){
continue;