* Saves the new options and returns to the proper origin screen. * @param action Pointer to an action. */
| 209 | * @param action Pointer to an action. |
| 210 | */ |
| 211 | void OptionsBaseState::btnOkClick(Action *) |
| 212 | { |
| 213 | int dX = Options::baseXResolution; |
| 214 | int dY = Options::baseYResolution; |
| 215 | Screen::updateScale(Options::battlescapeScale, Options::newBattlescapeScale, Options::baseXBattlescape, Options::baseYBattlescape, _origin == OPT_BATTLESCAPE); |
| 216 | Screen::updateScale(Options::geoscapeScale, Options::newGeoscapeScale, Options::baseXGeoscape, Options::baseYGeoscape, _origin != OPT_BATTLESCAPE); |
| 217 | dX = Options::baseXResolution - dX; |
| 218 | dY = Options::baseYResolution - dY; |
| 219 | recenter(dX, dY); |
| 220 | Options::switchDisplay(); |
| 221 | Options::save(); |
| 222 | _game->loadLanguage(Options::language); |
| 223 | SDL_WM_GrabInput(Options::captureMouse); |
| 224 | _game->getScreen()->resetDisplay(); |
| 225 | _game->setVolume(Options::soundVolume, Options::musicVolume, Options::uiVolume); |
| 226 | if (Options::reload && _origin == OPT_MENU) |
| 227 | { |
| 228 | _game->setState(new StartState(_game)); |
| 229 | } |
| 230 | else |
| 231 | { |
| 232 | // Confirm any video options changes |
| 233 | if (Options::displayWidth != Options::newDisplayWidth || |
| 234 | Options::displayHeight != Options::newDisplayHeight || |
| 235 | Options::useOpenGL != Options::newOpenGL || |
| 236 | Options::useScaleFilter != Options::newScaleFilter || |
| 237 | Options::useHQXFilter != Options::newHQXFilter || |
| 238 | Options::useOpenGLShader != Options::newOpenGLShader) |
| 239 | { |
| 240 | _game->pushState(new OptionsConfirmState(_game, _origin)); |
| 241 | } |
| 242 | else |
| 243 | { |
| 244 | restart(_game, _origin); |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * Loads previous options and returns to the previous screen. |
nothing calls this directly
no test coverage detected