Rev 30 | Rev 44 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 30 | Rev 41 | ||
|---|---|---|---|
| Line 35... | Line 35... | ||
| 35 | int array_index; |
35 | int array_index; |
| 36 | bool is_success; |
36 | bool is_success; |
| 37 | char *endptr; |
37 | char *endptr; |
| 38 | wchar_t app_pathname[MAX_PATH]; |
38 | wchar_t app_pathname[MAX_PATH]; |
| 39 | wchar_t font_pathname[MAX_PATH]; |
39 | wchar_t font_pathname[MAX_PATH]; |
| 40 | wchar_t |
40 | wchar_t temp_string[100]; |
| 41 | struct _stat fileinfo; |
41 | struct _stat fileinfo; |
| 42 | HACCEL hAccelerators; |
42 | HACCEL hAccelerators; |
| 43 | ACCEL accelerators[] = |
43 | ACCEL accelerators[] = |
| 44 | { |
44 | { |
| 45 | {FVIRTKEY | FCONTROL, L'O', MENUID_GAME_LOAD}, |
45 | {FVIRTKEY | FCONTROL, L'O', MENUID_GAME_LOAD}, |
| Line 216... | Line 216... | ||
| 216 | wc.hInstance = hAppInstance; |
216 | wc.hInstance = hAppInstance; |
| 217 | wc.hIcon = LoadIcon (hAppInstance, (wchar_t *) ICON_MAIN); |
217 | wc.hIcon = LoadIcon (hAppInstance, (wchar_t *) ICON_MAIN); |
| 218 | wc.hCursor = LoadCursor (NULL, IDC_ARROW); |
218 | wc.hCursor = LoadCursor (NULL, IDC_ARROW); |
| 219 | wc.lpszClassName = PROGRAM_NAME L" WndClass"; |
219 | wc.lpszClassName = PROGRAM_NAME L" WndClass"; |
| 220 | RegisterClassEx (&wc); |
220 | RegisterClassEx (&wc); |
| 221 | swprintf_s ( |
221 | swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), PROGRAM_NAME L"%s", (is_registered ? L"" : LOCALIZE (L"EvaluationMode"))); // build window title |
| 222 | if (options.want_fullscreen) |
222 | if (options.want_fullscreen) |
| 223 | hMainWnd = CreateWindowEx (0, wc.lpszClassName, |
223 | hMainWnd = CreateWindowEx (0, wc.lpszClassName, temp_string, WS_POPUPWINDOW, // temp_string holds window title |
| 224 | 0, 0, GetSystemMetrics (SM_CXSCREEN), GetSystemMetrics (SM_CYSCREEN), |
224 | 0, 0, GetSystemMetrics (SM_CXSCREEN), GetSystemMetrics (SM_CYSCREEN), |
| 225 | NULL, hMenu, hAppInstance, NULL); |
225 | NULL, hMenu, hAppInstance, NULL); |
| 226 | else |
226 | else |
| 227 | { |
227 | { |
| 228 | // in windowed mode, ensure window width and height aren't greater than screen size nor lower than a safe minimum |
228 | // in windowed mode, ensure window width and height aren't greater than screen size nor lower than a safe minimum |
| Line 233... | Line 233... | ||
| 233 | if (options.window_width < 640) |
233 | if (options.window_width < 640) |
| 234 | options.window_width = 640; // check this secondly in case screen size is reported incorrect |
234 | options.window_width = 640; // check this secondly in case screen size is reported incorrect |
| 235 | if (options.window_height < 480) |
235 | if (options.window_height < 480) |
| 236 | options.window_height = 480; |
236 | options.window_height = 480; |
| 237 | 237 | ||
| 238 | hMainWnd = CreateWindowEx (0, wc.lpszClassName, |
238 | hMainWnd = CreateWindowEx (0, wc.lpszClassName, temp_string, WS_OVERLAPPEDWINDOW, // temp_string holds window title |
| 239 | GetSystemMetrics (SM_CXSCREEN) / 2 - options.window_width / 2, |
239 | GetSystemMetrics (SM_CXSCREEN) / 2 - options.window_width / 2, |
| 240 | GetSystemMetrics (SM_CYSCREEN) / 2 - options.window_height / 2, |
240 | GetSystemMetrics (SM_CYSCREEN) / 2 - options.window_height / 2, |
| 241 | options.window_width, |
241 | options.window_width, |
| 242 | options.window_height, |
242 | options.window_height, |
| 243 | NULL, hMenu, hAppInstance, NULL); |
243 | NULL, hMenu, hAppInstance, NULL); |
| Line 333... | Line 333... | ||
| 333 | { |
333 | { |
| 334 | while (*lpCmdLine == '"') |
334 | while (*lpCmdLine == '"') |
| 335 | lpCmdLine++; // skip leading quotes |
335 | lpCmdLine++; // skip leading quotes |
| 336 | if ((endptr = strchr (lpCmdLine, '"')) != NULL) |
336 | if ((endptr = strchr (lpCmdLine, '"')) != NULL) |
| 337 | *endptr = 0; // break the string at the first ending quote |
337 | *endptr = 0; // break the string at the first ending quote |
| - | 338 | ||
| - | 339 | #ifndef NDEBUG |
|
| - | 340 | // is it a registration info ? if so, parse it |
|
| - | 341 | if ((strncmp (lpCmdLine, "/r=", 3) == 0) && ((endptr = strchr (&lpCmdLine[3], ',')) != NULL)) |
|
| - | 342 | { |
|
| - | 343 | *endptr = 0; // break the string at the separator between user email and activation code |
|
| - | 344 | ConvertToWideChar (temp_string, WCHAR_SIZEOF (temp_string), &lpCmdLine[3]); // read user email |
|
| - | 345 | is_registered = IsRegistrationCorrect (temp_string, atoi (endptr + 1)); // and see whether we're registered or not |
|
| - | 346 | DialogBox_NewGame (); // still open the "new game" dialog box |
|
| - | 347 | } |
|
| - | 348 | #endif // !NDEBUG |
|
| - | 349 | ||
| - | 350 | // is it a file that exists ? |
|
| 338 | if (_stat (lpCmdLine, &fileinfo) == 0) |
351 | if (_stat (lpCmdLine, &fileinfo) == 0) |
| 339 | { |
352 | { |
| 340 | ConvertToWideChar (load_pathname, WCHAR_SIZEOF (load_pathname), lpCmdLine); // save pathname string |
353 | ConvertToWideChar (load_pathname, WCHAR_SIZEOF (load_pathname), lpCmdLine); // save pathname string |
| 341 | is_dialogbox_load_validated = true; // and act as if the user just validated a load dialog box |
354 | is_dialogbox_load_validated = true; // and act as if the user just validated a load dialog box |
| 342 | } |
355 | } |
| Line 537... | Line 550... | ||
| 537 | 550 | ||
| 538 | static void MainLoop_EvaluateGameState (void) |
551 | static void MainLoop_EvaluateGameState (void) |
| 539 | { |
552 | { |
| 540 | // function to evaluate the game state in the main loop when a part has just moved |
553 | // function to evaluate the game state in the main loop when a part has just moved |
| 541 | 554 | ||
| 542 | wchar_t window_title[256]; |
555 | static wchar_t window_title[256]; |
| - | 556 | ||
| 543 | player_t *current_player; |
557 | player_t *current_player; |
| 544 | player_t *opposite_player; |
558 | player_t *opposite_player; |
| 545 | player_t *network_player; |
559 | player_t *network_player; |
| 546 | boardmove_t *last_move; |
560 | boardmove_t *last_move; |
| 547 | int enabled_value; |
561 | int enabled_value; |