aboutsummaryrefslogtreecommitdiff
path: root/backends/sdl
diff options
context:
space:
mode:
authorTorbjörn Andersson2003-06-08 14:55:21 +0000
committerTorbjörn Andersson2003-06-08 14:55:21 +0000
commit8ab745de662d1f58284a72b2db84ec69319d3491 (patch)
tree46ea4b7e17d58fedea7da2213b76d8a4d14062e4 /backends/sdl
parenta1caf1f9f94cb001ae1aff35fb10a0950de8901c (diff)
downloadscummvm-rg350-8ab745de662d1f58284a72b2db84ec69319d3491.tar.gz
scummvm-rg350-8ab745de662d1f58284a72b2db84ec69319d3491.tar.bz2
scummvm-rg350-8ab745de662d1f58284a72b2db84ec69319d3491.zip
Finally fixed a slight bug in the CoMI cannon behaviour.
svn-id: r8401
Diffstat (limited to 'backends/sdl')
-rw-r--r--backends/sdl/sdl-common.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/backends/sdl/sdl-common.cpp b/backends/sdl/sdl-common.cpp
index cbf48c0819..34cbdedfb3 100644
--- a/backends/sdl/sdl-common.cpp
+++ b/backends/sdl/sdl-common.cpp
@@ -457,8 +457,18 @@ void OSystem_SDL_Common::set_mouse_pos(int x, int y) {
}
void OSystem_SDL_Common::warp_mouse(int x, int y) {
- if (_mouseCurState.x != x || _mouseCurState.y != y)
+ if (_mouseCurState.x != x || _mouseCurState.y != y) {
SDL_WarpMouse(x * _scaleFactor, y * _scaleFactor);
+
+ // SDL_WarpMouse() generates a mouse movement event, so
+ // set_mouse_pos() would be called eventually. However, the
+ // cannon script in CoMI calls this function twice each time
+ // the cannon is reloaded. Unless we update the mouse position
+ // immediately the second call is ignored, causing the cannon
+ // to change its aim.
+
+ set_mouse_pos(x, y);
+ }
}
void OSystem_SDL_Common::set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y) {
@@ -536,14 +546,14 @@ bool OSystem_SDL_Common::poll_event(Event *event) {
// Ctrl-z and Alt-X quit
if ((b == KBD_CTRL && ev.key.keysym.sym=='z') || (b == KBD_ALT && ev.key.keysym.sym=='x')) {
event->event_code = EVENT_QUIT;
- return true;;
+ return true;
}
#ifdef MACOSX
// On Macintosh', Cmd-Q quits
if ((ev.key.keysym.mod & KMOD_META) && ev.key.keysym.sym=='q') {
event->event_code = EVENT_QUIT;
- return true;;
+ return true;
}
#endif
// Ctr-Alt-<key> will change the GFX mode
@@ -565,7 +575,7 @@ bool OSystem_SDL_Common::poll_event(Event *event) {
// quit on fn+backspace on zaurus
if (ev.key.keysym.sym == 127) {
event->event_code = EVENT_QUIT;
- return true;;
+ return true;
}
// map menu key (f11) to f5 (scumm menu)
@@ -812,7 +822,7 @@ bool OSystem_SDL_Common::poll_event(Event *event) {
case SDL_QUIT:
event->event_code = EVENT_QUIT;
- return true;;
+ return true;
}
}
return false;