diff options
author | Fabio Battaglia | 2010-01-30 12:57:57 +0000 |
---|---|---|
committer | Fabio Battaglia | 2010-01-30 12:57:57 +0000 |
commit | bff00f002bf14db55d2c9b5dd53148ac3ab4ab8f (patch) | |
tree | 8f199500a78a9f2605e3e02bcdfe0780f92732c4 /backends/platform | |
parent | c02b14d311cd980b36560996dc4b48fec9f2d522 (diff) | |
download | scummvm-rg350-bff00f002bf14db55d2c9b5dd53148ac3ab4ab8f.tar.gz scummvm-rg350-bff00f002bf14db55d2c9b5dd53148ac3ab4ab8f.tar.bz2 scummvm-rg350-bff00f002bf14db55d2c9b5dd53148ac3ab4ab8f.zip |
N64: added comments and slight cleanup
svn-id: r47709
Diffstat (limited to 'backends/platform')
-rw-r--r-- | backends/platform/n64/osys_n64_events.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/backends/platform/n64/osys_n64_events.cpp b/backends/platform/n64/osys_n64_events.cpp index cdd8e16032..5f02f86f27 100644 --- a/backends/platform/n64/osys_n64_events.cpp +++ b/backends/platform/n64/osys_n64_events.cpp @@ -23,9 +23,9 @@ * */ -#include "osys_n64.h" +#include <math.h> // Needed for "tan()" function -#include <math.h> +#include "osys_n64.h" // Pad buttons #define START_BUTTON(a) (a & 0x1000) @@ -77,21 +77,23 @@ void OSystem_N64::readControllerAnalogInput(void) { float mx = _tempMouseX; float my = _tempMouseY; + // Limit the analog range for pad. + // When moving in diagonal the max/min of 128/-128 was not reached + // yielding weird results for the tangent acceleration function if (pad_analogX > 60) pad_analogX = 60; else if (pad_analogX < -60) pad_analogX = -60; - if (pad_analogY > 60) pad_analogY = 60; else if (pad_analogY < -60) pad_analogY = -60; + // Gamepad if (abs(pad_analogX) > PAD_DEADZONE) mx += tan(pad_analogX * (PI / 140)); - if (abs(pad_analogY) > PAD_DEADZONE) my -= tan(pad_analogY * (PI / 140)); + // Mouse if (abs(pad_mouseX) > MOUSE_DEADZONE) mx += pad_mouseX; - if (abs(pad_mouseY) > MOUSE_DEADZONE) my -= pad_mouseY; |