From 29cd30b9a8aec41497a8ffc08c0301310ecf9164 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Sat, 22 May 2004 08:00:04 +0000 Subject: [PATCH] fix phantom hat when used with a joystick without one, since the code ignored the JOYCAPS_HASPOV flag (d1x r1.5) --- ChangeLog | 4 ++++ arch/win32/joyhh.c | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 45d4140e..3a95e706 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2004-05-22 Matthew Mueller + * arch/win32/joyhh.c: fix phantom hat when used with a joystick + without one, since the code ignored the JOYCAPS_HASPOV flag (d1x + r1.5) + * arch/ogl/gr.c: fix possibility of saving incomplete .tga screenshots if the entire thing wasn't written in one call to write() (d1x r1.35) diff --git a/arch/win32/joyhh.c b/arch/win32/joyhh.c index e2c4fe85..728effe8 100644 --- a/arch/win32/joyhh.c +++ b/arch/win32/joyhh.c @@ -1,4 +1,4 @@ -/* $Id: joyhh.c,v 1.4 2004-05-20 23:10:17 btb Exp $ */ +/* $Id: joyhh.c,v 1.5 2004-05-22 08:00:04 btb Exp $ */ //JOYC.C for D1_3Dfx and D1OpenGL //D1_3Dfx is a Win32 executable using Glide and DirectX 3 //D1OpenGL is a Win32 executable using OpenGL and DirectX 3 @@ -67,6 +67,7 @@ typedef struct Button_info { typedef struct Joy_info { int joyid; ubyte present_mask; + ubyte hat_present; ubyte slow_read; int max_timer; int read_count; @@ -160,7 +161,7 @@ ubyte joy_read_raw_buttons() /* Hat stuff */ - if (joy.dwPOV != JOY_POVCENTERED) + if (joystick.hat_present && joy.dwPOV != JOY_POVCENTERED) { joystick.buttons[19].state = (joy.dwPOV < JOY_POVRIGHT || joy.dwPOV > JOY_POVLEFT); joystick.buttons[15].state = (joy.dwPOV < JOY_POVBACKWARD && joy.dwPOV > JOY_POVFORWARD); @@ -307,7 +308,7 @@ int joy_init(int joyid) //HH: added joyid parameter joystick.present_mask = JOY_1_X_AXIS | JOY_1_Y_AXIS; if (pjc.wCaps & JOYCAPS_HASZ) joystick.present_mask |= JOY_1_Z_AXIS; -// if (pjc.wCaps & JOYCAPS_HASPOV) joystick.present_mask |= JOY_1_POV; + joystick.hat_present = (pjc.wCaps & JOYCAPS_HASPOV) > 0; if (pjc.wCaps & JOYCAPS_HASR) joystick.present_mask |= JOY_1_R_AXIS; if (pjc.wCaps & JOYCAPS_HASU) joystick.present_mask |= JOY_1_U_AXIS; if (pjc.wCaps & JOYCAPS_HASV) joystick.present_mask |= JOY_1_V_AXIS; -- 2.39.2