diff options
author | Andre Heider | 2009-09-20 12:53:32 +0000 |
---|---|---|
committer | Andre Heider | 2009-09-20 12:53:32 +0000 |
commit | ab6caf1df61a185c697747021696b6193e165512 (patch) | |
tree | fc993105c51bb4cd73199162950f1621a8a3cee6 | |
parent | 59f72d111f4455fe9309980fed240619537344f8 (diff) | |
download | scummvm-rg350-ab6caf1df61a185c697747021696b6193e165512.tar.gz scummvm-rg350-ab6caf1df61a185c697747021696b6193e165512.tar.bz2 scummvm-rg350-ab6caf1df61a185c697747021696b6193e165512.zip |
New "Input" tab for the options dialog to set pad sensitivity and acceleration.
svn-id: r44205
-rw-r--r-- | backends/platform/wii/options.cpp | 39 | ||||
-rw-r--r-- | backends/platform/wii/options.h | 4 | ||||
-rw-r--r-- | backends/platform/wii/osystem.cpp | 7 | ||||
-rw-r--r-- | backends/platform/wii/osystem.h | 2 | ||||
-rw-r--r-- | backends/platform/wii/osystem_events.cpp | 15 |
5 files changed, 59 insertions, 8 deletions
diff --git a/backends/platform/wii/options.cpp b/backends/platform/wii/options.cpp index a2f4b2ecf1..693b1431a5 100644 --- a/backends/platform/wii/options.cpp +++ b/backends/platform/wii/options.cpp @@ -67,6 +67,20 @@ WiiOptionsDialog::WiiOptionsDialog(bool doubleStrike) : _sliderUnderscanY->setMinValue(0); _sliderUnderscanY->setMaxValue(32); + _tabInput = _tab->addTab("Input"); + + new StaticTextWidget(_tab, 16, 16, 128, 16, + "GC Pad sensitivity:", Graphics::kTextAlignRight); + _sliderPadSensitivity = new SliderWidget(_tab, 160, 15, 128, 18, 'x'); + _sliderPadSensitivity->setMinValue(0); + _sliderPadSensitivity->setMaxValue(64); + + new StaticTextWidget(_tab, 16, 44, 128, 16, + "GC Pad acceleration:", Graphics::kTextAlignRight); + _sliderPadAcceleration = new SliderWidget(_tab, 160, 43, 128, 18, 'y'); + _sliderPadAcceleration->setMinValue(0); + _sliderPadAcceleration->setMaxValue(8); + #ifdef USE_WII_DI _tabDVD = _tab->addTab("DVD"); @@ -242,13 +256,23 @@ void WiiOptionsDialog::revert() { } void WiiOptionsDialog::load() { - int x = ConfMan.getInt(_strUnderscanX, + int i; + + i = ConfMan.getInt(_strUnderscanX, Common::ConfigManager::kApplicationDomain); - int y = ConfMan.getInt(_strUnderscanY, + _sliderUnderscanX->setValue(i); + + i = ConfMan.getInt(_strUnderscanY, Common::ConfigManager::kApplicationDomain); + _sliderUnderscanY->setValue(i); - _sliderUnderscanX->setValue(x); - _sliderUnderscanY->setValue(y); + i = ConfMan.getInt("wii_pad_sensitivity", + Common::ConfigManager::kApplicationDomain); + _sliderPadSensitivity->setValue(i); + + i = ConfMan.getInt("wii_pad_acceleration", + Common::ConfigManager::kApplicationDomain); + _sliderPadAcceleration->setValue(i); #ifdef USE_WII_SMB _editSMBServer->setEditString(ConfMan.get("wii_smb_server", @@ -270,6 +294,13 @@ void WiiOptionsDialog::save() { _sliderUnderscanY->getValue(), Common::ConfigManager::kApplicationDomain); + ConfMan.setInt("wii_pad_sensitivity", + _sliderPadSensitivity->getValue(), + Common::ConfigManager::kApplicationDomain); + ConfMan.setInt("wii_pad_acceleration", + _sliderPadAcceleration->getValue(), + Common::ConfigManager::kApplicationDomain); + #ifdef USE_WII_SMB ConfMan.set("wii_smb_server", _editSMBServer->getEditString(), Common::ConfigManager::kApplicationDomain); diff --git a/backends/platform/wii/options.h b/backends/platform/wii/options.h index e63f04ea1e..b126bde88f 100644 --- a/backends/platform/wii/options.h +++ b/backends/platform/wii/options.h @@ -52,6 +52,10 @@ private: SliderWidget *_sliderUnderscanX; SliderWidget *_sliderUnderscanY; + int _tabInput; + SliderWidget *_sliderPadSensitivity; + SliderWidget *_sliderPadAcceleration; + #ifdef USE_WII_DI int _tabDVD; StaticTextWidget *_textDVDStatus; diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp index 5fabdc1637..9a83c9e1c1 100644 --- a/backends/platform/wii/osystem.cpp +++ b/backends/platform/wii/osystem.cpp @@ -85,6 +85,8 @@ OSystem_Wii::OSystem_Wii() : _event_quit(false), _lastPadCheck(0), + _padSensitivity(16), + _padAcceleration(4), _savefile(NULL), _mixer(NULL), @@ -111,6 +113,8 @@ void OSystem_Wii::initBackend() { ConfMan.registerDefault("wii_video_default_underscan_y", 16); ConfMan.registerDefault("wii_video_ds_underscan_x", 16); ConfMan.registerDefault("wii_video_ds_underscan_y", 16); + ConfMan.registerDefault("wii_pad_sensitivity", 48); + ConfMan.registerDefault("wii_pad_acceleration", 5); ConfMan.registerDefault("wii_smb_server", ""); ConfMan.registerDefault("wii_smb_share", ""); ConfMan.registerDefault("wii_smb_username", ""); @@ -274,5 +278,8 @@ void OSystem_Wii::showOptionsDialog() { WiiOptionsDialog dlg(ds); dlg.runModal(); _optionsDlgActive = false; + + _padSensitivity = 64 - ConfMan.getInt("wii_pad_sensitivity"); + _padAcceleration = 9 - ConfMan.getInt("wii_pad_acceleration"); } diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h index 0a5dac95b3..23097dd027 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -110,6 +110,8 @@ private: bool _event_quit; u32 _lastPadCheck; + u8 _padSensitivity; + u8 _padAcceleration; void initGfx(); void deinitGfx(); diff --git a/backends/platform/wii/osystem_events.cpp b/backends/platform/wii/osystem_events.cpp index 9f00528839..f971f98678 100644 --- a/backends/platform/wii/osystem_events.cpp +++ b/backends/platform/wii/osystem_events.cpp @@ -32,6 +32,8 @@ #include <wiikeyboard/keyboard.h> #endif +#include "common/config-manager.h" + #define TIMER_THREAD_STACKSIZE (1024 * 32) #define TIMER_THREAD_PRIO 64 @@ -179,6 +181,9 @@ void OSystem_Wii::initEvents() { WPAD_SetIdleTimeout(120); #endif + _padSensitivity = 64 - ConfMan.getInt("wii_pad_sensitivity"); + _padAcceleration = 9 - ConfMan.getInt("wii_pad_acceleration"); + #ifdef USE_WII_KBD _kbd_active = KEYBOARD_Init() >= 0; #endif @@ -405,10 +410,12 @@ bool OSystem_Wii::pollEvent(Common::Event &event) { if (time - _lastPadCheck > PAD_CHECK_TIME) { _lastPadCheck = time; - if (abs (PAD_StickX(0)) > 16) - mx += PAD_StickX(0) / (4 * _overlayWidth / _currentWidth); - if (abs (PAD_StickY(0)) > 16) - my -= PAD_StickY(0) / (4 * _overlayHeight / _currentHeight); + if (abs (PAD_StickX(0)) > _padSensitivity) + mx += PAD_StickX(0) / + (_padAcceleration * _overlayWidth / _currentWidth); + if (abs (PAD_StickY(0)) > _padSensitivity) + my -= PAD_StickY(0) / + (_padAcceleration * _overlayHeight / _currentHeight); if (mx < 0) mx = 0; |