src/settings_gui.cpp
changeset 7997 df87ccd00a96
parent 7991 d6a95a5593ba
child 8082 63240e1bd6cc
equal deleted inserted replaced
7996:809895d51e05 7997:df87ccd00a96
   138 	switch (e->event) {
   138 	switch (e->event) {
   139 	case WE_PAINT: {
   139 	case WE_PAINT: {
   140 		int i;
   140 		int i;
   141 		StringID str = STR_02BE_DEFAULT;
   141 		StringID str = STR_02BE_DEFAULT;
   142 
   142 
   143 		SetWindowWidgetDisabledState(w, 21, !(_vehicle_design_names & 1));
   143 		w->SetWidgetDisabledState(21, !(_vehicle_design_names & 1));
   144 		if (!IsWindowWidgetDisabled(w, 21)) str = STR_02BF_CUSTOM;
   144 		if (!w->IsWidgetDisabled(21)) str = STR_02BF_CUSTOM;
   145 		SetDParam(0, str);
   145 		SetDParam(0, str);
   146 		SetDParam(1, _currency_specs[_opt_ptr->currency].name);
   146 		SetDParam(1, _currency_specs[_opt_ptr->currency].name);
   147 		SetDParam(2, STR_UNITS_IMPERIAL + _opt_ptr->units);
   147 		SetDParam(2, STR_UNITS_IMPERIAL + _opt_ptr->units);
   148 		SetDParam(3, STR_02E9_DRIVE_ON_LEFT + _opt_ptr->road_side);
   148 		SetDParam(3, STR_02E9_DRIVE_ON_LEFT + _opt_ptr->road_side);
   149 		SetDParam(4, TownName(_opt_ptr->town_name));
   149 		SetDParam(4, TownName(_opt_ptr->town_name));
   150 		SetDParam(5, _autosave_dropdown[_opt_ptr->autosave]);
   150 		SetDParam(5, _autosave_dropdown[_opt_ptr->autosave]);
   151 		SetDParam(6, SPECSTR_LANGUAGE_START + _dynlang.curr);
   151 		SetDParam(6, SPECSTR_LANGUAGE_START + _dynlang.curr);
   152 		i = GetCurRes();
   152 		i = GetCurRes();
   153 		SetDParam(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i);
   153 		SetDParam(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i);
   154 		SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format);
   154 		SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format);
   155 		SetWindowWidgetLoweredState(w, 28, _fullscreen);
   155 		w->SetWidgetLoweredState(28, _fullscreen);
   156 
   156 
   157 		DrawWindowWidgets(w);
   157 		DrawWindowWidgets(w);
   158 		DrawString(20, 175, STR_OPTIONS_FULLSCREEN, TC_FROMSTRING); // fullscreen
   158 		DrawString(20, 175, STR_OPTIONS_FULLSCREEN, TC_FROMSTRING); // fullscreen
   159 	} break;
   159 	} break;
   160 
   160 
   200 			return;
   200 			return;
   201 		case 26: case 27: /* Setup resolution dropdown */
   201 		case 26: case 27: /* Setup resolution dropdown */
   202 			ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_RESOLUTION_START, _num_resolutions), GetCurRes(), 27, 0, 0);
   202 			ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_RESOLUTION_START, _num_resolutions), GetCurRes(), 27, 0, 0);
   203 			return;
   203 			return;
   204 		case 28: /* Click fullscreen on/off */
   204 		case 28: /* Click fullscreen on/off */
   205 			SetWindowWidgetLoweredState(w, 28, !_fullscreen);
   205 			w->SetWidgetLoweredState(28, !_fullscreen);
   206 			ToggleFullScreen(!_fullscreen); // toggle full-screen on/off
   206 			ToggleFullScreen(!_fullscreen); // toggle full-screen on/off
   207 			SetWindowDirty(w);
   207 			SetWindowDirty(w);
   208 			return;
   208 			return;
   209 		case 30: case 31: /* Setup screenshot format dropdown */
   209 		case 30: case 31: /* Setup screenshot format dropdown */
   210 			ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_SCREENSHOT_START, _num_screenshot_formats), _cur_screenshot_format, 31, 0, 0);
   210 			ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_SCREENSHOT_START, _num_screenshot_formats), _cur_screenshot_format, 31, 0, 0);
   450 static void GameDifficultyWndProc(Window *w, WindowEvent *e)
   450 static void GameDifficultyWndProc(Window *w, WindowEvent *e)
   451 {
   451 {
   452 	switch (e->event) {
   452 	switch (e->event) {
   453 	case WE_CREATE: // Setup disabled buttons when creating window
   453 	case WE_CREATE: // Setup disabled buttons when creating window
   454 		/* disable all other difficulty buttons during gameplay except for 'custom' */
   454 		/* disable all other difficulty buttons during gameplay except for 'custom' */
   455 		SetWindowWidgetDisabledState(w,  3, _game_mode == GM_NORMAL);
   455 		w->SetWidgetDisabledState( 3, _game_mode == GM_NORMAL);
   456 		SetWindowWidgetDisabledState(w,  4, _game_mode == GM_NORMAL);
   456 		w->SetWidgetDisabledState( 4, _game_mode == GM_NORMAL);
   457 		SetWindowWidgetDisabledState(w,  5, _game_mode == GM_NORMAL);
   457 		w->SetWidgetDisabledState( 5, _game_mode == GM_NORMAL);
   458 		SetWindowWidgetDisabledState(w,  6, _game_mode == GM_NORMAL);
   458 		w->SetWidgetDisabledState( 6, _game_mode == GM_NORMAL);
   459 		SetWindowWidgetDisabledState(w,  7, _game_mode == GM_EDITOR || _networking); // highscore chart in multiplayer
   459 		w->SetWidgetDisabledState( 7, _game_mode == GM_EDITOR || _networking); // highscore chart in multiplayer
   460 		SetWindowWidgetDisabledState(w, 10, _networking && !_network_server); // Save-button in multiplayer (and if client)
   460 		w->SetWidgetDisabledState(10, _networking && !_network_server); // Save-button in multiplayer (and if client)
   461 		LowerWindowWidget(w, _opt_mod_temp.diff_level + 3);
   461 		w->LowerWidget(_opt_mod_temp.diff_level + 3);
   462 
   462 
   463 		break;
   463 		break;
   464 	case WE_PAINT: {
   464 	case WE_PAINT: {
   465 		uint32 click_a, click_b, disabled;
   465 		uint32 click_a, click_b, disabled;
   466 		int i;
   466 		int i;
   545 				SetBit(_difficulty_click_a, btn);
   545 				SetBit(_difficulty_click_a, btn);
   546 			}
   546 			}
   547 
   547 
   548 			// save value in temporary variable
   548 			// save value in temporary variable
   549 			((GDType*)&_opt_mod_temp.diff)[btn] = val;
   549 			((GDType*)&_opt_mod_temp.diff)[btn] = val;
   550 			RaiseWindowWidget(w, _opt_mod_temp.diff_level + 3);
   550 			w->RaiseWidget(_opt_mod_temp.diff_level + 3);
   551 			SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom
   551 			SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom
   552 			LowerWindowWidget(w, _opt_mod_temp.diff_level + 3);
   552 			w->LowerWidget(_opt_mod_temp.diff_level + 3);
   553 			SetWindowDirty(w);
   553 			SetWindowDirty(w);
   554 		} break;
   554 		} break;
   555 		case 3: case 4: case 5: case 6: /* Easy / Medium / Hard / Custom */
   555 		case 3: case 4: case 5: case 6: /* Easy / Medium / Hard / Custom */
   556 			// temporarily change difficulty level
   556 			// temporarily change difficulty level
   557 			RaiseWindowWidget(w, _opt_mod_temp.diff_level + 3);
   557 			w->RaiseWidget(_opt_mod_temp.diff_level + 3);
   558 			SetDifficultyLevel(e->we.click.widget - 3, &_opt_mod_temp);
   558 			SetDifficultyLevel(e->we.click.widget - 3, &_opt_mod_temp);
   559 			LowerWindowWidget(w, _opt_mod_temp.diff_level + 3);
   559 			w->LowerWidget(_opt_mod_temp.diff_level + 3);
   560 			SetWindowDirty(w);
   560 			SetWindowDirty(w);
   561 			break;
   561 			break;
   562 		case 7: /* Highscore Table */
   562 		case 7: /* Highscore Table */
   563 			ShowHighscoreTable(_opt_mod_temp.diff_level, -1);
   563 			ShowHighscoreTable(_opt_mod_temp.diff_level, -1);
   564 			break;
   564 			break;
   803 					page->entries[i].index = index;
   803 					page->entries[i].index = index;
   804 				}
   804 				}
   805 			}
   805 			}
   806 			first_time = false;
   806 			first_time = false;
   807 		}
   807 		}
   808 		LowerWindowWidget(w, 4);
   808 		w->LowerWidget(4);
   809 	} break;
   809 	} break;
   810 
   810 
   811 	case WE_PAINT: {
   811 	case WE_PAINT: {
   812 		int x, y;
   812 		int x, y;
   813 		const PatchPage *page = &_patches_page[WP(w,def_d).data_1];
   813 		const PatchPage *page = &_patches_page[WP(w,def_d).data_1];
   952 			}
   952 			}
   953 
   953 
   954 			break;
   954 			break;
   955 		}
   955 		}
   956 		case 4: case 5: case 6: case 7: case 8: case 9:
   956 		case 4: case 5: case 6: case 7: case 8: case 9:
   957 			RaiseWindowWidget(w, WP(w, def_d).data_1 + 4);
   957 			w->RaiseWidget(WP(w, def_d).data_1 + 4);
   958 			WP(w, def_d).data_1 = e->we.click.widget - 4;
   958 			WP(w, def_d).data_1 = e->we.click.widget - 4;
   959 			LowerWindowWidget(w, WP(w, def_d).data_1 + 4);
   959 			w->LowerWidget(WP(w, def_d).data_1 + 4);
   960 			DeleteWindowById(WC_QUERY_STRING, 0);
   960 			DeleteWindowById(WC_QUERY_STRING, 0);
   961 			SetWindowDirty(w);
   961 			SetWindowDirty(w);
   962 			break;
   962 			break;
   963 		}
   963 		}
   964 		break;
   964 		break;