111 SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format); |
113 SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format); |
112 SetWindowWidgetLoweredState(w, 28, _fullscreen); |
114 SetWindowWidgetLoweredState(w, 28, _fullscreen); |
113 |
115 |
114 DrawWindowWidgets(w); |
116 DrawWindowWidgets(w); |
115 DrawString(20, 175, STR_OPTIONS_FULLSCREEN, 0); // fullscreen |
117 DrawString(20, 175, STR_OPTIONS_FULLSCREEN, 0); // fullscreen |
116 } break; |
118 } break; |
117 |
119 |
118 case WE_CLICK: |
120 case WE_CLICK: |
119 switch (e->we.click.widget) { |
121 switch (e->we.click.widget) { |
120 case 4: case 5: /* Setup currencies dropdown */ |
122 case 4: case 5: /* Setup currencies dropdown */ |
121 ShowDropDownMenu(w, BuildCurrencyDropdown(), _opt_ptr->currency, 5, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0);; |
123 ShowDropDownMenu(w, BuildCurrencyDropdown(), _opt_ptr->currency, 5, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0);; |
303 }; |
307 }; |
304 |
308 |
305 static const GameSettingData _game_setting_info[] = { |
309 static const GameSettingData _game_setting_info[] = { |
306 { 0, 7, 1, STR_NULL}, |
310 { 0, 7, 1, STR_NULL}, |
307 { 0, 3, 1, STR_6830_IMMEDIATE}, |
311 { 0, 3, 1, STR_6830_IMMEDIATE}, |
308 { 0, 2, 1, STR_6816_LOW}, |
312 { 0, 3, 1, STR_NUM_VERY_LOW}, |
309 { 0, 3, 1, STR_26816_NONE}, |
313 { 0, 4, 1, STR_26816_NONE}, |
310 {100, 500, 50, STR_NULL}, |
314 {100, 500, 50, STR_NULL}, |
311 { 2, 4, 1, STR_NULL}, |
315 { 2, 4, 1, STR_NULL}, |
312 { 0, 2, 1, STR_6820_LOW}, |
316 { 0, 2, 1, STR_6820_LOW}, |
313 { 0, 4, 1, STR_681B_VERY_SLOW}, |
317 { 0, 4, 1, STR_681B_VERY_SLOW}, |
314 { 0, 2, 1, STR_6820_LOW}, |
318 { 0, 2, 1, STR_6820_LOW}, |
321 { 0, 1, 1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS}, |
325 { 0, 1, 1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS}, |
322 { 0, 1, 1, STR_6836_OFF}, |
326 { 0, 1, 1, STR_6836_OFF}, |
323 { 0, 2, 1, STR_6839_PERMISSIVE}, |
327 { 0, 2, 1, STR_6839_PERMISSIVE}, |
324 }; |
328 }; |
325 |
329 |
326 static inline bool GetBitAndShift(uint32 *b) |
|
327 { |
|
328 uint32 x = *b; |
|
329 *b >>= 1; |
|
330 return HASBIT(x, 0); |
|
331 } |
|
332 |
|
333 /* |
330 /* |
334 * A: competitors |
331 * A: competitors |
335 * B: start time in months / 3 |
332 * B: start time in months / 3 |
336 * C: town count (2 = high, 0 = low) |
333 * C: town count (2 = high, 0 = very low) |
337 * D: industry count (3 = high, 0 = none) |
334 * D: industry count (4 = high, 0 = none) |
338 * E: inital loan / 1000 (in GBP) |
335 * E: inital loan / 1000 (in GBP) |
339 * F: interest rate |
336 * F: interest rate |
340 * G: running costs (0 = low, 2 = high) |
337 * G: running costs (0 = low, 2 = high) |
341 * H: construction speed of competitors (0 = very slow, 4 = very fast) |
338 * H: construction speed of competitors (0 = very slow, 4 = very fast) |
342 * I: intelligence (0-2) |
339 * I: intelligence (0-2) |
350 * Q: disasters |
347 * Q: disasters |
351 * R: area restructuring (0 = permissive, 2 = hostile) |
348 * R: area restructuring (0 = permissive, 2 = hostile) |
352 */ |
349 */ |
353 static const int16 _default_game_diff[3][GAME_DIFFICULTY_NUM] = { /* |
350 static const int16 _default_game_diff[3][GAME_DIFFICULTY_NUM] = { /* |
354 A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R*/ |
351 A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R*/ |
355 {2, 2, 1, 3, 300, 2, 0, 2, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0}, //easy |
352 {2, 2, 1, 4, 300, 2, 0, 2, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0}, ///< easy |
356 {4, 1, 1, 2, 150, 3, 1, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1}, //medium |
353 {4, 1, 1, 3, 150, 3, 1, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1}, ///< medium |
357 {7, 0, 2, 2, 100, 4, 1, 3, 2, 2, 0, 2, 3, 2, 1, 1, 1, 2}, //hard |
354 {7, 0, 0, 2, 100, 4, 1, 3, 2, 2, 0, 2, 3, 2, 1, 1, 1, 2}, ///< hard |
358 }; |
355 }; |
359 |
356 |
360 void SetDifficultyLevel(int mode, GameOptions *gm_opt) |
357 void SetDifficultyLevel(int mode, GameOptions *gm_opt) |
361 { |
358 { |
362 int i; |
359 int i; |
391 enum { |
388 enum { |
392 GAMEDIFF_WND_TOP_OFFSET = 45, |
389 GAMEDIFF_WND_TOP_OFFSET = 45, |
393 GAMEDIFF_WND_ROWSIZE = 9 |
390 GAMEDIFF_WND_ROWSIZE = 9 |
394 }; |
391 }; |
395 |
392 |
396 // Temporary holding place of values in the difficulty window until 'Save' is clicked |
393 /* Temporary holding place of values in the difficulty window until 'Save' is clicked */ |
397 static GameOptions _opt_mod_temp; |
394 static GameOptions _opt_mod_temp; |
398 // 0x383E = (1 << 13) | (1 << 12) | (1 << 11) | (1 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) |
395 // 0x383E = (1 << 13) | (1 << 12) | (1 << 11) | (1 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) |
399 #define DIFF_INGAME_DISABLED_BUTTONS 0x383E |
396 #define DIFF_INGAME_DISABLED_BUTTONS 0x383E |
400 |
397 |
401 static void GameDifficultyWndProc(Window *w, WindowEvent *e) |
398 static void GameDifficultyWndProc(Window *w, WindowEvent *e) |
426 * that bit is set. If it is set, the button is disabled */ |
423 * that bit is set. If it is set, the button is disabled */ |
427 disabled = (_game_mode == GM_NORMAL) ? DIFF_INGAME_DISABLED_BUTTONS : 0; |
424 disabled = (_game_mode == GM_NORMAL) ? DIFF_INGAME_DISABLED_BUTTONS : 0; |
428 |
425 |
429 y = GAMEDIFF_WND_TOP_OFFSET; |
426 y = GAMEDIFF_WND_TOP_OFFSET; |
430 for (i = 0; i != GAME_DIFFICULTY_NUM; i++) { |
427 for (i = 0; i != GAME_DIFFICULTY_NUM; i++) { |
431 DrawFrameRect( 5, y, 5 + 8, y + 8, 3, GetBitAndShift(&click_a) ? FR_LOWERED : FR_NONE); |
428 DrawFrameRect( 5, y, 5 + 8, y + 8, 3, HASBIT(click_a, i) ? FR_LOWERED : FR_NONE); |
432 DrawFrameRect(15, y, 15 + 8, y + 8, 3, GetBitAndShift(&click_b) ? FR_LOWERED : FR_NONE); |
429 DrawFrameRect(15, y, 15 + 8, y + 8, 3, HASBIT(click_b, i) ? FR_LOWERED : FR_NONE); |
433 if (GetBitAndShift(&disabled) || (_networking && !_network_server)) { |
430 if (HASBIT(disabled, i) || (_networking && !_network_server)) { |
434 int color = (1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[COLOUR_YELLOW][2]; |
431 int color = (1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[COLOUR_YELLOW][2]; |
435 GfxFillRect( 6, y + 1, 6 + 8, y + 8, color); |
432 GfxFillRect( 6, y + 1, 6 + 8, y + 8, color); |
436 GfxFillRect(16, y + 1, 16 + 8, y + 8, color); |
433 GfxFillRect(16, y + 1, 16 + 8, y + 8, color); |
437 } |
434 } |
438 |
435 |
496 SETBIT(_difficulty_click_a, btn); |
493 SETBIT(_difficulty_click_a, btn); |
497 } |
494 } |
498 |
495 |
499 // save value in temporary variable |
496 // save value in temporary variable |
500 ((int*)&_opt_mod_temp.diff)[btn] = val; |
497 ((int*)&_opt_mod_temp.diff)[btn] = val; |
|
498 RaiseWindowWidget(w, _opt_mod_temp.diff_level + 3); |
501 SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom |
499 SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom |
|
500 LowerWindowWidget(w, _opt_mod_temp.diff_level + 3); |
502 SetWindowDirty(w); |
501 SetWindowDirty(w); |
503 } break; |
502 } break; |
504 case 3: case 4: case 5: case 6: /* Easy / Medium / Hard / Custom */ |
503 case 3: case 4: case 5: case 6: /* Easy / Medium / Hard / Custom */ |
505 // temporarily change difficulty level |
504 // temporarily change difficulty level |
506 RaiseWindowWidget(w, _opt_mod_temp.diff_level + 3); |
505 RaiseWindowWidget(w, _opt_mod_temp.diff_level + 3); |
507 SetDifficultyLevel(e->we.click.widget - 3, &_opt_mod_temp); |
506 SetDifficultyLevel(e->we.click.widget - 3, &_opt_mod_temp); |
508 LowerWindowWidget(w, _opt_mod_temp.diff_level + 3); |
507 LowerWindowWidget(w, _opt_mod_temp.diff_level + 3); |
596 /* While the horizontal scrollwheel scrolling is written as general code, only |
596 /* While the horizontal scrollwheel scrolling is written as general code, only |
597 * the cocoa (OSX) driver generates input for it. |
597 * the cocoa (OSX) driver generates input for it. |
598 * Since it's also able to completely disable the scrollwheel will we display it on all platforms anyway */ |
598 * Since it's also able to completely disable the scrollwheel will we display it on all platforms anyway */ |
599 "scrollwheel_scrolling", |
599 "scrollwheel_scrolling", |
600 "scrollwheel_multiplier", |
600 "scrollwheel_multiplier", |
|
601 "pause_on_newgame", |
|
602 "advanced_vehicle_list", |
601 }; |
603 }; |
602 |
604 |
603 static const char *_patches_construction[] = { |
605 static const char *_patches_construction[] = { |
604 "build_on_slopes", |
606 "build_on_slopes", |
605 "extra_dynamite", |
607 "extra_dynamite", |