Subversion Repositories Games.Chess Giants

Rev

Rev 192 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 192 Rev 194
Line 99... Line 99...
99
   hMOTDWnd = NULL;
99
   hMOTDWnd = NULL;
100
   hOpponentsWnd = NULL;
100
   hOpponentsWnd = NULL;
101
   hSoughtWnd = NULL;
101
   hSoughtWnd = NULL;
102
   is_paused = false; // clear pause status
102
   is_paused = false; // clear pause status
103
#ifdef NO_REGISTRATION
103
#ifdef NO_REGISTRATION
104
   is_registered = true;
-
 
105
   want_framerate = true; // display framerate in debug mode
104
   want_framerate = IsDebuggerPresent (); // display framerate in debug mode
106
#else // !NO_REGISTRATION
105
#else // !NO_REGISTRATION
107
   is_registered = false;
106
   is_registered = false;
108
   dont_nag = false;
107
   dont_nag = false;
109
   want_framerate = false; // release mode, don't display framerate
108
   want_framerate = false; // release mode, don't display framerate
110
#endif // NO_REGISTRATION
109
#endif // NO_REGISTRATION
Line 203... Line 202...
203
   wc.hInstance = hAppInstance;
202
   wc.hInstance = hAppInstance;
204
   wc.hIcon = LoadIcon (hAppInstance, (wchar_t *) ICON_MAIN);
203
   wc.hIcon = LoadIcon (hAppInstance, (wchar_t *) ICON_MAIN);
205
   wc.hCursor = LoadCursor (NULL, IDC_ARROW);
204
   wc.hCursor = LoadCursor (NULL, IDC_ARROW);
206
   wc.lpszClassName = PROGRAM_NAME L" WndClass";
205
   wc.lpszClassName = PROGRAM_NAME L" WndClass";
207
   RegisterClassEx (&wc);
206
   RegisterClassEx (&wc);
208
   swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), PROGRAM_NAME L"%s", (is_registered ? L"" : LOCALIZE (L"EvaluationMode"))); // build window title
207
   swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), PROGRAM_NAME L"%s",
-
 
208
#ifndef NO_REGISTRATION
-
 
209
               (is_registered ?
-
 
210
#endif // !NO_REGISTRATION
-
 
211
               L""
-
 
212
#ifndef NO_REGISTRATION
-
 
213
               : LOCALIZE (L"EvaluationMode"))
-
 
214
#endif // !NO_REGISTRATION
-
 
215
   ); // build window title
209
   if (options.want_fullscreen)
216
   if (options.want_fullscreen)
210
      hMainWnd = CreateWindowEx (0, wc.lpszClassName, temp_string, WS_POPUPWINDOW, // temp_string holds window title
217
      hMainWnd = CreateWindowEx (0, wc.lpszClassName, temp_string, WS_POPUPWINDOW, // temp_string holds window title
211
                                 0, 0, GetSystemMetrics (SM_CXSCREEN), GetSystemMetrics (SM_CYSCREEN), NULL, NULL, hAppInstance, NULL);
218
                                 0, 0, GetSystemMetrics (SM_CXSCREEN), GetSystemMetrics (SM_CYSCREEN), NULL, NULL, hAppInstance, NULL);
212
   else
219
   else
213
   {
220
   {
Line 362... Line 369...
362
         SendInput (1, &mousemove_input, sizeof (mousemove_input)); // send a fake mouse move input event
369
         SendInput (1, &mousemove_input, sizeof (mousemove_input)); // send a fake mouse move input event
363
 
370
 
364
         screensaverwatchdog_feedtime = current_time + 50.0f; // feed screensaver watchdog again in 50 seconds
371
         screensaverwatchdog_feedtime = current_time + 50.0f; // feed screensaver watchdog again in 50 seconds
365
      }
372
      }
366
 
373
 
-
 
374
#ifndef NO_REGISTRATION
367
      // are we in demo mode and is it time to quit ?
375
      // are we in demo mode and is it time to quit ?
368
      if (!is_registered && (current_time > DEMO_TIMEOUT))
376
      if (!is_registered && (current_time > DEMO_TIMEOUT))
369
         DestroyWindow (hMainWnd); // if so, send a quit message in order to break the loop
377
         DestroyWindow (hMainWnd); // if so, send a quit message in order to break the loop
-
 
378
#endif // !NO_REGISTRATION
370
 
379
 
371
      // are we in the middle of an animation or just after it ?
380
      // are we in the middle of an animation or just after it ?
372
      if (current_time < animation_endtime + 0.5f)
381
      if (current_time < animation_endtime + 0.5f)
373
         the_scene.update = true; // always update during animations
382
         the_scene.update = true; // always update during animations
374
      else
383
      else
Line 415... Line 424...
415
      if (is_window_motd_validated) Window_MOTD_Validated ();
424
      if (is_window_motd_validated) Window_MOTD_Validated ();
416
      if (is_window_opponents_validated) Window_Opponents_Validated ();
425
      if (is_window_opponents_validated) Window_Opponents_Validated ();
417
      if (is_window_sought_validated) Window_Sought_Validated ();
426
      if (is_window_sought_validated) Window_Sought_Validated ();
418
 
427
 
419
      MainLoop_EvaluateGameState (); // evaluate game state
428
      MainLoop_EvaluateGameState (); // evaluate game state
420
 
429
 
421
      // is the table rotating ?
430
      // is the table rotating ?
422
      if (Player_RotateTable (&the_board.players[current_viewer], current_time - previous_time))
431
      if (Player_RotateTable (&the_board.players[current_viewer], current_time - previous_time))
423
         the_scene.update = true; // if so, update the scene
432
         the_scene.update = true; // if so, update the scene
424
 
433
 
425
      // are we highlighting something ?
434
      // are we highlighting something ?
Line 555... Line 564...
555
 
564
 
556
 
565
 
557
static void MainLoop_EvaluateGameState (void)
566
static void MainLoop_EvaluateGameState (void)
558
{
567
{
559
   // function to evaluate the game state in the main loop when a part has just moved
568
   // function to evaluate the game state in the main loop when a part has just moved
560
 
569
 
561
   static wchar_t window_title[256];
570
   static wchar_t window_title[256];
562
 
571
 
563
   player_t *current_player;
572
   player_t *current_player;
564
   player_t *opposite_player;
573
   player_t *opposite_player;
565
   player_t *network_player;
574
   player_t *network_player;
Line 695... Line 704...
695
         GUIBUTTON_ENABLE (the_scene.gui.larrow); // enable "back" arrow if it isn't displayed yet
704
         GUIBUTTON_ENABLE (the_scene.gui.larrow); // enable "back" arrow if it isn't displayed yet
696
         GUIBUTTON_ENABLE (the_scene.gui.rarrow); // enable "forward" arrow if it isn't displayed yet
705
         GUIBUTTON_ENABLE (the_scene.gui.rarrow); // enable "forward" arrow if it isn't displayed yet
697
         GUIBUTTON_ENABLE (the_scene.gui.rrarrow); // enable "jump to end" arrow if it isn't displayed yet
706
         GUIBUTTON_ENABLE (the_scene.gui.rrarrow); // enable "jump to end" arrow if it isn't displayed yet
698
         Scene_UpdateText (&the_scene.gui.arrow_text, RGBA_TO_RGBACOLOR (255, 255, 255, 191), 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")));
707
         Scene_UpdateText (&the_scene.gui.arrow_text, RGBA_TO_RGBACOLOR (255, 255, 255, 191), 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")));
699
 
708
 
700
         // hints are not usable when watching the game history
709
         // hints are not usable when watching the game history
701
         EnableMenuItem (GetMenu (hMainWnd), MENUID_MOVE_SUGGESTMOVE, MF_GRAYED);
710
         EnableMenuItem (GetMenu (hMainWnd), MENUID_MOVE_SUGGESTMOVE, MF_GRAYED);
702
 
711
 
703
         // enable the "save position as" and "comment on this move" menu options
712
         // enable the "save position as" and "comment on this move" menu options
704
         EnableMenuItem (GetMenu (hMainWnd), MENUID_GAME_SAVEPOSITIONAS, MF_ENABLED);
713
         EnableMenuItem (GetMenu (hMainWnd), MENUID_GAME_SAVEPOSITIONAS, MF_ENABLED);
705
         EnableMenuItem (GetMenu (hMainWnd), MENUID_MOVE_COMMENTMOVE, MF_ENABLED);
714
         EnableMenuItem (GetMenu (hMainWnd), MENUID_MOVE_COMMENTMOVE, MF_ENABLED);
706
      }
715
      }
707
 
716
 
Line 749... Line 758...
749
      GUIBUTTON_DISABLE (the_scene.gui.llarrow);
758
      GUIBUTTON_DISABLE (the_scene.gui.llarrow);
750
      GUIBUTTON_DISABLE (the_scene.gui.larrow);
759
      GUIBUTTON_DISABLE (the_scene.gui.larrow);
751
      GUIBUTTON_DISABLE (the_scene.gui.rarrow);
760
      GUIBUTTON_DISABLE (the_scene.gui.rarrow);
752
      GUIBUTTON_DISABLE (the_scene.gui.rrarrow);
761
      GUIBUTTON_DISABLE (the_scene.gui.rrarrow);
753
      the_scene.gui.arrow_text.is_displayed = false;
762
      the_scene.gui.arrow_text.is_displayed = false;
754
   }
763
   }
755
 
764
 
756
   // 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
765
   // 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
757
   if ((current_player->type == PLAYER_HUMAN) && (opposite_player->type == PLAYER_COMPUTER))
766
   if ((current_player->type == PLAYER_HUMAN) && (opposite_player->type == PLAYER_COMPUTER))
758
      EnableMenuItem (GetMenu (hMainWnd), MENUID_CHESSBOARD_SWAPSIDES, MF_ENABLED);
767
      EnableMenuItem (GetMenu (hMainWnd), MENUID_CHESSBOARD_SWAPSIDES, MF_ENABLED);
759
   else
768
   else
Line 763... Line 772...
763
   EnableMenuItem (GetMenu (hMainWnd), MENUID_CHESSBOARD_RENAMESIDES, (network_player == NULL ? MF_ENABLED : MF_GRAYED));
772
   EnableMenuItem (GetMenu (hMainWnd), MENUID_CHESSBOARD_RENAMESIDES, (network_player == NULL ? MF_ENABLED : MF_GRAYED));
764
 
773
 
765
   // update window title
774
   // update window title
766
   if ((the_board.players[COLOR_WHITE].name[0] != 0) && (the_board.players[COLOR_BLACK].name[0] != 0))
775
   if ((the_board.players[COLOR_WHITE].name[0] != 0) && (the_board.players[COLOR_BLACK].name[0] != 0))
767
   {
776
   {
768
      swprintf_s (window_title, WCHAR_SIZEOF (window_title), L"%s %s %s - " PROGRAM_NAME L"%s", the_board.players[COLOR_WHITE].name, LOCALIZE (L"Versus"), the_board.players[COLOR_BLACK].name, (is_registered ? L"" : LOCALIZE (L"EvaluationMode")));
777
      swprintf_s (window_title, WCHAR_SIZEOF (window_title), L"%s %s %s - " PROGRAM_NAME L"%s", the_board.players[COLOR_WHITE].name, LOCALIZE (L"Versus"), the_board.players[COLOR_BLACK].name,
-
 
778
#ifndef NO_REGISTRATION
-
 
779
                  (is_registered ?
-
 
780
#endif // !NO_REGISTRATION
-
 
781
                  L""
-
 
782
#ifndef NO_REGISTRATION
-
 
783
                  : LOCALIZE (L"EvaluationMode"))
-
 
784
#endif // !NO_REGISTRATION
-
 
785
      );
769
      SetWindowText (hMainWnd, window_title); // update window title
786
      SetWindowText (hMainWnd, window_title); // update window title
770
   }
787
   }
771
   else if (the_board.players[COLOR_WHITE].name[0] != 0)
788
   else if (the_board.players[COLOR_WHITE].name[0] != 0)
772
   {
789
   {
773
      swprintf_s (window_title, WCHAR_SIZEOF (window_title), L"%s - " PROGRAM_NAME L"%s", the_board.players[COLOR_WHITE].name, (is_registered ? L"" : LOCALIZE (L"EvaluationMode")));
790
      swprintf_s (window_title, WCHAR_SIZEOF (window_title), L"%s - " PROGRAM_NAME L"%s", the_board.players[COLOR_WHITE].name,
-
 
791
#ifndef NO_REGISTRATION
-
 
792
                  (is_registered ?
-
 
793
#endif // !NO_REGISTRATION
-
 
794
                  L""
-
 
795
#ifndef NO_REGISTRATION
-
 
796
                  : LOCALIZE (L"EvaluationMode"))
-
 
797
#endif // !NO_REGISTRATION
-
 
798
      );
774
      SetWindowText (hMainWnd, window_title); // update window title
799
      SetWindowText (hMainWnd, window_title); // update window title
775
   }
800
   }
776
 
801
 
777
   // are we in internet mode AND are we logged in ?
802
   // are we in internet mode AND are we logged in ?
778
   if ((network_player != NULL) && network_player->is_logged_in)
803
   if ((network_player != NULL) && network_player->is_logged_in)