Rev 171 | Rev 185 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 171 | Rev 181 | ||
---|---|---|---|
Line 19... | Line 19... | ||
19 | 2.35f, // #define PART_BISHOP 3 |
19 | 2.35f, // #define PART_BISHOP 3 |
20 | 2.25f, // #define PART_KNIGHT 4 |
20 | 2.25f, // #define PART_KNIGHT 4 |
21 | 2.15f, // #define PART_ROOK 5 |
21 | 2.15f, // #define PART_ROOK 5 |
22 | 2.0f, // #define PART_PAWN 6 |
22 | 2.0f, // #define PART_PAWN 6 |
23 | }; |
23 | }; |
24 | static bool has_endsound_played = |
24 | static bool has_endsound_played = true; // yes, true. |
25 | 25 | ||
26 | 26 | ||
27 | void Scene_Init (scene_t *scene, board_t *board) |
27 | void Scene_Init (scene_t *scene, board_t *board) |
28 | { |
28 | { |
29 | // this function initializes the scene objects array and inserts the chess table in it |
29 | // this function initializes the scene objects array and inserts the chess table in it |
Line 888... | Line 888... | ||
888 | Scene_AddPart (scene, boardslot->part, boardslot->color, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.04f, 0.0f, 0.0f); |
888 | Scene_AddPart (scene, boardslot->part, boardslot->color, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.04f, 0.0f, 0.0f); |
889 | else |
889 | else |
890 | Scene_AddTile (scene, theme->flattextures[boardslot->color][boardslot->part], 2.5f, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.05f, flaticons_yaw); |
890 | Scene_AddTile (scene, theme->flattextures[boardslot->color][boardslot->part], 2.5f, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.05f, flaticons_yaw); |
891 | } |
891 | } |
892 | 892 | ||
893 | // is it time to play a "start of animation" sound ? |
893 | // is it time to play a "start of animation" sound ? (small window of 1/10th sec, if we miss it, don't play anything) |
894 | if ( |
894 | if (has_endsound_played && (animation_endtime - ANIMATION_DURATION < current_time) && (animation_endtime - ANIMATION_DURATION + 0.1f > current_time)) |
895 | { |
895 | { |
896 | has_endsound_played = false; // an animation just started, remember the ending sound hasn't played yet |
896 | has_endsound_played = false; // an animation just started, remember the ending sound hasn't played yet |
897 | if (is_sliding) |
897 | if (is_sliding) |
898 | Audio_PlaySound (SOUNDTYPE_SLIDE, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.04f); // play the sliding move sound |
898 | Audio_PlaySound (SOUNDTYPE_SLIDE, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.04f); // play the sliding move sound |
899 | } |
899 | } |
900 | 900 | ||
901 | // is it time to play an "end of animation" sound ? |
901 | // is it time to play an "end of animation" sound ? |
902 | else if ((animation_endtime - 0.1f < current_time) |
902 | else if (!has_endsound_played && (animation_endtime - 0.1f < current_time)) |
903 | { |
903 | { |
904 | if (!is_sliding) |
904 | if (!is_sliding) |
905 | Audio_PlaySound (SOUNDTYPE_MOVE, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.04f); // play the normal move sound (unless the part was sliding) |
905 | Audio_PlaySound (SOUNDTYPE_MOVE, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.04f); // play the normal move sound (unless the part was sliding) |
906 | 906 | ||
907 | if (currentmove->has_captured) |
907 | if (currentmove->has_captured) |