aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Apers2006-06-05 19:17:30 +0000
committerChris Apers2006-06-05 19:17:30 +0000
commitf54bf6759fe437400c6115e9d9571f2aa3c62bc4 (patch)
tree2f367184b31831a5f831bfba0c3959b310e2b5d6
parent61737da11580b495e35097f8f39974132349cd2d (diff)
downloadscummvm-rg350-f54bf6759fe437400c6115e9d9571f2aa3c62bc4.tar.gz
scummvm-rg350-f54bf6759fe437400c6115e9d9571f2aa3c62bc4.tar.bz2
scummvm-rg350-f54bf6759fe437400c6115e9d9571f2aa3c62bc4.zip
- Added arrow keys emulation
- Ajust mouse simulation so that there is no more hang while moving it svn-id: r22938
-rw-r--r--backends/PalmOS/Rsc/Resource.Frk/Starter.rsrcbin53078 -> 53276 bytes
-rw-r--r--backends/PalmOS/Rsc/StarterRsc.h7
-rw-r--r--backends/PalmOS/Src/base_event.cpp86
-rw-r--r--backends/PalmOS/Src/base_mouse.cpp10
-rw-r--r--backends/PalmOS/Src/be_base.cpp5
-rw-r--r--backends/PalmOS/Src/be_base.h6
-rw-r--r--backends/PalmOS/Src/globals.h1
-rw-r--r--backends/PalmOS/Src/launcher/launch.cpp1
-rw-r--r--backends/PalmOS/Src/launcher/start.h1
-rw-r--r--backends/PalmOS/Src/zodiac_event.cpp1
10 files changed, 80 insertions, 38 deletions
diff --git a/backends/PalmOS/Rsc/Resource.Frk/Starter.rsrc b/backends/PalmOS/Rsc/Resource.Frk/Starter.rsrc
index f7c514f5f8..026c42d300 100644
--- a/backends/PalmOS/Rsc/Resource.Frk/Starter.rsrc
+++ b/backends/PalmOS/Rsc/Resource.Frk/Starter.rsrc
Binary files differ
diff --git a/backends/PalmOS/Rsc/StarterRsc.h b/backends/PalmOS/Rsc/StarterRsc.h
index ae21e3b529..0f2d7476f2 100644
--- a/backends/PalmOS/Rsc/StarterRsc.h
+++ b/backends/PalmOS/Rsc/StarterRsc.h
@@ -3,7 +3,7 @@
// Header generated by Constructor for Palm OS (R) 1.9.1
//
-// Generated at 21:13:49 on jeudi 9 mars 2006
+// Generated at 20:53:03 on lundi 5 juin 2006
//
// Generated for file: Starter.rsrc
//
@@ -114,9 +114,10 @@
#define TabMiscPalmOSForm 2800 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 120, Usable = 0, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0)
#define TabMiscPalmOSVibratorCheckbox 2802 //(Left Origin = 4, Top Origin = 12, Width = 128, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
#define TabMiscPalmOSNoAutoOffCheckbox 2803 //(Left Origin = 4, Top Origin = 24, Width = 152, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
-#define TabMiscPalmOSStdPaletteCheckbox 2804 //(Left Origin = 4, Top Origin = 72, Width = 146, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
+#define TabMiscPalmOSStdPaletteCheckbox 2804 //(Left Origin = 4, Top Origin = 84, Width = 146, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
#define TabMiscPalmOSLargerStackCheckbox 2805 //(Left Origin = 4, Top Origin = 36, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
-#define TabMiscPalmOSAdvancedCheckbox 2806 //(Left Origin = 4, Top Origin = 84, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
+#define TabMiscPalmOSAdvancedCheckbox 2806 //(Left Origin = 4, Top Origin = 96, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
+#define TabMiscPalmOSArrowCheckbox 2807 //(Left Origin = 4, Top Origin = 72, Width = 150, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
#define TabMiscPalmOSExitLauncherCheckbox 2810 //(Left Origin = 4, Top Origin = 48, Width = 150, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
#define TabMiscPalmOSStylusClickCheckbox 2811 //(Left Origin = 4, Top Origin = 60, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
#define TabMiscPalmOSTabTitlePalmLabel 2801 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold)
diff --git a/backends/PalmOS/Src/base_event.cpp b/backends/PalmOS/Src/base_event.cpp
index 2b52fd4fdb..9a5e972bbd 100644
--- a/backends/PalmOS/Src/base_event.cpp
+++ b/backends/PalmOS/Src/base_event.cpp
@@ -96,30 +96,68 @@ bool OSystem_PalmBase::pollEvent(Event &event) {
keyCurrentState = KeyCurrentState();
// check_hard_keys();
- if ((keyCurrentState & _keyMouseMask)) {
- Int8 sx = 0;
- Int8 sy = 0;
-
- if (keyCurrentState & _keyMouse.bitUp)
- sy = -1;
- else if (keyCurrentState & _keyMouse.bitDown)
- sy = +1;
-
- if (keyCurrentState & _keyMouse.bitLeft)
- sx = -1;
- else if (keyCurrentState & _keyMouse.bitRight)
- sx = +1;
-
- simulate_mouse(event, sx, sy, &x, &y);
- warpMouse(x, y);
- updateScreen();
- // updateCD();
- event.type = EVENT_MOUSEMOVE;
- event.mouse.x = x;
- event.mouse.y = y;
-
- _lastKey = kKeyMouseMove;
- return true;
+ if (!(keyCurrentState & _keyMouseMask)) {
+ _lastKeyRepeat = 0;
+ } else {
+ if (getMillis() >= (_keyMouseRepeat + _keyMouseDelay)) {
+ _keyMouseRepeat = getMillis();
+
+ if (gVars->arrowKeys) {
+ if (keyCurrentState & _keyMouse.bitUp)
+ event.kbd.keycode = 273;
+ else if (keyCurrentState & _keyMouse.bitDown)
+ event.kbd.keycode = 274;
+ else if (keyCurrentState & _keyMouse.bitLeft)
+ event.kbd.keycode = 276;
+ else if (keyCurrentState & _keyMouse.bitRight)
+ event.kbd.keycode = 275;
+ else if (keyCurrentState & _keyMouse.bitButLeft)
+ event.kbd.keycode = chrLineFeed;
+
+ event.type = EVENT_KEYDOWN;
+ event.kbd.ascii = event.kbd.keycode;
+ event.kbd.flags = 0;
+
+ } else {
+ Int8 sx = 0;
+ Int8 sy = 0;
+
+ if (keyCurrentState & _keyMouse.bitUp)
+ sy = -1;
+ else if (keyCurrentState & _keyMouse.bitDown)
+ sy = +1;
+
+ if (keyCurrentState & _keyMouse.bitLeft)
+ sx = -1;
+ else if (keyCurrentState & _keyMouse.bitRight)
+ sx = +1;
+
+ if (sx || sy) {
+ simulate_mouse(event, sx, sy, &x, &y);
+ event.type = EVENT_MOUSEMOVE;
+ _lastKey = kKeyMouseMove;
+
+ } else {
+ x = _mouseCurState.x;
+ y = _mouseCurState.y;
+
+ if (keyCurrentState & _keyMouse.bitButLeft) {
+ event.type = EVENT_LBUTTONDOWN;
+ _lastKey = kKeyMouseLButton;
+
+ } else if (_lastKey == kKeyMouseLButton) {
+ event.type = EVENT_LBUTTONUP;
+ _lastKey = kKeyNone;
+ }
+ }
+
+ event.mouse.x = x;
+ event.mouse.y = y;
+ warpMouse(x, y);
+ // updateCD();
+ }
+ return true;
+ }
}
if (ev.eType == keyDownEvent) {
diff --git a/backends/PalmOS/Src/base_mouse.cpp b/backends/PalmOS/Src/base_mouse.cpp
index 8fa0802585..1fb00e1551 100644
--- a/backends/PalmOS/Src/base_mouse.cpp
+++ b/backends/PalmOS/Src/base_mouse.cpp
@@ -52,14 +52,10 @@ void OSystem_PalmBase::simulate_mouse(Event &event, Int8 iHoriz, Int8 iVert, Coo
Int16 y = _mouseCurState.y;
Int16 slow;
- if (_lastKey != kKeyNone) {
- _lastKeyRepeat++;
+ _lastKeyRepeat++;
- if (_lastKeyRepeat > 16)
- _lastKeyRepeat = 16;
- }
- else
- _lastKeyRepeat = 0;
+ if (_lastKeyRepeat > 32)
+ _lastKeyRepeat = 32;
slow = (iHoriz && iVert) ? 2 : 1;
diff --git a/backends/PalmOS/Src/be_base.cpp b/backends/PalmOS/Src/be_base.cpp
index 26521adb16..938b3b98c6 100644
--- a/backends/PalmOS/Src/be_base.cpp
+++ b/backends/PalmOS/Src/be_base.cpp
@@ -66,6 +66,9 @@ OSystem_PalmBase::OSystem_PalmBase() {
MemSet(&_mouseOldState, sizeof(_mouseOldState), 0);
MemSet(&_timer, sizeof(TimerType), 0);
MemSet(&_sound, sizeof(SoundType), 0);
+
+ _keyMouseRepeat = 0;
+ _keyMouseDelay = (gVars->arrowKeys) ? computeMsecs(125) : computeMsecs(25);
}
void OSystem_PalmBase::initBackend() {
@@ -88,7 +91,7 @@ uint32 OSystem_PalmBase::getMillis() {
}
void OSystem_PalmBase::delayMillis(uint msecs) {
- Int32 delay = (SysTicksPerSecond() * msecs) / 1000;
+ Int32 delay = computeMsecs(msecs);
if (delay > 0)
SysTaskDelay(delay);
diff --git a/backends/PalmOS/Src/be_base.h b/backends/PalmOS/Src/be_base.h
index a5ef22a226..bfbe8e9b23 100644
--- a/backends/PalmOS/Src/be_base.h
+++ b/backends/PalmOS/Src/be_base.h
@@ -49,6 +49,8 @@ enum {
#define kDrawBatLow 3020
#define kDrawFight 3030
+#define computeMsecs(x) ((SysTicksPerSecond() * x) / 1000)
+
typedef struct {
UInt32 duration, nextExpiry;
Boolean active;
@@ -131,7 +133,7 @@ protected:
Boolean _overlayVisible;
Boolean _redawOSD, _setPalette;
- UInt32 _keyMouseMask;
+ UInt32 _keyMouseMask, _keyMouseRepeat, _keyMouseDelay;
struct {
UInt32 bitUp;
UInt32 bitDown;
@@ -140,7 +142,7 @@ protected:
UInt32 bitButLeft;
Boolean hasMore;
} _keyMouse;
-
+
bool _mouseVisible;
bool _mouseDrawn;
MousePos _mouseCurState;
diff --git a/backends/PalmOS/Src/globals.h b/backends/PalmOS/Src/globals.h
index 4f6f455119..07034aeb02 100644
--- a/backends/PalmOS/Src/globals.h
+++ b/backends/PalmOS/Src/globals.h
@@ -92,6 +92,7 @@ typedef struct {
Boolean stdPalette;
Boolean filter;
Boolean stylusClick;
+ Boolean arrowKeys;
UInt8 init;
UInt8 palmVolume;
UInt8 fmQuality;
diff --git a/backends/PalmOS/Src/launcher/launch.cpp b/backends/PalmOS/Src/launcher/launch.cpp
index bd54dfeb74..c57738bb5f 100644
--- a/backends/PalmOS/Src/launcher/launch.cpp
+++ b/backends/PalmOS/Src/launcher/launch.cpp
@@ -437,6 +437,7 @@ Boolean StartScummVM() {
gVars->stylusClick = gPrefs->stylusClick;
gVars->autoSave = (gPrefs->autoSave ? gPrefs->autoSavePeriod : -1);
gVars->advancedMode = gPrefs->advancedMode;
+ gVars->arrowKeys = gPrefs->arrowKeys;
// user params
HWR_RSTALL();
diff --git a/backends/PalmOS/Src/launcher/start.h b/backends/PalmOS/Src/launcher/start.h
index 4d3afade59..a30414a54f 100644
--- a/backends/PalmOS/Src/launcher/start.h
+++ b/backends/PalmOS/Src/launcher/start.h
@@ -43,6 +43,7 @@ typedef struct {
Boolean exitLauncher;
Boolean goLCD;
Boolean stylusClick;
+ Boolean arrowKeys;
UInt16 listPosition;
UInt16 autoSavePeriod;
diff --git a/backends/PalmOS/Src/zodiac_event.cpp b/backends/PalmOS/Src/zodiac_event.cpp
index b573ec82ce..68afbe87a9 100644
--- a/backends/PalmOS/Src/zodiac_event.cpp
+++ b/backends/PalmOS/Src/zodiac_event.cpp
@@ -71,7 +71,6 @@ bool OSystem_PalmZodiac::check_event(Event &event, EventPtr ev) {
setFeatureState(kFeatureAspectRatioCorrection, 0);
return false; // not a key
- case vchrRockerCenter:
case vchrActionLeft:
_lastKey = kKeyMouseLButton;
event.type = EVENT_LBUTTONDOWN;