From: <hik...@us...> - 2009-01-31 04:51:58
|
Revision: 3085 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=3085&view=rev Author: hikerstk Date: 2009-01-31 04:51:50 +0000 (Sat, 31 Jan 2009) Log Message: ----------- Fixed bug 2547586 (keys lock after pause): keys pressed when the in-game menu is called would still considered to be pressed when the game is continued. Modified Paths: -------------- trunk/supertuxkart/src/karts/player_kart.cpp trunk/supertuxkart/src/karts/player_kart.hpp trunk/supertuxkart/src/modes/world.cpp Modified: trunk/supertuxkart/src/karts/player_kart.cpp =================================================================== --- trunk/supertuxkart/src/karts/player_kart.cpp 2009-01-30 23:47:31 UTC (rev 3084) +++ trunk/supertuxkart/src/karts/player_kart.cpp 2009-01-31 04:51:50 UTC (rev 3085) @@ -76,6 +76,20 @@ } // reset // ---------------------------------------------------------------------------- +/** Resets the state of control keys. This is used after the in-game menu to + * avoid that any keys pressed at the time the menu is opened are still + * considered to be pressed. + */ +void PlayerKart::resetInputState() +{ + m_steer_val_l = 0; + m_steer_val_r = 0; + m_steer_val = 0; + m_prev_brake = 0; + m_prev_accel = 0; +} // resetKeyState + +// ---------------------------------------------------------------------------- /** This function interprets a kart action and value, and set the corresponding * entries in the kart control data structure. This function handles esp. * cases like 'press left, press right, release right' - in this case after Modified: trunk/supertuxkart/src/karts/player_kart.hpp =================================================================== --- trunk/supertuxkart/src/karts/player_kart.hpp 2009-01-30 23:47:31 UTC (rev 3084) +++ trunk/supertuxkart/src/karts/player_kart.hpp 2009-01-31 04:51:50 UTC (rev 3085) @@ -63,10 +63,11 @@ virtual void crashed (Kart *k); virtual void setPosition (int p); virtual void raceFinished (float time); - virtual void doingShortcut(); + virtual void doingShortcut (); bool isPlayerKart () const {return true;} Camera* getCamera () {return m_camera;} - void reset(); + void reset (); + void resetInputState (); }; #endif Modified: trunk/supertuxkart/src/modes/world.cpp =================================================================== --- trunk/supertuxkart/src/modes/world.cpp 2009-01-30 23:47:31 UTC (rev 3084) +++ trunk/supertuxkart/src/modes/world.cpp 2009-01-31 04:51:50 UTC (rev 3085) @@ -549,6 +549,8 @@ sound_manager->resumeMusic() ; sfx_manager->resumeAll(); TimedRace::unpause(); + for(unsigned int i=0; i<m_player_karts.size(); i++) + m_player_karts[i]->resetInputState(); } /* EOF */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |