On Tue, 2012-05-15 at 10:11 +0300, Kalle Olavi Niemitalo wrote:
> Martin Erik Werner <martinerikwer...@gmail.com> writes:
> 
> > Here is a patch which fixes this issue for me, it is based on a
> > suggestion at
> > http://egoboo.sourceforge.net/phpBB3/viewtopic.php?f=3&t=1177&p=61333#p61333,
> >  see the DEP-3 header for more information.
> 
> That patch adds casts to two control_is_pressed subtractions in
> set_one_player_latch.  However, the bug also occurs in three
> statements in camera_move.  IIRC, this causes sprites to
> disappear when you try to rotate the camera.  Instead of adding
> casts to each of those calls, I recommend changing
> control_is_pressed so it returns int.
> 
> In https://egoboo.svn.sourceforge.net/svnroot/egoboo/branches/2.8.x/,
> control_is_pressed has been renamed to input_device_control_active,
> and game/camera.c and game/game.c no longer do arithmetic with its
> return values.

Ah, a good idea, I was not aware of the other issues, I've modified the
patch to change the function to return ints instead. I've played through
a level with it and afaict it works as it should.

-- 
Martin Erik Werner <martinerikwer...@gmail.com>
Description: fix up/left movement bug
 Change control_is_pressed() function to returning ints, this allows
 doing math on the return value, and fixes the issue of the player
 not being able to move up or left.
Forwarded: not-needed
Bug-Debian: http://bugs.debian.org/662300
Author: Martin Erik Werner <martinerikwer...@gmail.com>
Last-Update: 2012-05-15

diff --git a/src/game/input.c b/src/game/input.c
index d1dca4d..e56b874 100755
--- a/src/game/input.c
+++ b/src/game/input.c
@@ -405,7 +405,7 @@ Uint32 input_get_buttonmask( Uint32 idevice )
 }
 
 //--------------------------------------------------------------------------------------------
-bool_t control_is_pressed( Uint32 idevice, Uint8 icontrol )
+int control_is_pressed( Uint32 idevice, Uint8 icontrol )
 {
     /// @details ZZ@> This function returns btrue if the given icontrol is cursor_pressed...
 
@@ -430,7 +430,7 @@ bool_t control_is_pressed( Uint32 idevice, Uint8 icontrol )
         retval = ( input_get_buttonmask( idevice ) == pcontrol->tag );
     }
 
-    return retval;
+    return (int)retval;
 }
 
 //--------------------------------------------------------------------------------------------
diff --git a/src/game/input.h b/src/game/input.h
index 28c6a99..9499e94 100755
--- a/src/game/input.h
+++ b/src/game/input.h
@@ -144,7 +144,7 @@ void   input_read();
 
 Uint32 input_get_buttonmask( Uint32 idevice );
 
-bool_t control_is_pressed( Uint32 idevice, Uint8 icontrol );
+int control_is_pressed( Uint32 idevice, Uint8 icontrol );
 
 void   cursor_reset();
 void   cursor_finish_wheel_event();
-- 
1.7.10

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to