summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/i_joystick.c15
-rw-r--r--src/i_video.c1
2 files changed, 10 insertions, 6 deletions
diff --git a/src/i_joystick.c b/src/i_joystick.c
index 3eb9069d..b6333334 100644
--- a/src/i_joystick.c
+++ b/src/i_joystick.c
@@ -163,13 +163,16 @@ static int GetAxisState(int axis, int invert)
void I_UpdateJoystick(void)
{
- event_t ev;
+ if (joystick != NULL)
+ {
+ event_t ev;
- ev.type = ev_joystick;
- ev.data1 = GetButtonState();
- ev.data2 = GetAxisState(joystick_x_axis, joystick_x_invert);
- ev.data3 = GetAxisState(joystick_y_axis, joystick_y_invert);
+ ev.type = ev_joystick;
+ ev.data1 = GetButtonState();
+ ev.data2 = GetAxisState(joystick_x_axis, joystick_x_invert);
+ ev.data3 = GetAxisState(joystick_y_axis, joystick_y_invert);
- D_PostEvent(&ev);
+ D_PostEvent(&ev);
+ }
}
diff --git a/src/i_video.c b/src/i_video.c
index 0dfccfa3..1666171e 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -37,6 +37,7 @@
#include "doomdef.h"
#include "doomstat.h"
#include "d_main.h"
+#include "i_joystick.h"
#include "i_scale.h"
#include "i_system.h"
#include "i_swap.h"