Re: [hatari-devel] IKBD_Cmd_SetMouseScale in the game "The Sentinel"

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


On 25/05/2013 18:24, Nicolas Pomarède wrote:
Hello

there seems to be a problem in the game "The Sentinel" by Firebird.

Moving the mouse is extremely slow ; the only unusual thing is that they
set absolute mouse mode to a very big area, which seems to be
"compensated" by mouse scale command :


IKBD_Cmd_AbsMouseMode 2560,3072
IKBD_Cmd_SetInternalMousePos 1280,1536
IKBD_Cmd_SetMouseScale 8,16
IKBD_Cmd_SetYAxisDown


Then the game read the mouse's position with ReadAbsMousePos.

eg :

IKBD_Cmd_ReadAbsMousePos 1280,1536 0x0
IKBD_Cmd_ReadAbsMousePos 1280,1536 0x0
IKBD_Cmd_ReadAbsMousePos 1280,1536 0x0

Strange thing is that IKBD_Cmd_SetMouseScale is storing values in XScale
and YScale, but it's never used anywhere to scale deltaX/Y values.

Thomas (or anyone else), do you remember if that's an old part that was
never implemented ?

Nicolas



I had a look at the IKBD's ROM to see how it handles these 2 scaling values. When mouse moves, the delta on each axis is multiplied by the scaling value and added to the current absolute position (well, the ikbd's code is a little stanger than that, it doesn't really to a "mul" but does several add/sub of the scaling value...)

The attached patch fixes "The Sentinel", mouse is much faster to play the game now.

You can try it with spectrum512 for example, but I don't think it changes anything (at least hextracker is not affected, it doesn't use this IKBD command)

Nicolas

diff -r 72901f621820 src/ikbd.c
--- a/src/ikbd.c	Fri May 24 23:11:34 2013 +0200
+++ b/src/ikbd.c	Sun May 26 14:32:07 2013 +0200
@@ -1153,13 +1153,19 @@
 
 	/* Update internal mouse coords - Y axis moves according to YAxis setting(up/down) */
 	/* Limit to Max X/Y(inclusive) */
-	KeyboardProcessor.Abs.X += KeyboardProcessor.Mouse.DeltaX;
+	if ( KeyboardProcessor.Mouse.XScale > 1 )
+		KeyboardProcessor.Abs.X += KeyboardProcessor.Mouse.DeltaX * KeyboardProcessor.Mouse.XScale;
+	else
+		KeyboardProcessor.Abs.X += KeyboardProcessor.Mouse.DeltaX;
 	if (KeyboardProcessor.Abs.X < 0)
 		KeyboardProcessor.Abs.X = 0;
 	if (KeyboardProcessor.Abs.X > KeyboardProcessor.Abs.MaxX)
 		KeyboardProcessor.Abs.X = KeyboardProcessor.Abs.MaxX;
 
-	KeyboardProcessor.Abs.Y += KeyboardProcessor.Mouse.DeltaY*KeyboardProcessor.Mouse.YAxis;  /* Needed '+' for Falcon... */
+	if ( KeyboardProcessor.Mouse.YScale > 1 )
+		KeyboardProcessor.Abs.Y += KeyboardProcessor.Mouse.DeltaY*KeyboardProcessor.Mouse.YAxis * KeyboardProcessor.Mouse.YScale;
+	else
+		KeyboardProcessor.Abs.Y += KeyboardProcessor.Mouse.DeltaY*KeyboardProcessor.Mouse.YAxis;
 	if (KeyboardProcessor.Abs.Y < 0)
 		KeyboardProcessor.Abs.Y = 0;
 	if (KeyboardProcessor.Abs.Y > KeyboardProcessor.Abs.MaxY)


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/