Rev 136 | Rev 145 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 136 | Rev 140 | ||
---|---|---|---|
Line 71... | Line 71... | ||
71 | #ifdef NDEBUG |
71 | #ifdef NDEBUG |
72 | want_framerate = false; // release mode, don't display framerate |
72 | want_framerate = false; // release mode, don't display framerate |
73 | #else |
73 | #else |
74 | want_framerate = true; // display framerate in debug mode |
74 | want_framerate = true; // display framerate in debug mode |
75 | #endif // NDEBUG |
75 | #endif // NDEBUG |
- | 76 | is_dialogbox_displayed = false; |
|
76 | is_dialogbox_about_validated = false; |
77 | is_dialogbox_about_validated = false; |
77 | is_dialogbox_challenge_validated = false; |
78 | is_dialogbox_challenge_validated = false; |
78 | is_dialogbox_changeappearance_validated = false; |
79 | is_dialogbox_changeappearance_validated = false; |
79 | is_dialogbox_comment_validated = false; |
80 | is_dialogbox_comment_validated = false; |
80 | is_dialogbox_endgame_validated = false; |
81 | is_dialogbox_endgame_validated = false; |
Line 239... | Line 240... | ||
239 | // initialize audio and renderer, and display a cleaner version of the splash screen this time :) |
240 | // initialize audio and renderer, and display a cleaner version of the splash screen this time :) |
240 | if (!Audio_Init () || !Render_Init (L"%s/data/splash.bmp", app_path)) |
241 | if (!Audio_Init () || !Render_Init (L"%s/data/splash.bmp", app_path)) |
241 | return (-1); // bomb out on error |
242 | return (-1); // bomb out on error |
242 | 243 | ||
243 | // load sprites |
244 | // load sprites |
- | 245 | llarrow_spriteindex = Render_LoadSprite (L"%s/data/sprites/arrow-leftmost.png", app_path); |
|
244 | larrow_spriteindex = Render_LoadSprite (L"%s/data/sprites/arrow-left.png", app_path); |
246 | larrow_spriteindex = Render_LoadSprite (L"%s/data/sprites/arrow-left.png", app_path); |
245 | rarrow_spriteindex = Render_LoadSprite (L"%s/data/sprites/arrow-right.png", app_path); |
247 | rarrow_spriteindex = Render_LoadSprite (L"%s/data/sprites/arrow-right.png", app_path); |
- | 248 | rrarrow_spriteindex = Render_LoadSprite (L"%s/data/sprites/arrow-rightmost.png", app_path); |
|
246 | newgamebutton_spriteindex = Render_LoadSprite (L"%s/data/sprites/newgame.png", app_path); |
249 | newgamebutton_spriteindex = Render_LoadSprite (L"%s/data/sprites/newgame.png", app_path); |
247 | opengamebutton_spriteindex = Render_LoadSprite (L"%s/data/sprites/opengame.png", app_path); |
250 | opengamebutton_spriteindex = Render_LoadSprite (L"%s/data/sprites/opengame.png", app_path); |
248 | chatbutton_spriteindex = Render_LoadSprite (L"%s/data/sprites/chat.png", app_path); |
251 | chatbutton_spriteindex = Render_LoadSprite (L"%s/data/sprites/chat.png", app_path); |
249 | gamesbutton_spriteindex = Render_LoadSprite (L"%s/data/sprites/games.png", app_path); |
252 | gamesbutton_spriteindex = Render_LoadSprite (L"%s/data/sprites/games.png", app_path); |
250 | peoplebutton_spriteindex = Render_LoadSprite (L"%s/data/sprites/people.png", app_path); |
253 | peoplebutton_spriteindex = Render_LoadSprite (L"%s/data/sprites/people.png", app_path); |
Line 513... | Line 516... | ||
513 | // get current and opposite players, and see if we're online |
516 | // get current and opposite players, and see if we're online |
514 | current_player = Player_GetCurrent (); |
517 | current_player = Player_GetCurrent (); |
515 | opposite_player = Player_GetOpposite (); |
518 | opposite_player = Player_GetOpposite (); |
516 | network_player = Player_FindByType (PLAYER_INTERNET); |
519 | network_player = Player_FindByType (PLAYER_INTERNET); |
517 | 520 | ||
518 | // if the view distance |
521 | // if no dialog box is in focus AND the view distance and pitch is lower than the minimum, enable the "new game" and "open game" buttons |
519 | if ((network_player == NULL) && (current_distance == CLOSEUP_VIEW_DISTANCE) && (current_pitch == CLOSEUP_VIEW_PITCH)) |
522 | if (!is_dialogbox_displayed && (network_player == NULL) && (current_distance == CLOSEUP_VIEW_DISTANCE) && (current_pitch == CLOSEUP_VIEW_PITCH)) |
520 | { |
523 | { |
521 | GUIBUTTON_ENABLE (the_scene.gui.newgamebutton); |
524 | GUIBUTTON_ENABLE (the_scene.gui.newgamebutton); |
522 | GUIBUTTON_ENABLE (the_scene.gui.opengamebutton); |
525 | GUIBUTTON_ENABLE (the_scene.gui.opengamebutton); |
523 | } |
526 | } |
524 | else |
527 | else |
Line 607... | Line 610... | ||
607 | // yes. Propose it to the side that's on move |
610 | // yes. Propose it to the side that's on move |
608 | // TODO: non-modal MessageBox (copy dialog_newgame.cpp and use return values) |
611 | // TODO: non-modal MessageBox (copy dialog_newgame.cpp and use return values) |
609 | } |
612 | } |
610 | } |
613 | } |
611 | 614 | ||
- | 615 | GUIBUTTON_ENABLE (the_scene.gui.llarrow); // enable "jump to beginning" arrow if it isn't displayed yet |
|
612 | GUIBUTTON_ENABLE (the_scene.gui.larrow); // enable "back" arrow if it isn't displayed yet |
616 | GUIBUTTON_ENABLE (the_scene.gui.larrow); // enable "back" arrow if it isn't displayed yet |
613 | GUIBUTTON_DISABLE (the_scene.gui.rarrow); // disable "forward" arrow if it's already displayed |
617 | GUIBUTTON_DISABLE (the_scene.gui.rarrow); // disable "forward" arrow if it's already displayed |
- | 618 | GUIBUTTON_DISABLE (the_scene.gui.rrarrow); // disable "jump to end" arrow if it's already displayed |
|
614 | 619 | ||
615 | if (the_board.game_state == STATE_PLAYING) |
620 | if (the_board.game_state == STATE_PLAYING) |
616 | Scene_SetText (&the_scene.gui.arrow_text, 3.3f, 5.0f, -1, ALIGN_CENTER, ALIGN_TOP, ALIGN_CENTER, arrow_fontindex, |
- | |
617 |
|
621 | Scene_UpdateText (&the_scene.gui.arrow_text, RGBACOLOR_SETALPHA (options.clock_color, 0x7f), DURATION_INFINITE, false, LOCALIZE (is_paused ? L"Paused" : L"Current")); |
618 | else if ((the_board.game_state == STATE_BLACKWIN_CHECKMATE) || (the_board.game_state == STATE_WHITEWIN_CHECKMATE)) |
622 | else if ((the_board.game_state == STATE_BLACKWIN_CHECKMATE) || (the_board.game_state == STATE_WHITEWIN_CHECKMATE)) |
619 | Scene_SetText (&the_scene.gui.arrow_text, 3.3f, 5.0f, -1, ALIGN_CENTER, ALIGN_TOP, ALIGN_CENTER, arrow_fontindex, |
- | |
620 |
|
623 | Scene_UpdateText (&the_scene.gui.arrow_text, RGBACOLOR_SETALPHA (options.clock_color, 0x7f), DURATION_INFINITE, false, L"%s\n%s", LOCALIZE (L"EndGame_CheckMate"), LOCALIZE (L"EndGame_Title")); |
621 | else if ((the_board.game_state == STATE_WHITEWIN_RESIGNORFORFEIT) || (the_board.game_state == STATE_BLACKWIN_RESIGNORFORFEIT)) |
624 | else if ((the_board.game_state == STATE_WHITEWIN_RESIGNORFORFEIT) || (the_board.game_state == STATE_BLACKWIN_RESIGNORFORFEIT)) |
622 | Scene_SetText (&the_scene.gui.arrow_text, 3.3f, 5.0f, -1, ALIGN_CENTER, ALIGN_TOP, ALIGN_CENTER, arrow_fontindex, |
- | |
623 |
|
625 | Scene_UpdateText (&the_scene.gui.arrow_text, RGBACOLOR_SETALPHA (options.clock_color, 0x7f), DURATION_INFINITE, false, L"%s\n%s", LOCALIZE (L"EndGame_Resign"), LOCALIZE (L"EndGame_Title")); |
624 | else if (the_board.game_state == STATE_DRAW_STALEMATE) |
626 | else if (the_board.game_state == STATE_DRAW_STALEMATE) |
625 | Scene_SetText (&the_scene.gui.arrow_text, 3.3f, 5.0f, -1, ALIGN_CENTER, ALIGN_TOP, ALIGN_CENTER, arrow_fontindex, |
- | |
626 |
|
627 | Scene_UpdateText (&the_scene.gui.arrow_text, RGBACOLOR_SETALPHA (options.clock_color, 0x7f), DURATION_INFINITE, false, L"%s\n%s", LOCALIZE (L"EndGame_StaleMate"), LOCALIZE (L"EndGame_Title")); |
627 | else if (the_board.game_state == STATE_DRAW_AGREEMENT) |
628 | else if (the_board.game_state == STATE_DRAW_AGREEMENT) |
628 | Scene_SetText (&the_scene.gui.arrow_text, 3.3f, 5.0f, -1, ALIGN_CENTER, ALIGN_TOP, ALIGN_CENTER, arrow_fontindex, |
- | |
629 |
|
629 | Scene_UpdateText (&the_scene.gui.arrow_text, RGBACOLOR_SETALPHA (options.clock_color, 0x7f), DURATION_INFINITE, false, L"%s\n%s", LOCALIZE (L"EndGame_Agreement"), LOCALIZE (L"EndGame_Title")); |
630 | else if (the_board.game_state == STATE_DRAW_OTHER) |
630 | else if (the_board.game_state == STATE_DRAW_OTHER) |
631 | Scene_SetText (&the_scene.gui.arrow_text, 3.3f, 5.0f, -1, ALIGN_CENTER, ALIGN_TOP, ALIGN_CENTER, arrow_fontindex, |
- | |
632 |
|
631 | Scene_UpdateText (&the_scene.gui.arrow_text, RGBACOLOR_SETALPHA (options.clock_color, 0x7f), DURATION_INFINITE, false, L"%s\n%s", LOCALIZE (L"EndGame_DrawOther"), LOCALIZE (L"EndGame_Title")); |
633 | 632 | ||
634 | // enable the "comment on this move" menu option |
633 | // enable the "comment on this move" menu option |
635 | EnableMenuItem (GetMenu (hMainWnd), MENUID_MOVE_COMMENTMOVE, MF_ENABLED); |
634 | EnableMenuItem (GetMenu (hMainWnd), MENUID_MOVE_COMMENTMOVE, MF_ENABLED); |
636 | } |
635 | } |
637 | 636 | ||
638 | // else are we watching another move, but not the beginning of the game ? |
637 | // else are we watching another move, but not the beginning of the game ? |
639 | else if (the_board.viewed_move > 0) |
638 | else if (the_board.viewed_move > 0) |
640 | { |
639 | { |
- | 640 | GUIBUTTON_ENABLE (the_scene.gui.llarrow); // enable "jump to beginning" arrow if it isn't displayed yet |
|
641 | GUIBUTTON_ENABLE (the_scene.gui.larrow); // enable "back" arrow if it isn't displayed yet |
641 | GUIBUTTON_ENABLE (the_scene.gui.larrow); // enable "back" arrow if it isn't displayed yet |
642 | GUIBUTTON_ENABLE (the_scene.gui.rarrow); // enable "forward" arrow if it isn't displayed yet |
642 | GUIBUTTON_ENABLE (the_scene.gui.rarrow); // enable "forward" arrow if it isn't displayed yet |
643 |
|
643 | GUIBUTTON_ENABLE (the_scene.gui.rrarrow); // enable "jump to end" arrow if it isn't displayed yet |
644 | RGBACOLOR_SETALPHA (options.clock_color, 0x7f), 999999.0f, false, |
- | |
645 |
|
644 | Scene_UpdateText (&the_scene.gui.arrow_text, RGBACOLOR_SETALPHA (options.clock_color, 0x7f), DURATION_INFINITE, false, L"%s %d\n%s", LOCALIZE (L"Move"), (the_board.viewed_move + 1) / 2, (the_board.viewed_move % 2 ? LOCALIZE (L"Games_White"): LOCALIZE (L"Games_Black"))); |
646 | 645 | ||
647 | // hints are not usable when watching the game history |
646 | // hints are not usable when watching the game history |
648 | EnableMenuItem (GetMenu (hMainWnd), MENUID_MOVE_SUGGESTMOVE, MF_GRAYED); |
647 | EnableMenuItem (GetMenu (hMainWnd), MENUID_MOVE_SUGGESTMOVE, MF_GRAYED); |
649 | 648 | ||
650 | // enable the "save position as" and "comment on this move" menu options |
649 | // enable the "save position as" and "comment on this move" menu options |
Line 653... | Line 652... | ||
653 | } |
652 | } |
654 | 653 | ||
655 | // else we must be watching the beginning of the game (no move yet) |
654 | // else we must be watching the beginning of the game (no move yet) |
656 | else |
655 | else |
657 | { |
656 | { |
- | 657 | GUIBUTTON_DISABLE (the_scene.gui.llarrow); // disable "jump to beginning" arrow if it's already displayed |
|
658 | GUIBUTTON_DISABLE (the_scene.gui.larrow); // disable "back" arrow if it's already displayed |
658 | GUIBUTTON_DISABLE (the_scene.gui.larrow); // disable "back" arrow if it's already displayed |
659 | GUIBUTTON_ENABLE (the_scene.gui.rarrow); // enable "forward" arrow if it isn't displayed yet |
659 | GUIBUTTON_ENABLE (the_scene.gui.rarrow); // enable "forward" arrow if it isn't displayed yet |
660 |
|
660 | GUIBUTTON_ENABLE (the_scene.gui.rrarrow); // enable "jump to end" arrow if it isn't displayed yet |
661 |
|
661 | Scene_UpdateText (&the_scene.gui.arrow_text, RGBACOLOR_SETALPHA (options.clock_color, 0x7f), DURATION_INFINITE, false, LOCALIZE (L"Beginning")); |
662 | 662 | ||
663 | // hints are not usable when watching the game history |
663 | // hints are not usable when watching the game history |
664 | EnableMenuItem (GetMenu (hMainWnd), MENUID_MOVE_SUGGESTMOVE, MF_GRAYED); |
664 | EnableMenuItem (GetMenu (hMainWnd), MENUID_MOVE_SUGGESTMOVE, MF_GRAYED); |
665 | 665 | ||
666 | // disable the "save position as" and "comment on this move" menu options |
666 | // disable the "save position as" and "comment on this move" menu options |
Line 689... | Line 689... | ||
689 | EnableMenuItem (GetMenu (hMainWnd), MENUID_MOVE_COMMENTMOVE, MF_GRAYED); |
689 | EnableMenuItem (GetMenu (hMainWnd), MENUID_MOVE_COMMENTMOVE, MF_GRAYED); |
690 | EnableMenuItem (GetMenu (hMainWnd), MENUID_MOVE_GOTOMOVE, MF_GRAYED); |
690 | EnableMenuItem (GetMenu (hMainWnd), MENUID_MOVE_GOTOMOVE, MF_GRAYED); |
691 | 691 | ||
692 | is_paused = false; // clear pause status (we can only pause a game when it's been started) |
692 | is_paused = false; // clear pause status (we can only pause a game when it's been started) |
693 | 693 | ||
694 | // and disable the |
694 | // and disable the navigation arrows and the arrow text |
- | 695 | GUIBUTTON_DISABLE (the_scene.gui.llarrow); |
|
695 | GUIBUTTON_DISABLE (the_scene.gui.larrow); |
696 | GUIBUTTON_DISABLE (the_scene.gui.larrow); |
696 | GUIBUTTON_DISABLE (the_scene.gui.rarrow); |
697 | GUIBUTTON_DISABLE (the_scene.gui.rarrow); |
- | 698 | GUIBUTTON_DISABLE (the_scene.gui.rrarrow); |
|
697 | the_scene.gui.arrow_text.is_displayed = false; |
699 | the_scene.gui.arrow_text.is_displayed = false; |
698 | } |
700 | } |
699 | 701 | ||
700 | // no matter whether the game started or not, if the current player is a human AND its opponent is a computer, allow him to swap sides |
702 | // no matter whether the game started or not, if the current player is a human AND its opponent is a computer, allow him to swap sides |
701 | if ((current_player->type == PLAYER_HUMAN) && (opposite_player->type == PLAYER_COMPUTER)) |
703 | if ((current_player->type == PLAYER_HUMAN) && (opposite_player->type == PLAYER_COMPUTER)) |