Skip to content

Commit

Permalink
[jak2] Support STICK_DEADZONE (#3239)
Browse files Browse the repository at this point in the history
fixes #3235
  • Loading branch information
Brent-Hickey authored Dec 3, 2023
1 parent 37069e2 commit e119a66
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions goal_src/jak2/engine/ps2/pad.gc
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ The cpad-set-buzz! function can be used for vibration.
;; weird leftover debug thing, enabling overrides the x position of both sticks on both controllers.
(define *cpad-debug* #f)

(#if PC_PORT
(defconstant STICK_DEADZONE (-> *pc-settings* stick-deadzone))
(defconstant STICK_DEADZONE 0.3)
)

(defun service-cpads ()
"Read from cpads and update vibration"
(let ((pads *cpad-list*))
Expand Down Expand Up @@ -526,7 +531,7 @@ The cpad-set-buzz! function can be used for vibration.
(set! (-> pad stick0-dir) (atan (- f30-0) f28-0))
(set! (-> pad stick0-speed) (fmin 1.0 (sqrtf (+ (* f30-0 f30-0) (* f28-0 f28-0)))))
)
(if (< (-> pad stick0-speed) 0.3)
(if (< (-> pad stick0-speed) STICK_DEADZONE)
(set! (-> pad stick0-speed) 0.0)
)
)
Expand All @@ -540,7 +545,7 @@ The cpad-set-buzz! function can be used for vibration.
)
)
(if (or (!= (-> pad button0-abs 0) (-> pad button0-abs 1))
(or (< 0.3 (-> pad stick0-speed)) (zero? (-> pad change-time)))
(or (< STICK_DEADZONE (-> pad stick0-speed)) (zero? (-> pad change-time)))
)
(set! (-> pad change-time) (get-current-time))
)
Expand Down

0 comments on commit e119a66

Please sign in to comment.