Fixed some bugs with gamepad controls.
Included a bug where axis controls got stuck after the end of a mission, and one where hat controls caused massive movement speed.
This commit is contained in:
parent
13a2f0fba5
commit
9a5076bb93
10
src/player.c
10
src/player.c
|
@ -310,10 +310,10 @@ void player_getInput()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_JOYHATMOTION:
|
case SDL_JOYHATMOTION:
|
||||||
engine.keyState[KEY_UP] = engine.event.jhat.value & SDL_HAT_UP;
|
engine.keyState[KEY_UP] = (engine.event.jhat.value & SDL_HAT_UP ? 1 : 0);
|
||||||
engine.keyState[KEY_DOWN] = engine.event.jhat.value & SDL_HAT_DOWN;
|
engine.keyState[KEY_DOWN] = (engine.event.jhat.value & SDL_HAT_DOWN ? 1 : 0);
|
||||||
engine.keyState[KEY_LEFT] = engine.event.jhat.value & SDL_HAT_LEFT;
|
engine.keyState[KEY_LEFT] = (engine.event.jhat.value & SDL_HAT_LEFT ? 1 : 0);
|
||||||
engine.keyState[KEY_RIGHT] = engine.event.jhat.value & SDL_HAT_RIGHT;
|
engine.keyState[KEY_RIGHT] = (engine.event.jhat.value & SDL_HAT_RIGHT ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_JOYAXISMOTION:
|
case SDL_JOYAXISMOTION:
|
||||||
|
@ -389,6 +389,8 @@ void player_leaveSector()
|
||||||
engine.keyState[KEY_RIGHT] = 0;
|
engine.keyState[KEY_RIGHT] = 0;
|
||||||
engine.keyState[KEY_FIRE] = 0;
|
engine.keyState[KEY_FIRE] = 0;
|
||||||
engine.keyState[KEY_ALTFIRE] = 0;
|
engine.keyState[KEY_ALTFIRE] = 0;
|
||||||
|
engine.xaxis = 0;
|
||||||
|
engine.yaxis = 0;
|
||||||
|
|
||||||
if (engine.done == ENGINE_RUNNING)
|
if (engine.done == ENGINE_RUNNING)
|
||||||
engine.done = ENGINE_FORMATION;
|
engine.done = ENGINE_FORMATION;
|
||||||
|
|
Loading…
Reference in New Issue