diff options
author | Fabio Battaglia | 2010-01-30 12:53:08 +0000 |
---|---|---|
committer | Fabio Battaglia | 2010-01-30 12:53:08 +0000 |
commit | c02b14d311cd980b36560996dc4b48fec9f2d522 (patch) | |
tree | be7069b5926c4cb957926b7859831fbe6fd9d448 | |
parent | 06bd17ee712f06971273d526f389f9a352f3e8ec (diff) | |
download | scummvm-rg350-c02b14d311cd980b36560996dc4b48fec9f2d522.tar.gz scummvm-rg350-c02b14d311cd980b36560996dc4b48fec9f2d522.tar.bz2 scummvm-rg350-c02b14d311cd980b36560996dc4b48fec9f2d522.zip |
N64: Better analog nub acceleration, and added -mhard-float in CXXFLAGS when building
svn-id: r47708
-rw-r--r-- | backends/platform/n64/Makefile | 2 | ||||
-rw-r--r-- | backends/platform/n64/osys_n64.h | 2 | ||||
-rw-r--r-- | backends/platform/n64/osys_n64_events.cpp | 26 |
3 files changed, 19 insertions, 11 deletions
diff --git a/backends/platform/n64/Makefile b/backends/platform/n64/Makefile index 4252cb9668..562c704eb0 100644 --- a/backends/platform/n64/Makefile +++ b/backends/platform/n64/Makefile @@ -34,7 +34,7 @@ endif LIBS += -lm -lstdc++ -lc -lgcc -lz -lnosys -CXXFLAGS = -g -mno-extern-sdata -O2 -fomit-frame-pointer -march=vr4300 -mtune=vr4300 -fno-rtti -fno-exceptions -Wno-multichar -Wshadow -I$(LIBN64PATH) -I$(TOOLPATH)/include -I./ -I$(srcdir) -I$(srcdir)/engines +CXXFLAGS = -g -mno-extern-sdata -O2 -fomit-frame-pointer -march=vr4300 -mtune=vr4300 -mhard-float -fno-rtti -fno-exceptions -Wno-multichar -Wshadow -I$(LIBN64PATH) -I$(TOOLPATH)/include -I./ -I$(srcdir) -I$(srcdir)/engines LDFLAGS = -g -march=vr4300 -mtune=vr4300 -nodefaultlibs -nostartfiles -mno-crt0 -L$(LIBN64PATH) -L$(TOOLPATH)/lib $(LIBS) -T n64ld_cpp.x -Xlinker -Map -Xlinker scummvm.map TARGET = scummvm diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h index 311b35eaf5..ddf4fa7f0c 100644 --- a/backends/platform/n64/osys_n64.h +++ b/backends/platform/n64/osys_n64.h @@ -115,7 +115,7 @@ protected: bool _mouseVisible; volatile int _mouseX, _mouseY; - volatile int _tempMouseX, _tempMouseY; + volatile float _tempMouseX, _tempMouseY; volatile int _mouseMaxX, _mouseMaxY; int _mouseHotspotX, _mouseHotspotY; diff --git a/backends/platform/n64/osys_n64_events.cpp b/backends/platform/n64/osys_n64_events.cpp index fc46a1ddc0..cdd8e16032 100644 --- a/backends/platform/n64/osys_n64_events.cpp +++ b/backends/platform/n64/osys_n64_events.cpp @@ -25,6 +25,8 @@ #include "osys_n64.h" +#include <math.h> + // Pad buttons #define START_BUTTON(a) (a & 0x1000) #define A_BUTTON(a) (a & 0x8000) @@ -48,7 +50,7 @@ #define CD_BUTTON(a) (a & 0x0004) #define MOUSE_DEADZONE 0 -#define PAD_DEADZONE 0 +#define PAD_DEADZONE 1 #define PAD_ACCELERATION 15 #define PAD_CHECK_TIME 40 @@ -72,14 +74,20 @@ void OSystem_N64::readControllerAnalogInput(void) { pad_mouseY = (_ctrlData.c[_mousePort].throttle >> 0) & 0xFF; } - int32 mx = _tempMouseX; - int32 my = _tempMouseY; + float mx = _tempMouseX; + float my = _tempMouseY; + + 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; if (abs(pad_analogX) > PAD_DEADZONE) - mx += pad_analogX / (PAD_ACCELERATION - (abs(pad_analogX) / 20)); + mx += tan(pad_analogX * (PI / 140)); if (abs(pad_analogY) > PAD_DEADZONE) - my -= pad_analogY / (PAD_ACCELERATION - (abs(pad_analogY) / 20)); + my -= tan(pad_analogY * (PI / 140)); if (abs(pad_mouseX) > MOUSE_DEADZONE) mx += pad_mouseX; @@ -274,8 +282,8 @@ bool OSystem_N64::pollEvent(Common::Event &event) { if ((curTime - _lastPadCheck) > PAD_CHECK_TIME) { _lastPadCheck = curTime; - int32 mx = _tempMouseX; - int32 my = _tempMouseY; + float mx = _tempMouseX; + float my = _tempMouseY; if (left_digital || right_digital || up_digital || down_digital) { if (left_digital) @@ -303,8 +311,8 @@ bool OSystem_N64::pollEvent(Common::Event &event) { if ((mx != _mouseX) || (my != _mouseY)) { event.type = Common::EVENT_MOUSEMOVE; - event.mouse.x = _tempMouseX = _mouseX = mx; - event.mouse.y = _tempMouseY = _mouseY = my; + event.mouse.x = _mouseX = _tempMouseX = mx; + event.mouse.y = _mouseY = _tempMouseY = my; _dirtyOffscreen = true; |