summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2019-02-06 13:16:58 -0500
committerSolomon Peachy <pizza@shaftnet.org>2019-07-20 20:14:18 +0200
commit4edaf3fb9853b3eb140196ac5e4d6ed3a34eb4ba (patch)
tree5bc110ec1349cb6a2c149e3ee3073a6bbdfb43a9 /apps
parentee659d4d7a20028caf854ba7036c9d13fca83bb0 (diff)
downloadrockbox-4edaf3fb9853b3eb140196ac5e4d6ed3a34eb4ba.tar.gz
rockbox-4edaf3fb9853b3eb140196ac5e4d6ed3a34eb4ba.zip
FS#7912: Voice enable the chessbox plugin
Original patch by Mario Lang Heavily updated by Igor Poretsky Change-Id: Iaa0c32a79a464860ff294096825ae788f35cf312
Diffstat (limited to 'apps')
-rw-r--r--apps/lang/english.lang731
-rw-r--r--apps/plugins/chessbox/chessbox.c159
-rw-r--r--apps/plugins/chessbox/chessbox_pgn.c54
-rw-r--r--apps/plugins/chessbox/gnuchess.c4
4 files changed, 913 insertions, 35 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 168d728da9..0e9025c0ec 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -14367,3 +14367,734 @@
14367 *: "Playback Control" 14367 *: "Playback Control"
14368 </voice> 14368 </voice>
14369</phrase> 14369</phrase>
14370<phrase>
14371 id: LANG_CHESSBOX_CHECKMATE
14372 desc: in chessbox
14373 user: core
14374 <source>
14375 *: none
14376 lcd_bitmap: "Checkmate!"
14377 </source>
14378 <dest>
14379 *: none
14380 lcd_bitmap: "Checkmate!"
14381 </dest>
14382 <voice>
14383 *: none
14384 lcd_bitmap: "Checkmate!"
14385 </voice>
14386</phrase>
14387<phrase>
14388 id: LANG_CHESSBOX_ILLEGAL_MOVE
14389 desc: in chessbox
14390 user: core
14391 <source>
14392 *: none
14393 lcd_bitmap: "Illegal move!"
14394 </source>
14395 <dest>
14396 *: none
14397 lcd_bitmap: "Illegal move!"
14398 </dest>
14399 <voice>
14400 *: none
14401 lcd_bitmap: "Illegal move!"
14402 </voice>
14403</phrase>
14404<phrase>
14405 id: LANG_CHESSBOX_MENU_NEW_GAME
14406 desc: in the chessbox menu
14407 user: core
14408 <source>
14409 *: none
14410 lcd_bitmap: "New Game"
14411 </source>
14412 <dest>
14413 *: none
14414 lcd_bitmap: "New Game"
14415 </dest>
14416 <voice>
14417 *: none
14418 lcd_bitmap: "New Game"
14419 </voice>
14420</phrase>
14421<phrase>
14422 id: LANG_CHESSBOX_MENU_RESUME_GAME
14423 desc: in the chessbox menu
14424 user: core
14425 <source>
14426 *: none
14427 lcd_bitmap: "Resume Game"
14428 </source>
14429 <dest>
14430 *: none
14431 lcd_bitmap: "Resume Game"
14432 </dest>
14433 <voice>
14434 *: none
14435 lcd_bitmap: "Resume Game"
14436 </voice>
14437</phrase>
14438<phrase>
14439 id: LANG_CHESSBOX_MENU_SAVE_GAME
14440 desc: in the chessbox menu
14441 user: core
14442 <source>
14443 *: none
14444 lcd_bitmap: "Save Game"
14445 </source>
14446 <dest>
14447 *: none
14448 lcd_bitmap: "Save Game"
14449 </dest>
14450 <voice>
14451 *: none
14452 lcd_bitmap: "Save Game"
14453 </voice>
14454</phrase>
14455<phrase>
14456 id: LANG_CHESSBOX_MENU_RESTORE_GAME
14457 desc: in the chessbox menu
14458 user: core
14459 <source>
14460 *: none
14461 lcd_bitmap: "Restore Game"
14462 </source>
14463 <dest>
14464 *: none
14465 lcd_bitmap: "Restore Game"
14466 </dest>
14467 <voice>
14468 *: none
14469 lcd_bitmap: "Restore Game"
14470 </voice>
14471</phrase>
14472<phrase>
14473 id: LANG_CHESSBOX_MENU_RESTART_GAME
14474 desc: in the chessbox menu
14475 user: core
14476 <source>
14477 *: none
14478 lcd_bitmap: "Restart Game"
14479 </source>
14480 <dest>
14481 *: none
14482 lcd_bitmap: "Restart Game"
14483 </dest>
14484 <voice>
14485 *: none
14486 lcd_bitmap: "Restart Game"
14487 </voice>
14488</phrase>
14489<phrase>
14490 id: LANG_CHESSBOX_MENU_SELECT_OTHER_GAME
14491 desc: in the chessbox menu
14492 user: core
14493 <source>
14494 *: none
14495 lcd_bitmap: "Select Other Game"
14496 </source>
14497 <dest>
14498 *: none
14499 lcd_bitmap: "Select Other Game"
14500 </dest>
14501 <voice>
14502 *: none
14503 lcd_bitmap: "Select Other Game"
14504 </voice>
14505</phrase>
14506<phrase>
14507 id: LANG_CHESSBOX_LEVEL_1
14508 desc: in the chessbox game level selection
14509 user: core
14510 <source>
14511 *: none
14512 lcd_bitmap: "Level 1: 60 moves / 5 min"
14513 </source>
14514 <dest>
14515 *: none
14516 lcd_bitmap: "Level 1: 60 moves / 5 min"
14517 </dest>
14518 <voice>
14519 *: none
14520 lcd_bitmap: "Level 1: 60 moves per 5 minutes"
14521</voice>
14522</phrase>
14523<phrase>
14524 id: LANG_CHESSBOX_LEVEL_2
14525 desc: in the chessbox game level selection
14526 user: core
14527 <source>
14528 *: none
14529 lcd_bitmap: "Level 2: 60 moves / 15 min"
14530 </source>
14531 <dest>
14532 *: none
14533 lcd_bitmap: "Level 2: 60 moves / 15 min"
14534 </dest>
14535 <voice>
14536 *: none
14537 lcd_bitmap: "Level 2: 60 moves per 15 minutes"
14538 </voice>
14539</phrase>
14540<phrase>
14541 id: LANG_CHESSBOX_LEVEL_3
14542 desc: in the chessbox game level selection
14543 user: core
14544 <source>
14545 *: none
14546 lcd_bitmap: "Level 3: 60 moves / 30 min"
14547 </source>
14548 <dest>
14549 *: none
14550 lcd_bitmap: "Level 3: 60 moves / 30 min"
14551 </dest>
14552 <voice>
14553 *: none
14554 lcd_bitmap: "Level 3: 60 moves per 30 minutes"
14555 </voice>
14556</phrase>
14557<phrase>
14558 id: LANG_CHESSBOX_LEVEL_4
14559 desc: in the chessbox game level selection
14560 user: core
14561 <source>
14562 *: none
14563 lcd_bitmap: "Level 4: 40 moves / 30 min"
14564 </source>
14565 <dest>
14566 *: none
14567 lcd_bitmap: "Level 4: 40 moves / 30 min"
14568 </dest>
14569 <voice>
14570 *: none
14571 lcd_bitmap: "Level 4: 40 moves per 30 minutes"
14572 </voice>
14573</phrase>
14574<phrase>
14575 id: LANG_CHESSBOX_LEVEL_5
14576 desc: in the chessbox game level selection
14577 user: core
14578 <source>
14579 *: none
14580 lcd_bitmap: "Level 5: 40 moves / 60 min"
14581 </source>
14582 <dest>
14583 *: none
14584 lcd_bitmap: "Level 5: 40 moves / 60 min"
14585 </dest>
14586 <voice>
14587 *: none
14588 lcd_bitmap: "Level 5: 40 moves per 60 minutes"
14589 </voice>
14590</phrase>
14591<phrase>
14592 id: LANG_CHESSBOX_LEVEL_6
14593 desc: in the chessbox game level selection
14594 user: core
14595 <source>
14596 *: none
14597 lcd_bitmap: "Level 6: 40 moves / 120 min"
14598 </source>
14599 <dest>
14600 *: none
14601 lcd_bitmap: "Level 6: 40 moves / 120 min"
14602 </dest>
14603 <voice>
14604 *: none
14605 lcd_bitmap: "Level 6: 40 moves per 120 minutes"
14606 </voice>
14607</phrase>
14608<phrase>
14609 id: LANG_CHESSBOX_LEVEL_7
14610 desc: in the chessbox game level selection
14611 user: core
14612 <source>
14613 *: none
14614 lcd_bitmap: "Level 7: 40 moves / 240 min"
14615 </source>
14616 <dest>
14617 *: none
14618 lcd_bitmap: "Level 7: 40 moves / 240 min"
14619 </dest>
14620 <voice>
14621 *: none
14622 lcd_bitmap: "Level 7: 40 moves per 240 minutes"
14623 </voice>
14624</phrase>
14625<phrase>
14626 id: LANG_CHESSBOX_LEVEL_8
14627 desc: in the chessbox game level selection
14628 user: core
14629 <source>
14630 *: none
14631 lcd_bitmap: "Level 8: 1 move / 15 min"
14632 </source>
14633 <dest>
14634 *: none
14635 lcd_bitmap: "Level 8: 1 move / 15 min"
14636 </dest>
14637 <voice>
14638 *: none
14639 lcd_bitmap: "Level 8: 1 move per 15 minutes"
14640 </voice>
14641</phrase>
14642<phrase>
14643 id: LANG_CHESSBOX_LEVEL_9
14644 desc: in the chessbox game level selection
14645 user: core
14646 <source>
14647 *: none
14648 lcd_bitmap: "Level 9: 1 move / 60 min"
14649 </source>
14650 <dest>
14651 *: none
14652 lcd_bitmap: "Level 9: 1 move / 60 min"
14653 </dest>
14654 <voice>
14655 *: none
14656 lcd_bitmap: "Level 9: 1 move per 60 minutes"
14657 </voice>
14658</phrase>
14659<phrase>
14660 id: LANG_CHESSBOX_LEVEL_10
14661 desc: in the chessbox game level selection
14662 user: core
14663 <source>
14664 *: none
14665 lcd_bitmap: "Level 10: 1 move / 600 min"
14666 </source>
14667 <dest>
14668 *: none
14669 lcd_bitmap: "Level 10: 1 move / 600 min"
14670 </dest>
14671 <voice>
14672 *: none
14673 lcd_bitmap: "Level 10: 1 move per 600 minutes"
14674 </voice>
14675</phrase>
14676<phrase>
14677 id: LANG_CHESSBOX_PGN_PARSE_ERROR
14678 desc: in the chessbox game viewer
14679 user: core
14680 <source>
14681 *: none
14682 lcd_bitmap: "Error parsing game !"
14683 </source>
14684 <dest>
14685 *: none
14686 lcd_bitmap: "Error parsing game !"
14687 </dest>
14688 <voice>
14689 *: none
14690 lcd_bitmap: "Error parsing game !"
14691 </voice>
14692</phrase>
14693<phrase>
14694 id: LANG_CHESSBOX_NO_GAMES
14695 desc: in the chessbox game viewer
14696 user: core
14697 <source>
14698 *: none
14699 lcd_bitmap: "No games found !"
14700 </source>
14701 <dest>
14702 *: none
14703 lcd_bitmap: "No games found !"
14704 </dest>
14705 <voice>
14706 *: none
14707 lcd_bitmap: "No games found!"
14708 </voice>
14709</phrase>
14710<phrase>
14711 id: LANG_CHESSBOX_GAME_BEGINNING
14712 desc: in the chessbox game viewer
14713 user: core
14714 <source>
14715 *: none
14716 lcd_bitmap: "At the beginning of the game"
14717 </source>
14718 <dest>
14719 *: none
14720 lcd_bitmap: "At the beginning of the game"
14721 </dest>
14722 <voice>
14723 *: none
14724 lcd_bitmap: "At the beginning of the game"
14725 </voice>
14726</phrase>
14727<phrase>
14728 id: LANG_CHESSBOX_GAME_END
14729 desc: in the chessbox game viewer
14730 user: core
14731 <source>
14732 *: none
14733 lcd_bitmap: "At the end of the game"
14734 </source>
14735 <dest>
14736 *: none
14737 lcd_bitmap: "At the end of the game"
14738 </dest>
14739 <voice>
14740 *: none
14741 lcd_bitmap: "At the end of the game"
14742 </voice>
14743</phrase>
14744<phrase>
14745 id: VOICE_PLAYER
14746 desc: spoken only, for announcing player's id
14747 user: core
14748 <source>
14749 *: none
14750 lcd_bitmap: ""
14751 </source>
14752 <dest>
14753 *: none
14754 lcd_bitmap: ""
14755 </dest>
14756 <voice>
14757 *: none
14758 lcd_bitmap: "Player"
14759 </voice>
14760</phrase>
14761<phrase>
14762 id: VOICE_GNUCHESS
14763 desc: spoken only, for announcing player's id
14764 user: core
14765 <source>
14766 *: none
14767 lcd_bitmap: ""
14768 </source>
14769 <dest>
14770 *: none
14771 lcd_bitmap: ""
14772 </dest>
14773 <voice>
14774 *: none
14775 lcd_bitmap: "GNU Chess"
14776 </voice>
14777</phrase>
14778<phrase>
14779 id: VOICE_MARKED
14780 desc: spoken only, for announcing chess piece marking
14781 user: core
14782 <source>
14783 *: none
14784 lcd_bitmap: ""
14785 </source>
14786 <dest>
14787 *: none
14788 lcd_bitmap: ""
14789 </dest>
14790 <voice>
14791 *: none
14792 lcd_bitmap: "Marked"
14793 </voice>
14794</phrase>
14795<phrase>
14796 id: VOICE_UNMARKED
14797 desc: spoken only, for announcing chess piece unmarking
14798 user: core
14799 <source>
14800 *: none
14801 lcd_bitmap: ""
14802 </source>
14803 <dest>
14804 *: none
14805 lcd_bitmap: ""
14806 </dest>
14807 <voice>
14808 *: none
14809 lcd_bitmap: "Unmarked"
14810 </voice>
14811</phrase>
14812<phrase>
14813 id: VOICE_WHITE
14814 desc: spoken only, for announcing chess piece color
14815 user: core
14816 <source>
14817 *: none
14818 lcd_bitmap: ""
14819 </source>
14820 <dest>
14821 *: none
14822 lcd_bitmap: ""
14823 </dest>
14824 <voice>
14825 *: none
14826 lcd_bitmap: "White"
14827 </voice>
14828</phrase>
14829<phrase>
14830 id: VOICE_BLACK
14831 desc: spoken only, for announcing chess piece color
14832 user: core
14833 <source>
14834 *: none
14835 lcd_bitmap: ""
14836 </source>
14837 <dest>
14838 *: none
14839 lcd_bitmap: ""
14840 </dest>
14841 <voice>
14842 *: none
14843 lcd_bitmap: "Black"
14844 </voice>
14845</phrase>
14846<phrase>
14847 id: VOICE_CHESSBOX_CHECK
14848 desc: spoken only, for announcing chess moves
14849 user: core
14850 <source>
14851 *: none
14852 lcd_bitmap: ""
14853 </source>
14854 <dest>
14855 *: none
14856 lcd_bitmap: ""
14857 </dest>
14858 <voice>
14859 *: none
14860 lcd_bitmap: "Check!"
14861 </voice>
14862</phrase>
14863<phrase>
14864 id: VOICE_CHESSBOX_CAPTURES
14865 desc: spoken only, for announcing chess moves
14866 user: core
14867 <source>
14868 *: none
14869 lcd_bitmap: ""
14870 </source>
14871 <dest>
14872 *: none
14873 lcd_bitmap: ""
14874 </dest>
14875 <voice>
14876 *: none
14877 lcd_bitmap: "captures"
14878 </voice>
14879</phrase>
14880<phrase>
14881 id: VOICE_CHESSBOX_CASTLE
14882 desc: spoken only, for announcing chess moves
14883 user: core
14884 <source>
14885 *: none
14886 lcd_bitmap: ""
14887 </source>
14888 <dest>
14889 *: none
14890 lcd_bitmap: ""
14891 </dest>
14892 <voice>
14893 *: none
14894 lcd_bitmap: "castle"
14895 </voice>
14896</phrase>
14897<phrase>
14898 id: VOICE_CHESSBOX_KINGSIDE
14899 desc: spoken only, for announcing chess moves
14900 user: core
14901 <source>
14902 *: none
14903 lcd_bitmap: ""
14904 </source>
14905 <dest>
14906 *: none
14907 lcd_bitmap: ""
14908 </dest>
14909 <voice>
14910 *: none
14911 lcd_bitmap: "king side"
14912 </voice>
14913</phrase>
14914<phrase>
14915 id: VOICE_CHESSBOX_QUEENSIDE
14916 desc: spoken only, for announcing chess moves
14917 user: core
14918 <source>
14919 *: none
14920 lcd_bitmap: ""
14921 </source>
14922 <dest>
14923 *: none
14924 lcd_bitmap: ""
14925 </dest>
14926 <voice>
14927 *: none
14928 lcd_bitmap: "queen side"
14929 </voice>
14930</phrase>
14931<phrase>
14932 id: VOICE_PAWN
14933 desc: spoken only, for announcing chess piece names
14934 user: core
14935 <source>
14936 *: none
14937 lcd_bitmap: ""
14938 </source>
14939 <dest>
14940 *: none
14941 lcd_bitmap: ""
14942 </dest>
14943 <voice>
14944 *: none
14945 lcd_bitmap: "Pawn"
14946 </voice>
14947</phrase>
14948<phrase>
14949 id: VOICE_KNIGHT
14950 desc: spoken only, for announcing chess piece names
14951 user: core
14952 <source>
14953 *: none
14954 lcd_bitmap: ""
14955 </source>
14956 <dest>
14957 *: none
14958 lcd_bitmap: ""
14959 </dest>
14960 <voice>
14961 *: none
14962 lcd_bitmap: "Knight"
14963 </voice>
14964</phrase>
14965<phrase>
14966 id: VOICE_BISHOP
14967 desc: spoken only, for announcing chess piece names
14968 user: core
14969 <source>
14970 *: none
14971 lcd_bitmap: ""
14972 </source>
14973 <dest>
14974 *: none
14975 lcd_bitmap: ""
14976 </dest>
14977 <voice>
14978 *: none
14979 lcd_bitmap: "Bishop"
14980 </voice>
14981</phrase>
14982<phrase>
14983 id: VOICE_ROOK
14984 desc: spoken only, for announcing chess piece names
14985 user: core
14986 <source>
14987 *: none
14988 lcd_bitmap: ""
14989 </source>
14990 <dest>
14991 *: none
14992 lcd_bitmap: ""
14993 </dest>
14994 <voice>
14995 *: none
14996 lcd_bitmap: "Rook"
14997 </voice>
14998</phrase>
14999<phrase>
15000 id: VOICE_QUEEN
15001 desc: spoken only, for announcing chess piece names
15002 user: core
15003 <source>
15004 *: none
15005 lcd_bitmap: ""
15006 </source>
15007 <dest>
15008 *: none
15009 lcd_bitmap: ""
15010 </dest>
15011 <voice>
15012 *: none
15013 lcd_bitmap: "Queen"
15014 </voice>
15015</phrase>
15016<phrase>
15017 id: VOICE_KING
15018 desc: spoken only, for announcing chess piece names
15019 user: core
15020 <source>
15021 *: none
15022 lcd_bitmap: ""
15023 </source>
15024 <dest>
15025 *: none
15026 lcd_bitmap: ""
15027 </dest>
15028 <voice>
15029 *: none
15030 lcd_bitmap: "King"
15031 </voice>
15032</phrase>
15033<phrase>
15034 id: LANG_CHESSBOX_GAMES
15035 desc: in chessbox
15036 user: core
15037 <source>
15038 *: none
15039 lcd_bitmap: "Games"
15040 </source>
15041 <dest>
15042 *: none
15043 lcd_bitmap: "Games"
15044 </dest>
15045 <voice>
15046 *: none
15047 lcd_bitmap: ""
15048 </voice>
15049</phrase>
15050<phrase>
15051 id: LANG_CHESSBOX_SAVING_POSITION
15052 desc: in chessbox
15053 user: core
15054 <source>
15055 *: none
15056 lcd_bitmap: "Saving position"
15057 </source>
15058 <dest>
15059 *: none
15060 lcd_bitmap: "Saving position"
15061 </dest>
15062 <voice>
15063 *: none
15064 lcd_bitmap: "Saving position"
15065 </voice>
15066</phrase>
15067<phrase>
15068 id: LANG_CHESSBOX_LOADING_POSITION
15069 desc: in chessbox
15070 user: core
15071 <source>
15072 *: none
15073 lcd_bitmap: "Loading position"
15074 </source>
15075 <dest>
15076 *: none
15077 lcd_bitmap: "Loading position"
15078 </dest>
15079 <voice>
15080 *: none
15081 lcd_bitmap: "Loading position"
15082 </voice>
15083</phrase>
15084<phrase>
15085 id: LANG_CHESSBOX_THINKING
15086 desc: in chessbox
15087 user: core
15088 <source>
15089 *: none
15090 lcd_bitmap: "Thinking..."
15091 </source>
15092 <dest>
15093 *: none
15094 lcd_bitmap: "Thinking..."
15095 </dest>
15096 <voice>
15097 *: none
15098 lcd_bitmap: ""
15099 </voice>
15100</phrase>
diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c
index c7cd94c7e1..52a1f2789b 100644
--- a/apps/plugins/chessbox/chessbox.c
+++ b/apps/plugins/chessbox/chessbox.c
@@ -78,16 +78,16 @@ extern const fb_data chessbox_pieces[];
78short plugin_mode; 78short plugin_mode;
79 79
80/* level+1's string */ 80/* level+1's string */
81const char *level_string[] = { "Level 1: 60 moves / 5 min" , 81const char *level_string[] = { ID2P(LANG_CHESSBOX_LEVEL_1) ,
82 "Level 2: 60 moves / 15 min" , 82 ID2P(LANG_CHESSBOX_LEVEL_2) ,
83 "Level 3: 60 moves / 30 min" , 83 ID2P(LANG_CHESSBOX_LEVEL_3) ,
84 "Level 4: 40 moves / 30 min" , 84 ID2P(LANG_CHESSBOX_LEVEL_4) ,
85 "Level 5: 40 moves / 60 min" , 85 ID2P(LANG_CHESSBOX_LEVEL_5) ,
86 "Level 6: 40 moves / 120 min" , 86 ID2P(LANG_CHESSBOX_LEVEL_6) ,
87 "Level 7: 40 moves / 240 min" , 87 ID2P(LANG_CHESSBOX_LEVEL_7) ,
88 "Level 8: 1 move / 15 min" , 88 ID2P(LANG_CHESSBOX_LEVEL_8) ,
89 "Level 9: 1 move / 60 min" , 89 ID2P(LANG_CHESSBOX_LEVEL_9) ,
90 "Level 10: 1 move / 600 min" }; 90 ID2P(LANG_CHESSBOX_LEVEL_10) };
91 91
92/* "While thinking" command */ 92/* "While thinking" command */
93int wt_command = COMMAND_NOP; 93int wt_command = COMMAND_NOP;
@@ -175,8 +175,35 @@ static void cb_drawboard (void) {
175 rb->lcd_update(); 175 rb->lcd_update();
176} 176}
177 177
178static short oldx, oldy = 0;
179void cb_talk(short x, short y)
180{
181 if (x != oldx || y != oldy) {
182 short c, r;
183 short l, piece, p_color;
184
185 rb->talk_shutup();
186 cr2xy(x, y, &c, &r);
187 l = locn[r][c];
188 piece = board[l];
189 p_color = color[l];
190 if (piece != no_piece) {
191 rb->talk_id (VOICE_WHITE + p_color, true);
192 if (piece >= pawn && piece <= king) {
193 rb->talk_id (VOICE_PAWN + piece - 1, true);
194 }
195 }
196 rb->talk_id (VOICE_CHAR_A + c, true);
197 rb->talk_id (VOICE_ONE + r, true);
198 oldx = x;
199 oldy = y;
200 }
201}
202
178/* ---- Switch mark on board ---- */ 203/* ---- Switch mark on board ---- */
179static void cb_switch ( short x , short y ) { 204static void cb_switch ( short x , short y ) {
205 if (rb->global_settings->talk_menu)
206 cb_talk(x, y);
180 rb->lcd_set_drawmode ( DRMODE_COMPLEMENT ); 207 rb->lcd_set_drawmode ( DRMODE_COMPLEMENT );
181 rb->lcd_drawrect ( XOFS + x*TILE_WIDTH + 1 , 208 rb->lcd_drawrect ( XOFS + x*TILE_WIDTH + 1 ,
182 YOFS + ( 7 - y )*TILE_HEIGHT +1 , 209 YOFS + ( 7 - y )*TILE_HEIGHT +1 ,
@@ -380,7 +407,7 @@ static void cb_saveposition ( void ) {
380#ifdef CHESSBOX_SAVE_FILE_DBG 407#ifdef CHESSBOX_SAVE_FILE_DBG
381 cb_saveposition_dbg(); 408 cb_saveposition_dbg();
382#endif 409#endif
383 rb->splash ( 0 , "Saving position" ); 410 rb->splash ( 0 , ID2P(LANG_CHESSBOX_SAVING_POSITION) );
384 411
385 fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT, 0666); 412 fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT, 0666);
386 413
@@ -434,7 +461,7 @@ static void cb_restoreposition ( void ) {
434 unsigned short m; 461 unsigned short m;
435 462
436 if ( (fd = rb->open(SAVE_FILE, O_RDONLY)) >= 0 ) { 463 if ( (fd = rb->open(SAVE_FILE, O_RDONLY)) >= 0 ) {
437 rb->splash ( 0 , "Loading position" ); 464 rb->splash ( 0 , ID2P(LANG_CHESSBOX_LOADING_POSITION) );
438 rb->read(fd, &(computer), sizeof(computer)); 465 rb->read(fd, &(computer), sizeof(computer));
439 rb->read(fd, &(opponent), sizeof(opponent)); 466 rb->read(fd, &(opponent), sizeof(opponent));
440 rb->read(fd, &(Game50), sizeof(Game50)); 467 rb->read(fd, &(Game50), sizeof(Game50));
@@ -503,8 +530,10 @@ static int cb_menu_viewer(void)
503 int result = 0; 530 int result = 0;
504 bool menu_quit = false; 531 bool menu_quit = false;
505 532
506 MENUITEM_STRINGLIST(menu,"Chessbox Menu",NULL,"Restart Game", 533 MENUITEM_STRINGLIST(menu,"Chessbox Menu",NULL,
507 "Select Other Game", "Quit"); 534 ID2P(LANG_CHESSBOX_MENU_RESTART_GAME),
535 ID2P(LANG_CHESSBOX_MENU_SELECT_OTHER_GAME),
536 ID2P(LANG_MENU_QUIT));
508 537
509 while(!menu_quit) 538 while(!menu_quit)
510 { 539 {
@@ -572,7 +601,7 @@ static void cb_start_viewer(char* filename){
572 601
573 first_game = pgn_list_games(filename); 602 first_game = pgn_list_games(filename);
574 if (first_game == NULL){ 603 if (first_game == NULL){
575 rb->splash ( HZ*2 , "No games found !" ); 604 rb->splash ( HZ*2 , ID2P(LANG_CHESSBOX_NO_GAMES) );
576 return; 605 return;
577 } 606 }
578 607
@@ -602,7 +631,7 @@ static void cb_start_viewer(char* filename){
602 if (curr_ply->prev_node != NULL){ 631 if (curr_ply->prev_node != NULL){
603 curr_ply = curr_ply->prev_node; 632 curr_ply = curr_ply->prev_node;
604 } else { 633 } else {
605 rb->splash ( HZ*2 , "At the begining of the game" ); 634 rb->splash ( HZ*2 , ID2P(LANG_CHESSBOX_GAME_BEGINNING) );
606 break; 635 break;
607 } 636 }
608 board[locn[curr_ply->row_from][curr_ply->column_from]] 637 board[locn[curr_ply->row_from][curr_ply->column_from]]
@@ -648,9 +677,39 @@ static void cb_start_viewer(char* filename){
648 case COMMAND_NEXT: 677 case COMMAND_NEXT:
649 /* apply the current move */ 678 /* apply the current move */
650 if (curr_ply->player == neutral){ 679 if (curr_ply->player == neutral){
651 rb->splash ( HZ*2 , "At the end of the game" ); 680 rb->splash ( HZ*2 , ID2P(LANG_CHESSBOX_GAME_END) );
652 break; 681 break;
653 } 682 }
683 if (rb->global_settings->talk_menu) {
684 rb->talk_id (VOICE_WHITE + curr_ply->player, false);
685 if (curr_ply->castle){
686 rb->talk_id (VOICE_CHESSBOX_CASTLE, true);
687 if (curr_ply->column_to == 6){
688 rb->talk_id (VOICE_CHESSBOX_KINGSIDE, true);
689 } else {
690 rb->talk_id (VOICE_CHESSBOX_QUEENSIDE, true);
691 }
692 } else {
693 rb->talk_id (VOICE_PAWN +
694 board[locn[curr_ply->row_from]
695 [curr_ply->column_from]]
696 - 1, true);
697 rb->talk_id (VOICE_CHAR_A + curr_ply->column_from,
698 true);
699 rb->talk_id (VOICE_ONE + curr_ply->row_from, true);
700 if (board[locn[curr_ply->row_to]
701 [curr_ply->column_to]] != no_piece) {
702 rb->talk_id (VOICE_CHESSBOX_CAPTURES, true);
703 rb->talk_id (VOICE_PAWN +
704 board[locn[curr_ply->row_to]
705 [curr_ply->column_to]]
706 - 1, true);
707 }
708 rb->talk_id (VOICE_CHAR_A + curr_ply->column_to,
709 true);
710 rb->talk_id (VOICE_ONE + curr_ply->row_to, true);
711 }
712 }
654 board[locn[curr_ply->row_to][curr_ply->column_to]] 713 board[locn[curr_ply->row_to][curr_ply->column_to]]
655 = board[locn[curr_ply->row_from][curr_ply->column_from]]; 714 = board[locn[curr_ply->row_from][curr_ply->column_from]];
656 color[locn[curr_ply->row_to][curr_ply->column_to]] 715 color[locn[curr_ply->row_to][curr_ply->column_to]]
@@ -677,6 +736,10 @@ static void cb_start_viewer(char* filename){
677 color[locn[curr_ply->row_from][curr_ply->column_to]] = neutral; 736 color[locn[curr_ply->row_from][curr_ply->column_to]] = neutral;
678 } 737 }
679 if (curr_ply->promotion){ 738 if (curr_ply->promotion){
739 if (rb->global_settings->talk_menu)
740 rb->talk_id (VOICE_PAWN +
741 curr_ply->promotion_piece - 1,
742 true);
680 board[locn[curr_ply->row_to][curr_ply->column_to]] 743 board[locn[curr_ply->row_to][curr_ply->column_to]]
681 = curr_ply->promotion_piece; 744 = curr_ply->promotion_piece;
682 color[locn[curr_ply->row_to][curr_ply->column_to]] 745 color[locn[curr_ply->row_to][curr_ply->column_to]]
@@ -701,7 +764,7 @@ static void cb_start_viewer(char* filename){
701 } 764 }
702 } while (!exit_game && !exit_viewer); 765 } while (!exit_game && !exit_viewer);
703 } else { 766 } else {
704 rb->splash ( HZ*2 , "Error parsing game !"); 767 rb->splash ( HZ*2 , ID2P(LANG_CHESSBOX_PGN_PARSE_ERROR));
705 } 768 }
706 } while (!exit_viewer); 769 } while (!exit_viewer);
707} 770}
@@ -713,12 +776,15 @@ static int cb_menu(void)
713 int result = 0; 776 int result = 0;
714 bool menu_quit = false; 777 bool menu_quit = false;
715 778
716 MENUITEM_STRINGLIST(menu,"Chessbox Menu",NULL,"New Game","Resume Game", 779 MENUITEM_STRINGLIST(menu,"Chessbox Menu",NULL,
717 "Save Game", "Restore Game", 780 ID2P(LANG_CHESSBOX_MENU_NEW_GAME),
781 ID2P(LANG_CHESSBOX_MENU_RESUME_GAME),
782 ID2P(LANG_CHESSBOX_MENU_SAVE_GAME),
783 ID2P(LANG_CHESSBOX_MENU_RESTORE_GAME),
718#ifdef HAVE_PLAYBACK_CONTROL 784#ifdef HAVE_PLAYBACK_CONTROL
719 "Playback Control", 785 ID2P(LANG_PLAYBACK_CONTROL),
720#endif 786#endif
721 "Quit"); 787 ID2P(LANG_MENU_QUIT));
722 788
723 while(!menu_quit) 789 while(!menu_quit)
724 { 790 {
@@ -813,6 +879,10 @@ static struct cb_command cb_getcommand (void) {
813 } 879 }
814 if ( marked && ( marked_x == x ) && ( marked_y == y ) ) { 880 if ( marked && ( marked_x == x ) && ( marked_y == y ) ) {
815 from_marked = true ; 881 from_marked = true ;
882 if (rb->global_settings->talk_menu) {
883 cb_talk(x, y);
884 rb->talk_id(VOICE_MARKED, true);
885 }
816 } else { 886 } else {
817 from_marked = false ; 887 from_marked = false ;
818 cb_switch ( x , y ); 888 cb_switch ( x , y );
@@ -831,6 +901,10 @@ static struct cb_command cb_getcommand (void) {
831 } 901 }
832 if ( marked && ( marked_x == x ) && ( marked_y == y ) ) { 902 if ( marked && ( marked_x == x ) && ( marked_y == y ) ) {
833 from_marked = true ; 903 from_marked = true ;
904 if (rb->global_settings->talk_menu) {
905 cb_talk(x, y);
906 rb->talk_id(VOICE_MARKED, true);
907 }
834 } else { 908 } else {
835 from_marked = false ; 909 from_marked = false ;
836 cb_switch ( x , y ); 910 cb_switch ( x , y );
@@ -849,6 +923,10 @@ static struct cb_command cb_getcommand (void) {
849 } 923 }
850 if ( marked && ( marked_x == x ) && ( marked_y == y ) ) { 924 if ( marked && ( marked_x == x ) && ( marked_y == y ) ) {
851 from_marked = true ; 925 from_marked = true ;
926 if (rb->global_settings->talk_menu) {
927 cb_talk(x, y);
928 rb->talk_id(VOICE_MARKED, true);
929 }
852 } else { 930 } else {
853 from_marked = false ; 931 from_marked = false ;
854 cb_switch ( x , y ); 932 cb_switch ( x , y );
@@ -867,6 +945,10 @@ static struct cb_command cb_getcommand (void) {
867 } 945 }
868 if ( marked && ( marked_x == x ) && ( marked_y == y ) ) { 946 if ( marked && ( marked_x == x ) && ( marked_y == y ) ) {
869 from_marked = true ; 947 from_marked = true ;
948 if (rb->global_settings->talk_menu) {
949 cb_talk(x, y);
950 rb->talk_id(VOICE_MARKED, true);
951 }
870 } else { 952 } else {
871 from_marked = false ; 953 from_marked = false ;
872 cb_switch ( x , y ); 954 cb_switch ( x , y );
@@ -885,11 +967,15 @@ static struct cb_command cb_getcommand (void) {
885 from_marked = true ; 967 from_marked = true ;
886 marked_x = x; 968 marked_x = x;
887 marked_y = y; 969 marked_y = y;
970 if (rb->global_settings->talk_menu)
971 rb->talk_id(VOICE_MARKED, false);
888 } 972 }
889 } else { 973 } else {
890 if ( ( marked_x == x ) && ( marked_y == y ) ) { 974 if ( ( marked_x == x ) && ( marked_y == y ) ) {
891 marked = false; 975 marked = false;
892 from_marked = false; 976 from_marked = false;
977 if (rb->global_settings->talk_menu)
978 rb->talk_id(VOICE_UNMARKED, false);
893 } else { 979 } else {
894 xy2cr ( marked_x , marked_y , &c , &r ); 980 xy2cr ( marked_x , marked_y , &c , &r );
895 result.mv_s[0] = 'a' + c; 981 result.mv_s[0] = 'a' + c;
@@ -912,6 +998,23 @@ static struct cb_command cb_getcommand (void) {
912 998
913} 999}
914 1000
1001/* Talk a move */
1002static void talk_move(char *move_buffer)
1003{
1004 if (rb->global_settings->talk_menu) {
1005 rb->talk_id (VOICE_PAWN +
1006 board[locn[move_buffer[3]-'1'][move_buffer[2]-'a']] - 1,
1007 false);
1008 rb->talk_id(VOICE_CHAR_A + move_buffer[0] - 'a', true);
1009 rb->talk_id(VOICE_ONE + move_buffer[1] - '1', true);
1010 rb->talk_id(VOICE_CHAR_A + move_buffer[2] - 'a', true);
1011 rb->talk_id(VOICE_ONE + move_buffer[3] - '1', true);
1012 if (move_buffer[4] == '+' && !mate) {
1013 rb->talk_id(VOICE_CHESSBOX_CHECK, true);
1014 }
1015 }
1016}
1017
915/* ---- game main loop ---- */ 1018/* ---- game main loop ---- */
916static void cb_play_game(void) { 1019static void cb_play_game(void) {
917 struct cb_command command; 1020 struct cb_command command;
@@ -939,7 +1042,8 @@ static void cb_play_game(void) {
939 1042
940 while (!exit) { 1043 while (!exit) {
941 if ( mate ) { 1044 if ( mate ) {
942 rb->splash ( HZ*3 , "Checkmate!" ); 1045 rb->talk_force_enqueue_next();
1046 rb->splash ( HZ*3 , ID2P(LANG_CHESSBOX_CHECKMATE) );
943 rb->button_get(true); 1047 rb->button_get(true);
944 pgn_store_game(game); 1048 pgn_store_game(game);
945 GNUChess_Initialize(); 1049 GNUChess_Initialize();
@@ -950,7 +1054,7 @@ static void cb_play_game(void) {
950 switch (command.type) { 1054 switch (command.type) {
951 case COMMAND_MOVE: 1055 case COMMAND_MOVE:
952 if ( ! VerifyMove (opponent, command.mv_s , 0 , &command.mv, move_buffer ) ) { 1056 if ( ! VerifyMove (opponent, command.mv_s , 0 , &command.mv, move_buffer ) ) {
953 rb->splash ( HZ/2 , "Illegal move!" ); 1057 rb->splash ( HZ/2 , ID2P(LANG_CHESSBOX_ILLEGAL_MOVE) );
954 cb_drawboard(); 1058 cb_drawboard();
955 } else { 1059 } else {
956 cb_drawboard(); 1060 cb_drawboard();
@@ -958,7 +1062,8 @@ static void cb_play_game(void) {
958 /* Add the ply to the PGN history (in algebraic notation) */ 1062 /* Add the ply to the PGN history (in algebraic notation) */
959 pgn_append_ply(game, opponent, move_buffer, mate); 1063 pgn_append_ply(game, opponent, move_buffer, mate);
960 1064
961 rb->splash ( 0 , "Thinking..." ); 1065 talk_move(move_buffer);
1066 rb->splash ( 0 , ID2P(LANG_CHESSBOX_THINKING) );
962#ifdef HAVE_ADJUSTABLE_CPU_FREQ 1067#ifdef HAVE_ADJUSTABLE_CPU_FREQ
963 rb->cpu_boost ( true ); 1068 rb->cpu_boost ( true );
964#endif 1069#endif
@@ -971,6 +1076,7 @@ static void cb_play_game(void) {
971 */ 1076 */
972 if (move_buffer[0] != '\0'){ 1077 if (move_buffer[0] != '\0'){
973 pgn_append_ply(game, computer, move_buffer, mate); 1078 pgn_append_ply(game, computer, move_buffer, mate);
1079 talk_move(move_buffer);
974 } else { 1080 } else {
975 pgn_set_result(game, mate); 1081 pgn_set_result(game, mate);
976 } 1082 }
@@ -1016,7 +1122,7 @@ static void cb_play_game(void) {
1016 opponent = white; 1122 opponent = white;
1017 computer = black; 1123 computer = black;
1018 } 1124 }
1019 rb->splash ( 0 , "Thinking..." ); 1125 rb->splash ( 0 , ID2P(LANG_CHESSBOX_THINKING) );
1020 ElapsedTime(1); 1126 ElapsedTime(1);
1021#ifdef HAVE_ADJUSTABLE_CPU_FREQ 1127#ifdef HAVE_ADJUSTABLE_CPU_FREQ
1022 rb->cpu_boost ( true ); 1128 rb->cpu_boost ( true );
@@ -1031,6 +1137,7 @@ static void cb_play_game(void) {
1031 */ 1137 */
1032 if (move_buffer[0] != '\0'){ 1138 if (move_buffer[0] != '\0'){
1033 pgn_append_ply(game, computer, move_buffer, mate); 1139 pgn_append_ply(game, computer, move_buffer, mate);
1140 talk_move(move_buffer);
1034 } else { 1141 } else {
1035 pgn_set_result(game, mate); 1142 pgn_set_result(game, mate);
1036 } 1143 }
diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c
index 4e16834f5c..39a24d6fa1 100644
--- a/apps/plugins/chessbox/chessbox_pgn.c
+++ b/apps/plugins/chessbox/chessbox_pgn.c
@@ -539,14 +539,21 @@ static void coords_to_pgn(struct pgn_ply_node* ply){
539 } 539 }
540} 540}
541 541
542static const char* get_game_text(int selected_item, void *data, 542static struct pgn_game_node *get_game_info(int selected_item, void *data){
543 char *buffer, size_t buffer_len){
544 int i; 543 int i;
545 struct pgn_game_node *temp_node = (struct pgn_game_node *)data; 544 struct pgn_game_node *temp_node = (struct pgn_game_node *)data;
546 545
547 for (i=0;i<selected_item && temp_node != NULL;i++){ 546 for (i=0;i<selected_item && temp_node != NULL;i++){
548 temp_node = temp_node->next_node; 547 temp_node = temp_node->next_node;
549 } 548 }
549
550 return temp_node;
551}
552
553static const char* get_game_text(int selected_item, void *data,
554 char *buffer, size_t buffer_len){
555 struct pgn_game_node *temp_node = get_game_info(selected_item, data);
556
550 if (temp_node == NULL){ 557 if (temp_node == NULL){
551 return NULL; 558 return NULL;
552 } 559 }
@@ -556,6 +563,35 @@ static const char* get_game_text(int selected_item, void *data,
556 return buffer; 563 return buffer;
557} 564}
558 565
566static void say_player(const char *name, bool enqueue) {
567 if (!rb->strcasecmp(name, "player"))
568 rb->talk_id(VOICE_PLAYER, enqueue);
569 else if (!rb->strcasecmp(name, "gnuchess"))
570 rb->talk_id(VOICE_GNUCHESS, enqueue);
571 else
572 rb->talk_spell(name, enqueue);
573}
574
575static int speak_game_selection(int selected_item, void *data){
576 struct pgn_game_node *temp_node = get_game_info(selected_item, data);
577
578 if (temp_node != NULL){
579 say_player(temp_node->white_player, false);
580 say_player(temp_node->black_player, true);
581 if (temp_node->game_date[0] != '?') {
582 char buf[12];
583 rb->strcpy(buf, temp_node->game_date);
584 buf[4] = 0;
585 buf[7] = 0;
586 rb->talk_id(LANG_MONTH_JANUARY + rb->atoi(&(buf[5])) - 1, true);
587 rb->talk_number(rb->atoi(&(buf[8])), true);
588 rb->talk_number(rb->atoi(buf), true);
589 }
590 }
591
592 return 0;
593}
594
559static void write_pgn_token(int fhandler, char *buffer, size_t *line_length){ 595static void write_pgn_token(int fhandler, char *buffer, size_t *line_length){
560 if (*line_length + rb->strlen(buffer) + 1 > 80){ 596 if (*line_length + rb->strlen(buffer) + 1 > 80){
561 rb->fdprintf(fhandler,"\n"); 597 rb->fdprintf(fhandler,"\n");
@@ -636,14 +672,18 @@ struct pgn_game_node* pgn_show_game_list(struct pgn_game_node* first_game){
636 672
637 673
638 rb->gui_synclist_init(&games_list, &get_game_text, first_game, false, 1, NULL); 674 rb->gui_synclist_init(&games_list, &get_game_text, first_game, false, 1, NULL);
639 rb->gui_synclist_set_title(&games_list, "Games", NOICON); 675 rb->gui_synclist_set_title(&games_list, rb->str(LANG_CHESSBOX_GAMES), NOICON);
640 rb->gui_synclist_set_icon_callback(&games_list, NULL); 676 rb->gui_synclist_set_icon_callback(&games_list, NULL);
677 if (rb->global_settings->talk_menu)
678 rb->gui_synclist_set_voice_callback(&games_list, speak_game_selection);
641 rb->gui_synclist_set_nb_items(&games_list, i); 679 rb->gui_synclist_set_nb_items(&games_list, i);
642 rb->gui_synclist_limit_scroll(&games_list, true); 680 rb->gui_synclist_limit_scroll(&games_list, true);
643 rb->gui_synclist_select_item(&games_list, 0); 681 rb->gui_synclist_select_item(&games_list, 0);
644 682
683 rb->gui_synclist_draw(&games_list);
684 rb->gui_synclist_speak_item(&games_list);
685
645 while (true) { 686 while (true) {
646 rb->gui_synclist_draw(&games_list);
647 curr_selection = rb->gui_synclist_get_sel_pos(&games_list); 687 curr_selection = rb->gui_synclist_get_sel_pos(&games_list);
648 button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK); 688 button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
649 if (rb->gui_synclist_do_button(&games_list,&button,LIST_WRAP_OFF)){ 689 if (rb->gui_synclist_do_button(&games_list,&button,LIST_WRAP_OFF)){
@@ -651,11 +691,7 @@ struct pgn_game_node* pgn_show_game_list(struct pgn_game_node* first_game){
651 } 691 }
652 switch (button) { 692 switch (button) {
653 case ACTION_STD_OK: 693 case ACTION_STD_OK:
654 temp_node = first_game; 694 return get_game_info(curr_selection, first_game);
655 for (i=0;i<curr_selection && temp_node != NULL;i++){
656 temp_node = temp_node->next_node;
657 }
658 return temp_node;
659 break; 695 break;
660 case ACTION_STD_CANCEL: 696 case ACTION_STD_CANCEL:
661 return NULL; 697 return NULL;
diff --git a/apps/plugins/chessbox/gnuchess.c b/apps/plugins/chessbox/gnuchess.c
index 4b21cd785c..ff9bb99b91 100644
--- a/apps/plugins/chessbox/gnuchess.c
+++ b/apps/plugins/chessbox/gnuchess.c
@@ -1117,6 +1117,10 @@ static short i,alpha,beta,score,tempb,tempc,tempsf,tempst,xside,rpt;
1117 for (index=0;index<5;index++){ 1117 for (index=0;index<5;index++){
1118 move_buffer[index] = mvstr1[index]; 1118 move_buffer[index] = mvstr1[index];
1119 } 1119 }
1120 if (SqAtakd(PieceList[(side==white)?black:white][0],side)){
1121 move_buffer[4] = '+';
1122 move_buffer[5] = '\0';
1123 }
1120 1124
1121 if (score == -9999 || score == 9998) mate = true; 1125 if (score == -9999 || score == 9998) mate = true;
1122 if (mate) hint = 0; 1126 if (mate) hint = 0;