Rev 81 | Rev 124 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 81 | Rev 116 | ||
|---|---|---|---|
| Line 865... | Line 865... | ||
| 865 | } |
865 | } |
| 866 | 866 | ||
| 867 | // is it time to play a move sound ? |
867 | // is it time to play a move sound ? |
| 868 | if ((sound_playtime != 0) && (sound_playtime < current_time)) |
868 | if ((sound_playtime != 0) && (sound_playtime < current_time)) |
| 869 | { |
869 | { |
| 870 | // is the current player in |
870 | // is the current player in checkmate, in check, in stalemate or is it a capture ? (to play the right sound) |
| 871 | // read as: was the last move an opponent's move AND did it put us to check ? |
871 | // read as: was the last move an opponent's move AND did it put us to check ? |
| 872 | if (currentmove->is_check) |
872 | if (currentmove->is_check) |
| 873 | { |
873 | { |
| - | 874 | Audio_PlaySound (SOUNDTYPE_MOVE, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.04f); // play the normal move sound |
|
| - | 875 | ||
| 874 | // is it a checkmate or a normal check ? (checkmate == check + stalemate) |
876 | // is it a checkmate or a normal check ? (checkmate == check + stalemate) |
| 875 | if (currentmove->is_stalemate) |
877 | if (currentmove->is_stalemate) |
| 876 | Audio_PlaySound (board->players[currentmove->color].type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : |
878 | Audio_PlaySound (board->players[currentmove->color].type == PLAYER_HUMAN ? SOUNDTYPE_VICTORY : SOUNDTYPE_DEFEAT, 0.0f, 0.0f, 0.04f); // if so, play endgame sound at the center of the board |
| 877 | else |
879 | else |
| 878 | Audio_PlaySound ( |
880 | Audio_PlaySound (SOUNDTYPE_CHECK, 0.0f, 0.0f, 0.04f); // else play the check sound at the center of the board |
| 879 | } |
881 | } |
| 880 | else |
882 | else if (currentmove->is_stalemate) |
| 881 | { |
883 | { |
| 882 | // is it a stalemate, a capture or a normal move ? |
- | |
| 883 | if (currentmove->is_stalemate) |
- | |
| 884 |
|
884 | Audio_PlaySound (SOUNDTYPE_MOVE, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.04f); // play the normal move sound |
| 885 | else if (currentmove->has_captured) |
- | |
| 886 |
|
885 | Audio_PlaySound (SOUNDTYPE_DEFEAT, 0.0f, 0.0f, 0.04f); // on stalemate, play defeat sound at the center of the board |
| 887 | else |
- | |
| 888 | Audio_PlaySound (SOUNDTYPE_MOVE); // else play the normal move sound |
- | |
| 889 | } |
886 | } |
| - | 887 | else if (currentmove->has_captured) |
|
| - | 888 | Audio_PlaySound (SOUNDTYPE_PIECETAKEN, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.04f); // on capture, play the capture sound |
|
| - | 889 | else |
|
| - | 890 | Audio_PlaySound (SOUNDTYPE_MOVE, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.04f); // play the normal move sound |
|
| 890 | 891 | ||
| 891 | sound_playtime = 0; // mark this animation as completed and sound played |
892 | sound_playtime = 0; // mark this animation as completed and sound played |
| 892 | } |
893 | } |
| 893 | } |
894 | } |
| 894 | 895 | ||
| Line 926... | Line 927... | ||
| 926 | 927 | ||
| 927 | if (movement_ratio < 0.9f) |
928 | if (movement_ratio < 0.9f) |
| 928 | rooksound_played = false; // if the rook is still moving, reset the "sound played" flag |
929 | rooksound_played = false; // if the rook is still moving, reset the "sound played" flag |
| 929 | else if (!rooksound_played) |
930 | else if (!rooksound_played) |
| 930 | { |
931 | { |
| 931 | Audio_PlaySound ( |
932 | Audio_PlaySound (SOUNDTYPE_MOVE, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.04f); // when the rook has landed, play a move sound |
| 932 | rooksound_played = true; // remember this is no longer to be done |
933 | rooksound_played = true; // remember this is no longer to be done |
| 933 | } |
934 | } |
| 934 | } |
935 | } |
| 935 | else |
936 | else |
| 936 | { |
937 | { |