153 ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_RESOLUTION_START, _num_resolutions), GetCurRes(), 27, 0, 0); |
153 ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_RESOLUTION_START, _num_resolutions), GetCurRes(), 27, 0, 0); |
154 return; |
154 return; |
155 case 28: /* Click fullscreen on/off */ |
155 case 28: /* Click fullscreen on/off */ |
156 SetWindowWidgetLoweredState(w, 28, !_fullscreen); |
156 SetWindowWidgetLoweredState(w, 28, !_fullscreen); |
157 ToggleFullScreen(!_fullscreen); // toggle full-screen on/off |
157 ToggleFullScreen(!_fullscreen); // toggle full-screen on/off |
158 SetWindowDirty(w); |
158 w->SetDirty(); |
159 return; |
159 return; |
160 case 30: case 31: /* Setup screenshot format dropdown */ |
160 case 30: case 31: /* Setup screenshot format dropdown */ |
161 ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_SCREENSHOT_START, _num_screenshot_formats), _cur_screenshot_format, 31, 0, 0); |
161 ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_SCREENSHOT_START, _num_screenshot_formats), _cur_screenshot_format, 31, 0, 0); |
162 return; |
162 return; |
163 } |
163 } |
195 InvalidateWindow(WC_GAME_OPTIONS, 0); |
195 InvalidateWindow(WC_GAME_OPTIONS, 0); |
196 } |
196 } |
197 break; |
197 break; |
198 case 17: /* Autosave options */ |
198 case 17: /* Autosave options */ |
199 _opt.autosave = _opt_newgame.autosave = e->we.dropdown.index; |
199 _opt.autosave = _opt_newgame.autosave = e->we.dropdown.index; |
200 SetWindowDirty(w); |
200 w->SetDirty(); |
201 break; |
201 break; |
202 case 24: /* Change interface language */ |
202 case 24: /* Change interface language */ |
203 ReadLanguagePack(e->we.dropdown.index); |
203 ReadLanguagePack(e->we.dropdown.index); |
204 MarkWholeScreenDirty(); |
204 MarkWholeScreenDirty(); |
205 break; |
205 break; |
206 case 27: /* Change resolution */ |
206 case 27: /* Change resolution */ |
207 if (e->we.dropdown.index < _num_resolutions && ChangeResInGame(_resolutions[e->we.dropdown.index][0],_resolutions[e->we.dropdown.index][1])) |
207 if (e->we.dropdown.index < _num_resolutions && ChangeResInGame(_resolutions[e->we.dropdown.index][0],_resolutions[e->we.dropdown.index][1])) |
208 SetWindowDirty(w); |
208 w->SetDirty(); |
209 break; |
209 break; |
210 case 31: /* Change screenshot format */ |
210 case 31: /* Change screenshot format */ |
211 SetScreenshotFormat(e->we.dropdown.index); |
211 SetScreenshotFormat(e->we.dropdown.index); |
212 SetWindowDirty(w); |
212 w->SetDirty(); |
213 break; |
213 break; |
214 } |
214 } |
215 break; |
215 break; |
216 |
216 |
217 case WE_DESTROY: |
217 case WE_DESTROY: |
479 } |
479 } |
480 |
480 |
481 // save value in temporary variable |
481 // save value in temporary variable |
482 ((int*)&_opt_mod_temp.diff)[btn] = val; |
482 ((int*)&_opt_mod_temp.diff)[btn] = val; |
483 SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom |
483 SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom |
484 SetWindowDirty(w); |
484 w->SetDirty(); |
485 } break; |
485 } break; |
486 case 3: case 4: case 5: case 6: /* Easy / Medium / Hard / Custom */ |
486 case 3: case 4: case 5: case 6: /* Easy / Medium / Hard / Custom */ |
487 // temporarily change difficulty level |
487 // temporarily change difficulty level |
488 RaiseWindowWidget(w, _opt_mod_temp.diff_level + 3); |
488 RaiseWindowWidget(w, _opt_mod_temp.diff_level + 3); |
489 SetDifficultyLevel(e->we.click.widget - 3, &_opt_mod_temp); |
489 SetDifficultyLevel(e->we.click.widget - 3, &_opt_mod_temp); |
490 LowerWindowWidget(w, _opt_mod_temp.diff_level + 3); |
490 LowerWindowWidget(w, _opt_mod_temp.diff_level + 3); |
491 SetWindowDirty(w); |
491 w->SetDirty(); |
492 break; |
492 break; |
493 case 7: /* Highscore Table */ |
493 case 7: /* Highscore Table */ |
494 ShowHighscoreTable(_opt_mod_temp.diff_level, -1); |
494 ShowHighscoreTable(_opt_mod_temp.diff_level, -1); |
495 break; |
495 break; |
496 case 10: { /* Save button - save changes */ |
496 case 10: { /* Save button - save changes */ |
500 // if setting has changed, change it |
500 // if setting has changed, change it |
501 if (val != ((int*)&_opt_ptr->diff)[btn]) |
501 if (val != ((int*)&_opt_ptr->diff)[btn]) |
502 DoCommandP(0, btn, val, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
502 DoCommandP(0, btn, val, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
503 } |
503 } |
504 DoCommandP(0, UINT_MAX, _opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
504 DoCommandP(0, UINT_MAX, _opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
505 DeleteWindow(w); |
505 w->Close(); |
506 // If we are in the editor, we should reload the economy. |
506 // If we are in the editor, we should reload the economy. |
507 // This way when you load a game, the max loan and interest rate |
507 // This way when you load a game, the max loan and interest rate |
508 // are loaded correctly. |
508 // are loaded correctly. |
509 if (_game_mode == GM_EDITOR) |
509 if (_game_mode == GM_EDITOR) |
510 StartupEconomy(); |
510 StartupEconomy(); |
511 break; |
511 break; |
512 } |
512 } |
513 case 11: /* Cancel button - close window, abandon changes */ |
513 case 11: /* Cancel button - close window, abandon changes */ |
514 DeleteWindow(w); |
514 w->Close(); |
515 break; |
515 break; |
516 } break; |
516 } break; |
517 |
517 |
518 case WE_MOUSELOOP: /* Handle the visual 'clicking' of the buttons */ |
518 case WE_MOUSELOOP: /* Handle the visual 'clicking' of the buttons */ |
519 if (_difficulty_timeout != 0 && !--_difficulty_timeout) { |
519 if (_difficulty_timeout != 0 && !--_difficulty_timeout) { |
520 _difficulty_click_a = 0; |
520 _difficulty_click_a = 0; |
521 _difficulty_click_b = 0; |
521 _difficulty_click_b = 0; |
522 SetWindowDirty(w); |
522 w->SetDirty(); |
523 } |
523 } |
524 break; |
524 break; |
525 } |
525 } |
526 } |
526 } |
527 |
527 |
836 default: NOT_REACHED(); |
836 default: NOT_REACHED(); |
837 } |
837 } |
838 |
838 |
839 if (value != oldvalue) { |
839 if (value != oldvalue) { |
840 SetPatchValue(page->entries[btn].index, patches_ptr, value); |
840 SetPatchValue(page->entries[btn].index, patches_ptr, value); |
841 SetWindowDirty(w); |
841 w->SetDirty(); |
842 } |
842 } |
843 } else { |
843 } else { |
844 /* only open editbox for types that its sensible for */ |
844 /* only open editbox for types that its sensible for */ |
845 if (sd->desc.cmd != SDT_BOOLX && !(sd->desc.flags & SGF_MULTISTRING)) { |
845 if (sd->desc.cmd != SDT_BOOLX && !(sd->desc.flags & SGF_MULTISTRING)) { |
846 /* Show the correct currency-translated value */ |
846 /* Show the correct currency-translated value */ |
857 case 4: case 5: case 6: case 7: case 8: case 9: |
857 case 4: case 5: case 6: case 7: case 8: case 9: |
858 RaiseWindowWidget(w, WP(w, def_d).data_1 + 4); |
858 RaiseWindowWidget(w, WP(w, def_d).data_1 + 4); |
859 WP(w, def_d).data_1 = e->we.click.widget - 4; |
859 WP(w, def_d).data_1 = e->we.click.widget - 4; |
860 LowerWindowWidget(w, WP(w, def_d).data_1 + 4); |
860 LowerWindowWidget(w, WP(w, def_d).data_1 + 4); |
861 DeleteWindowById(WC_QUERY_STRING, 0); |
861 DeleteWindowById(WC_QUERY_STRING, 0); |
862 SetWindowDirty(w); |
862 w->SetDirty(); |
863 break; |
863 break; |
864 } |
864 } |
865 break; |
865 break; |
866 |
866 |
867 case WE_TIMEOUT: |
867 case WE_TIMEOUT: |
868 WP(w,def_d).data_2 = 0; |
868 WP(w,def_d).data_2 = 0; |
869 SetWindowDirty(w); |
869 w->SetDirty(); |
870 break; |
870 break; |
871 |
871 |
872 case WE_ON_EDIT_TEXT: { |
872 case WE_ON_EDIT_TEXT: { |
873 if (e->we.edittext.str != NULL) { |
873 if (e->we.edittext.str != NULL) { |
874 const PatchEntry *pe = &_patches_page[WP(w,def_d).data_1].entries[WP(w,def_d).data_3]; |
874 const PatchEntry *pe = &_patches_page[WP(w,def_d).data_1].entries[WP(w,def_d).data_3]; |
1067 WP(w, def_d).data_2 = line; |
1067 WP(w, def_d).data_2 = line; |
1068 ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1, 250, w, afilter); |
1068 ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1, 250, w, afilter); |
1069 } |
1069 } |
1070 |
1070 |
1071 w->flags4 |= 5 << WF_TIMEOUT_SHL; |
1071 w->flags4 |= 5 << WF_TIMEOUT_SHL; |
1072 SetWindowDirty(w); |
1072 w->SetDirty(); |
1073 break; |
1073 break; |
1074 } |
1074 } |
1075 |
1075 |
1076 case WE_ON_EDIT_TEXT: { |
1076 case WE_ON_EDIT_TEXT: { |
1077 const char *b = e->we.edittext.str; |
1077 const char *b = e->we.edittext.str; |