Controls are messed up
Brought to you by:
monsterkodi
If kiki enters an exit of a level, while it is still
turning (i.e. <left> or <right> are pressed), the
keyboard controls no longer work in the next level.
For example, if you complete level 1 and "turn" kiki
around during the last jump towards the exit (by
pressing <left>), then you can no longer control kiki
in level 2.
This happens under Windows XP (at least; I don't know
about the other operating systems). The bug occurs in
Version 0.9 and in Version 1.0.2.
Logged In: YES
user_id=590770
The bug occurs, because the rotateActions of kiki are not
properly finished when entering an exit.
To fix this bug, three steps are necessary:
In "KikiPlayer.cpp" add the following method:
void KikiPlayer::finishRotateAction() {
if (rotate_action) {
rotate = false;
finishAction(rotate_action);
}
}
and add the declaration in "KikiPlayer.h" somewhere in the
public section. ("void finishRotateAction();")
Second, in "KikiWorld.cpp", look for the
method "deleteAllObjects". There's the code:
if (Controller.player)
{
removeObject (Controller.player); // remove the
player first, to keep it's state
...
Change that to:
if (Controller.player)
{
Controller.player -> finishRotateAction();
removeObject....
And finally, in "KikiPlayer.cpp" in the
method "handleKey", look for
if (keyName == turn_left_key || keyName == turn_right_key)
{
rotate = (keyName == turn_left_key) ?
ACTION_TURN_LEFT : ACTION_TURN_RIGHT;
player is not performing a rotation and unspiked
{
rotate_action = getActionWithId (rotate);
Controller.timer_event->addAction
(rotate_action);
And just before the Controller.timer_event->addAction
line, add "rotate_action -> reset();"
And you're done. You can now jump into the exit while
turning and the game will not mess up the controls... Not
that you should need the feature, but still: It works
now...
BTW: A similar problem (an omitted "reset" of an action)
causes the "look-up", "look-down" feature to be a little
jumpy. If you are in "camera-follow" mode and press "look
up", but release the key, before the action is finished
and then press "look up" again, kiki looks 90 deg up at
once, without smoothly turning there. This can be cured by
adding an:
look_action -> reset();
just prior to adding it to the Controller.timer_event.
Look in the method handleKey of KikiPlayer again:
if (!look_action)
{
look_action = getActionWithId ((key.name ==
look_up_key) ? ACTION_LOOK_UP : ACTION_LOOK_DOWN);
Controller.timer_event->addAction
(look_action);
}
should be changed to:
...
look_action = ...
look_action -> reset();
Controller.timer_event ...
Have fun,
Philipp