From 8ab745de662d1f58284a72b2db84ec69319d3491 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 8 Jun 2003 14:55:21 +0000 Subject: Finally fixed a slight bug in the CoMI cannon behaviour. svn-id: r8401 --- backends/sdl/sdl-common.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'backends/sdl') 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- 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; -- cgit v1.2.3