Rev 75 | Rev 119 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 75 | Rev 116 | ||
|---|---|---|---|
| Line 193... | Line 193... | ||
| 193 | 193 | ||
| 194 | // chessboard menu, beginning of game |
194 | // chessboard menu, beginning of game |
| 195 | else if (wParam_loword == MENUID_CHESSBOARD_BEGINNINGOFGAME) |
195 | else if (wParam_loword == MENUID_CHESSBOARD_BEGINNINGOFGAME) |
| 196 | { |
196 | { |
| 197 | the_board.viewed_move = 0; // enter view mode and go to the beginning of the game |
197 | the_board.viewed_move = 0; // enter view mode and go to the beginning of the game |
| 198 | Audio_PlaySound ( |
198 | Audio_PlaySound (SOUNDTYPE_CLICK, 0.0f, 0.0f, 0.04f); // make a click sound at the center of the board |
| 199 | the_board.reevaluate = true; // evaluate board again |
199 | the_board.reevaluate = true; // evaluate board again |
| 200 | } |
200 | } |
| 201 | 201 | ||
| 202 | // chessboard menu, previous move (only if arrow is enabled) |
202 | // chessboard menu, previous move (only if arrow is enabled) |
| 203 | else if ((wParam_loword == MENUID_CHESSBOARD_PREVIOUSMOVE) && (the_scene.gui.larrow.state != 0)) |
203 | else if ((wParam_loword == MENUID_CHESSBOARD_PREVIOUSMOVE) && (the_scene.gui.larrow.state != 0)) |
| 204 | { |
204 | { |
| 205 | the_board.viewed_move--; // enter view mode and go back one move |
205 | the_board.viewed_move--; // enter view mode and go back one move |
| 206 | Audio_PlaySound ( |
206 | Audio_PlaySound (SOUNDTYPE_CLICK, 0.0f, 0.0f, 0.04f); // make a click sound at the center of the board |
| 207 | the_board.reevaluate = true; // evaluate board again |
207 | the_board.reevaluate = true; // evaluate board again |
| 208 | } |
208 | } |
| 209 | 209 | ||
| 210 | // chessboard menu, next move (only if arrow is enabled) |
210 | // chessboard menu, next move (only if arrow is enabled) |
| 211 | else if ((wParam_loword == MENUID_CHESSBOARD_NEXTMOVE) && (the_scene.gui.rarrow.state != 0)) |
211 | else if ((wParam_loword == MENUID_CHESSBOARD_NEXTMOVE) && (the_scene.gui.rarrow.state != 0)) |
| 212 | { |
212 | { |
| 213 | the_board.viewed_move++; // enter view mode and go forward one move |
213 | the_board.viewed_move++; // enter view mode and go forward one move |
| 214 | Audio_PlaySound ( |
214 | Audio_PlaySound (SOUNDTYPE_CLICK, 0.0f, 0.0f, 0.04f); // make a click sound at the center of the board |
| 215 | the_board.reevaluate = true; // evaluate board again |
215 | the_board.reevaluate = true; // evaluate board again |
| 216 | } |
216 | } |
| 217 | 217 | ||
| 218 | // chessboard menu, current state of game |
218 | // chessboard menu, current state of game |
| 219 | else if (wParam_loword == MENUID_CHESSBOARD_CURRENTSTATEOFGAME) |
219 | else if (wParam_loword == MENUID_CHESSBOARD_CURRENTSTATEOFGAME) |
| 220 | { |
220 | { |
| 221 | the_board.viewed_move = the_board.move_count - 1; // enter view mode and go to the current state of the game |
221 | the_board.viewed_move = the_board.move_count - 1; // enter view mode and go to the current state of the game |
| 222 | Audio_PlaySound ( |
222 | Audio_PlaySound (SOUNDTYPE_CLICK, 0.0f, 0.0f, 0.04f); // make a click sound at the center of the board |
| 223 | the_board.reevaluate = true; // evaluate board again |
223 | the_board.reevaluate = true; // evaluate board again |
| 224 | } |
224 | } |
| 225 | 225 | ||
| 226 | // chessboard menu, top view |
226 | // chessboard menu, top view |
| 227 | else if (wParam_loword == MENUID_CHESSBOARD_TOPVIEW) |
227 | else if (wParam_loword == MENUID_CHESSBOARD_TOPVIEW) |
| Line 485... | Line 485... | ||
| 485 | // for each selectable part, if the mouse is on it, mark it as selected |
485 | // for each selectable part, if the mouse is on it, mark it as selected |
| 486 | for (part_index = 0; part_index < 13; part_index++) |
486 | for (part_index = 0; part_index < 13; part_index++) |
| 487 | if (Render_IsMouseInBox (gui_x, gui_y, part_index * (100.0f / 13.0f), 0, 100.0f / 13.0f, 11.0f)) |
487 | if (Render_IsMouseInBox (gui_x, gui_y, part_index * (100.0f / 13.0f), 0, 100.0f / 13.0f, 11.0f)) |
| 488 | { |
488 | { |
| 489 | the_scene.gui.partspick_selectedpart = selectable_parts[part_index]; // mark it as selected |
489 | the_scene.gui.partspick_selectedpart = selectable_parts[part_index]; // mark it as selected |
| 490 | Audio_PlaySound ( |
490 | Audio_PlaySound (SOUNDTYPE_CLICK, 0.0f, 0.0f, 0.04f); // make a click sound at the center of the board |
| 491 | break; // no need to search further if one selection was found |
491 | break; // no need to search further if one selection was found |
| 492 | } |
492 | } |
| 493 | } |
493 | } |
| 494 | 494 | ||
| 495 | // get current player and see if we're online |
495 | // get current player and see if we're online |
| Line 548... | Line 548... | ||
| 548 | && (the_scene.gui.partspick_selectedpart != 'k')) |
548 | && (the_scene.gui.partspick_selectedpart != 'k')) |
| 549 | { |
549 | { |
| 550 | // is it ALREADY the king's default location ? if so, give up |
550 | // is it ALREADY the king's default location ? if so, give up |
| 551 | if ((line == 7) && (column == 4)) |
551 | if ((line == 7) && (column == 4)) |
| 552 | { |
552 | { |
| 553 | Audio_PlaySound ( |
553 | Audio_PlaySound (SOUNDTYPE_ILLEGALMOVE, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.04f); // play the "illegal move" sound |
| 554 | return (DefWindowProc (hWnd, message, wParam, lParam)); // call the default window message proc |
554 | return (DefWindowProc (hWnd, message, wParam, lParam)); // call the default window message proc |
| 555 | } |
555 | } |
| 556 | 556 | ||
| 557 | Move_SetSlot (current_move, 7, 4, COLOR_BLACK, PART_KING); // replace black king |
557 | Move_SetSlot (current_move, 7, 4, COLOR_BLACK, PART_KING); // replace black king |
| 558 | } |
558 | } |
| Line 560... | Line 560... | ||
| 560 | && (the_scene.gui.partspick_selectedpart != 'K')) |
560 | && (the_scene.gui.partspick_selectedpart != 'K')) |
| 561 | { |
561 | { |
| 562 | // is it ALREADY the king's default location ? if so, give up |
562 | // is it ALREADY the king's default location ? if so, give up |
| 563 | if ((line == 0) && (column == 4)) |
563 | if ((line == 0) && (column == 4)) |
| 564 | { |
564 | { |
| 565 | Audio_PlaySound ( |
565 | Audio_PlaySound (SOUNDTYPE_ILLEGALMOVE, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.04f); // play the "illegal move" sound |
| 566 | return (DefWindowProc (hWnd, message, wParam, lParam)); // call the default window message proc |
566 | return (DefWindowProc (hWnd, message, wParam, lParam)); // call the default window message proc |
| 567 | } |
567 | } |
| 568 | 568 | ||
| 569 | Move_SetSlot (current_move, 0, 4, COLOR_WHITE, PART_KING); // replace white king |
569 | Move_SetSlot (current_move, 0, 4, COLOR_WHITE, PART_KING); // replace white king |
| 570 | } |
570 | } |
| Line 594... | Line 594... | ||
| 594 | else |
594 | else |
| 595 | Move_SetSlot (current_move, line, column, 0, PART_NONE); // no part |
595 | Move_SetSlot (current_move, line, column, 0, PART_NONE); // no part |
| 596 | 596 | ||
| 597 | // figure out which sound to play |
597 | // figure out which sound to play |
| 598 | if (the_scene.gui.partspick_selectedpart != ' ') |
598 | if (the_scene.gui.partspick_selectedpart != ' ') |
| 599 | Audio_PlaySound ( |
599 | Audio_PlaySound (SOUNDTYPE_MOVE, 17.5f - (7 - column) * 5.0f, 17.5f - line * 5.0f, 0.04f); // play a move sound when placing a part |
| 600 | 600 | ||
| 601 | the_scene.update = true; // update the 3D scene |
601 | the_scene.update = true; // update the 3D scene |
| 602 | 602 | ||
| 603 | // call the default window message processing function to keep things going |
603 | // call the default window message processing function to keep things going |
| 604 | return (DefWindowProc (hWnd, message, wParam, lParam)); |
604 | return (DefWindowProc (hWnd, message, wParam, lParam)); |
| Line 658... | Line 658... | ||
| 658 | || (current_move->slots[the_board.hovered_position[0]][the_board.hovered_position[1]].flags & FLAG_TAKEABLE)) |
658 | || (current_move->slots[the_board.hovered_position[0]][the_board.hovered_position[1]].flags & FLAG_TAKEABLE)) |
| 659 | { |
659 | { |
| 660 | // are we in check after the move ? (FIXME: call EP version of this func for en passant moves) |
660 | // are we in check after the move ? (FIXME: call EP version of this func for en passant moves) |
| 661 | if (Move_IsColorInCheckAfterTestMove (current_move, the_board.selected_position[0], the_board.selected_position[1], the_board.hovered_position[0], the_board.hovered_position[1], Board_ColorToMove (&the_board))) |
661 | if (Move_IsColorInCheckAfterTestMove (current_move, the_board.selected_position[0], the_board.selected_position[1], the_board.hovered_position[0], the_board.hovered_position[1], Board_ColorToMove (&the_board))) |
| 662 | { |
662 | { |
| 663 | Audio_PlaySound ( |
663 | Audio_PlaySound (SOUNDTYPE_ILLEGALMOVE, 17.5f - (7 - the_board.hovered_position[1]) * 5.0f, 17.5f - the_board.hovered_position[0] * 5.0f, 0.04f); // play the "illegal move" sound |
| 664 | 664 | ||
| 665 | the_scene.update = true; // update the 3D scene |
665 | the_scene.update = true; // update the 3D scene |
| 666 | 666 | ||
| 667 | // call the default window message processing function to keep things going |
667 | // call the default window message processing function to keep things going |
| 668 | return (DefWindowProc (hWnd, message, wParam, lParam)); |
668 | return (DefWindowProc (hWnd, message, wParam, lParam)); |
| Line 699... | Line 699... | ||
| 699 | return (DefWindowProc (hWnd, message, wParam, lParam)); |
699 | return (DefWindowProc (hWnd, message, wParam, lParam)); |
| 700 | } |
700 | } |
| 701 | 701 | ||
| 702 | // else it's another location |
702 | // else it's another location |
| 703 | 703 | ||
| 704 | Audio_PlaySound ( |
704 | Audio_PlaySound (SOUNDTYPE_ILLEGALMOVE, 17.5f - (7 - the_board.hovered_position[1]) * 5.0f, 17.5f - the_board.hovered_position[0] * 5.0f, 0.04f); // play the "illegal move" sound |
| 705 | 705 | ||
| 706 | the_scene.update = true; // update the 3D scene |
706 | the_scene.update = true; // update the 3D scene |
| 707 | 707 | ||
| 708 | // call the default window message processing function to keep things going |
708 | // call the default window message processing function to keep things going |
| 709 | return (DefWindowProc (hWnd, message, wParam, lParam)); |
709 | return (DefWindowProc (hWnd, message, wParam, lParam)); |
| Line 1057... | Line 1057... | ||
| 1057 | else if (wParam == 0x0d) |
1057 | else if (wParam == 0x0d) |
| 1058 | the_scene.gui.is_entering_text = false; // enter, exit from the text entering mode (this will validate our reply) |
1058 | the_scene.gui.is_entering_text = false; // enter, exit from the text entering mode (this will validate our reply) |
| 1059 | 1059 | ||
| 1060 | // else it's an illegal character |
1060 | // else it's an illegal character |
| 1061 | else |
1061 | else |
| 1062 | Audio_PlaySound ( |
1062 | Audio_PlaySound (SOUNDTYPE_ILLEGALMOVE, 0.0f, 0.0f, 0.04f); // illegal character, beep the illegal move sound at the center of the board |
| 1063 | } |
1063 | } |
| 1064 | 1064 | ||
| 1065 | the_scene.update = true; // update the 3D scene |
1065 | the_scene.update = true; // update the 3D scene |
| 1066 | 1066 | ||
| 1067 | // call the default window message processing function to keep things going |
1067 | // call the default window message processing function to keep things going |