diff --git a/goal_src/jak2/engine/gfx/mood/time-of-day.gc b/goal_src/jak2/engine/gfx/mood/time-of-day.gc index eb439c2af8..5eebf20817 100644 --- a/goal_src/jak2/engine/gfx/mood/time-of-day.gc +++ b/goal_src/jak2/engine/gfx/mood/time-of-day.gc @@ -113,7 +113,8 @@ ) ) ) - (update-time-and-speed *sky-work* (-> self time-of-day) (-> self time-ratio)) + ;; og:preserve-this high fps fix + (update-time-and-speed *sky-work* (-> self time-of-day) (* (-> self time-ratio) DISPLAY_FPS_RATIO)) 0 (none) ) diff --git a/goal_src/jak2/engine/ps2/pad.gc b/goal_src/jak2/engine/ps2/pad.gc index 8c77e3ab01..01442e88ae 100644 --- a/goal_src/jak2/engine/ps2/pad.gc +++ b/goal_src/jak2/engine/ps2/pad.gc @@ -152,7 +152,6 @@ The cpad-set-buzz! function can be used for vibration. ) ) - (defmacro cpad-type? (type) `(= (shr (-> pad status) 4) (cpad-type ,type)) ) @@ -215,7 +214,6 @@ The cpad-set-buzz! function can be used for vibration. ) ) - (defmethod new cpad-list ((allocation symbol) (type-to-make type)) "Create a cpad-list for 2 controllers. It's fine to do this even if one or both controllers aren't connected yet." @@ -227,6 +225,36 @@ The cpad-set-buzz! function can be used for vibration. ) ) + ;; Allocates enough input frames to support counting 50ms of time at 300fps. +(deftype cpad-history (basic) + ((button0-abs pad-buttons 15) ;; bitmask of buttons, pressed or not, with history + (button0-rel pad-buttons 15) ;; bitmask of if button going down. + ) +) + +;; List of extended history for controllers at high fps. It always has 4 controllers. +(deftype cpad-history-list (basic) + ((num-cpads int32) + (cpads cpad-history 4) ;; modified from 2->4 for PC 4-pad support + ) + (:methods + (new (symbol type) _type_) + ) + ) + +(defmethod new cpad-history-list ((allocation symbol) (type-to-make type)) + "Create a cpad-history-list for 4 controllers. It's fine to do this even if controllers + aren't connected yet. " + (let ((this (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> this num-cpads) 4) + (set! (-> this cpads 0) (new 'global 'cpad-history)) + (set! (-> this cpads 1) (new 'global 'cpad-history)) + (set! (-> this cpads 2) (new 'global 'cpad-history)) + (set! (-> this cpads 3) (new 'global 'cpad-history)) + this + ) + ) + (defun analog-input ((arg0 int) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) "Convert integer input from pad into a float between -out-range and +out-range. The offset is applied directly to the input. @@ -311,6 +339,17 @@ The cpad-set-buzz! function can be used for vibration. ;; the two controllers (define *cpad-list* (new 'global 'cpad-list)) +;; the cpad-history for each controller +(define *cpad-history-list* (new 'global 'cpad-history-list)) + +(desfun generate-frame-checks (pad-idx frames) + (if (= frames 0) + 0 + `(logior (-> *cpad-history-list* cpads ,pad-idx button0-rel ,(- frames 1)) + ,(generate-frame-checks pad-idx (- frames 1)) + ) + ) +) ;; weird leftover debug thing, enabling overrides the x position of both sticks on both controllers. (define *cpad-debug* #f) @@ -324,7 +363,9 @@ The cpad-set-buzz! function can be used for vibration. "Read from cpads and update vibration" (let ((pads *cpad-list*)) (dotimes (i (-> pads num-cpads)) - (let ((pad (-> *cpad-list* cpads i))) + (let ((pad (-> *cpad-list* cpads i)) + ;; og:preserve-this high fps fix + (history (-> *cpad-history-list* cpads i))) (set! (-> pad old-leftx 1) (-> pad old-leftx 0)) (set! (-> pad old-leftx 0) (-> pad leftx)) (set! (-> pad old-lefty 1) (-> pad old-lefty 0)) @@ -376,6 +417,48 @@ The cpad-set-buzz! function can be used for vibration. (set! (-> pad button0-abs 1) (-> pad button0-shadow-abs 0)) (set! (-> pad button0-rel 2) (-> pad button0-rel 1)) (set! (-> pad button0-rel 1) (-> pad button0-rel 0)) + + ;; og:preserve-this high fps fix + (when (>= (-> *pc-settings* target-fps) 300) + (set! (-> history button0-abs 14) (-> history button0-abs 13)) + (set! (-> history button0-abs 13) (-> history button0-abs 12)) + (set! (-> history button0-abs 12) (-> history button0-abs 11)) + + (set! (-> history button0-rel 14) (-> history button0-rel 13)) + (set! (-> history button0-rel 13) (-> history button0-rel 12)) + (set! (-> history button0-rel 12) (-> history button0-rel 11)) + ) + (when (>= (-> *pc-settings* target-fps) 240) + (set! (-> history button0-abs 11) (-> history button0-abs 10)) + (set! (-> history button0-abs 10) (-> history button0-abs 9)) + (set! (-> history button0-abs 9) (-> history button0-abs 8)) + (set! (-> history button0-rel 11) (-> history button0-rel 10)) + (set! (-> history button0-rel 10) (-> history button0-rel 9)) + (set! (-> history button0-rel 9) (-> history button0-rel 8)) + ) + (when (>= (-> *pc-settings* target-fps) 165) + (set! (-> history button0-abs 8) (-> history button0-abs 7)) + (set! (-> history button0-abs 7) (-> history button0-abs 6)) + (set! (-> history button0-abs 6) (-> history button0-abs 5)) + (set! (-> history button0-rel 8) (-> history button0-rel 7)) + (set! (-> history button0-rel 7) (-> history button0-rel 6)) + (set! (-> history button0-rel 6) (-> history button0-rel 5)) + ) + (when (>= (-> *pc-settings* target-fps) 120) + (set! (-> history button0-abs 5) (-> history button0-abs 4)) + (set! (-> history button0-abs 4) (-> history button0-abs 3)) + (set! (-> history button0-rel 5) (-> history button0-rel 4)) + (set! (-> history button0-rel 4) (-> history button0-rel 3)) + ) + (when (>= (-> *pc-settings* target-fps) 75) + (set! (-> history button0-abs 3) (-> history button0-abs 2)) + (set! (-> history button0-rel 3) (-> history button0-rel 2)) + ) + (set! (-> history button0-abs 2) (-> history button0-abs 1)) + (set! (-> history button0-abs 1) (-> pad button0-shadow-abs 0)) + (set! (-> history button0-rel 2) (-> history button0-rel 1)) + (set! (-> history button0-rel 1) (-> pad button0-rel 0)) + (when (= (-> pad status) 115) (set! (-> pad abutton 0) (the-as uint (if (logtest? (-> pad button0-abs 0) (pad-buttons right)) 255 @@ -515,8 +598,12 @@ The cpad-set-buzz! function can be used for vibration. ) (set! (-> pad button0-shadow-abs 0) buttons-pushed) (set! (-> pad button0-abs 0) buttons-pushed) + (set! (-> history button0-abs 0) (-> pad button0-abs 0)) ) (set! (-> pad button0-rel 0) (logclear (-> pad button0-abs 0) (-> pad button0-abs 1))) + (set! (-> history button0-rel 0) (-> pad button0-rel 0)) + + (when *cpad-debug* (set! (-> pad leftx) (the-as uint 255)) (set! (-> pad rightx) (the-as uint 255)) @@ -579,6 +666,11 @@ The cpad-set-buzz! function can be used for vibration. `(logtest? (cpad-pressed ,pad-idx) (pad-buttons ,@buttons)) ) +(defmacro recently-pressed? (&key (pad-idx (-> self control cpad number)) &key (frames 15) &rest buttons) + "Checks if a (pad-button) was pressed within the last 50ms, based on frames" + `(logtest? ,(generate-frame-checks pad-idx frames) (pad-buttons ,@buttons)) +) + (defmacro cpad-hold? (pad-idx &rest buttons) `(logtest? (cpad-hold ,pad-idx) (pad-buttons ,@buttons)) ) diff --git a/goal_src/jak2/engine/target/board/board-states.gc b/goal_src/jak2/engine/target/board/board-states.gc index 77e9beaf9a..eb1822cba7 100644 --- a/goal_src/jak2/engine/target/board/board-states.gc +++ b/goal_src/jak2/engine/target/board/board-states.gc @@ -584,13 +584,8 @@ ) (go target-board-duck-stance) ) - (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (when (and (recently-pressed? x) (can-jump? 'board) ) (let ((gp-0 (vector-flatten! @@ -760,13 +755,8 @@ ) (go target-board-stance) ) - (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (when (and (recently-pressed? x) (can-jump? 'board) ) (let ((gp-0 (vector-flatten! @@ -1923,13 +1913,8 @@ ) :exit target-board-exit :trans (behavior () - (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (when (and (recently-pressed? x) (can-jump? 'board) ) (flush-trick-list (-> self board)) @@ -2020,13 +2005,8 @@ ) :exit target-board-exit :trans (behavior () - (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (when (and (recently-pressed? x) (can-jump? 'board) ) (flush-trick-list (-> self board)) @@ -2168,13 +2148,8 @@ ) ) :trans (behavior () - (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (when (and (recently-pressed? x) (can-jump? 'board) ) (let ((v1-15 (/ (- (current-time) (-> self board ride-start-time)) 300))) diff --git a/goal_src/jak2/engine/target/gun/gun-states.gc b/goal_src/jak2/engine/target/gun/gun-states.gc index fb3792fe5d..474ca999b4 100644 --- a/goal_src/jak2/engine/target/gun/gun-states.gc +++ b/goal_src/jak2/engine/target/gun/gun-states.gc @@ -79,35 +79,20 @@ (remove-exit) (go target-duck-stance #f) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) ) (target-jump-go) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons circle) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? circle) (can-feet? #t) ) (go target-attack) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons square) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? square) (can-hands? #t) ) (go target-running-attack) @@ -350,13 +335,8 @@ (if (want-to-darkjak?) (go target-darkjak-get-on (darkjak-stage active)) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons l1) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? l1) (and (!= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) (can-roll?)) ) (go target-roll) @@ -366,35 +346,20 @@ (remove-exit) (go target-duck-walk #f) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) ) (target-jump-go) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons circle) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? circle) (can-feet? #t) ) (go target-attack) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons square) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? square) (can-hands? #t) ) (go target-running-attack) diff --git a/goal_src/jak2/engine/target/target-carry.gc b/goal_src/jak2/engine/target/target-carry.gc index bb00e4fcf6..4d95bce04f 100644 --- a/goal_src/jak2/engine/target/target-carry.gc +++ b/goal_src/jak2/engine/target/target-carry.gc @@ -430,13 +430,8 @@ (if (cpad-pressed? (-> self control cpad number) r1) (go target-carry-drop) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) ) (go target-carry-jump (-> *TARGET-bank* carry-jump-height-min) (-> *TARGET-bank* carry-jump-height-max) #f) @@ -483,13 +478,8 @@ (if (cpad-pressed? (-> self control cpad number) r1) (go target-carry-drop) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) ) (go target-carry-jump (-> *TARGET-bank* carry-jump-height-min) (-> *TARGET-bank* carry-jump-height-max) #f) @@ -604,13 +594,8 @@ (logclear! (-> self state-flags) (state-flags lleg-still rleg-still)) ) :trans (behavior () - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) ) (go target-carry-jump (-> *TARGET-bank* carry-jump-height-min) (-> *TARGET-bank* carry-jump-height-max) #f) diff --git a/goal_src/jak2/engine/target/target-gun.gc b/goal_src/jak2/engine/target/target-gun.gc index 66fa6df69b..071159e24f 100644 --- a/goal_src/jak2/engine/target/target-gun.gc +++ b/goal_src/jak2/engine/target/target-gun.gc @@ -2224,40 +2224,20 @@ (let ((v1-75 (-> self gun gun-type))) (or (and (cond ((= v1-75 (pickup-type eco-yellow)) - (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons down) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (recently-pressed? down) ) ((= v1-75 (pickup-type eco-red)) - (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons up) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (recently-pressed? up) ) ((= v1-75 (pickup-type eco-blue)) - (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons left) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (recently-pressed? left) ) (else - (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons right) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (recently-pressed? right) ) ) (and (not (cpad-hold? (-> self control cpad number) r1)) diff --git a/goal_src/jak2/engine/target/target-swim.gc b/goal_src/jak2/engine/target/target-swim.gc index bd607950cb..ae023dedf2 100644 --- a/goal_src/jak2/engine/target/target-swim.gc +++ b/goal_src/jak2/engine/target/target-swim.gc @@ -38,13 +38,8 @@ (if (!= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) (go target-wade-walk) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) ) (target-jump-go) @@ -90,13 +85,8 @@ (if (and (cpad-hold? (-> self control cpad number) l1) (can-duck?)) (go target-duck-walk #f) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) ) (target-jump-go) @@ -409,25 +399,15 @@ (go target-stance) ) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) (time-elapsed? (-> self water enter-swim-time) (seconds 0.1)) ) (go target-swim-jump (-> *TARGET-bank* swim-jump-height-min) (-> *TARGET-bank* swim-jump-height-max)) ) - (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons circle square) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (when (and (recently-pressed? circle square) (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) ) (spawn-ripples (-> self water) 0.7 (-> self control trans) 1 *null-vector* #t) @@ -526,25 +506,15 @@ (go target-stance) ) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) (time-elapsed? (-> self water enter-swim-time) (seconds 0.1)) ) (go target-swim-jump (-> *TARGET-bank* swim-jump-height-min) (-> *TARGET-bank* swim-jump-height-max)) ) - (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons circle square) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (when (and (recently-pressed? circle square) (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) ) (spawn-ripples (-> self water) 0.7 (-> self control trans) 1 *null-vector* #t) diff --git a/goal_src/jak2/engine/target/target-tube.gc b/goal_src/jak2/engine/target/target-tube.gc index 70ca748ae2..bacc5476fb 100644 --- a/goal_src/jak2/engine/target/target-tube.gc +++ b/goal_src/jak2/engine/target/target-tube.gc @@ -682,13 +682,8 @@ ) :exit (-> target-tube-start exit) :trans (behavior () - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) ) (go target-tube-jump (-> *TARGET-bank* tube-jump-height-min) (-> *TARGET-bank* tube-jump-height-max)) diff --git a/goal_src/jak2/engine/target/target.gc b/goal_src/jak2/engine/target/target.gc index a4c53eb46b..b333343b9d 100644 --- a/goal_src/jak2/engine/target/target.gc +++ b/goal_src/jak2/engine/target/target.gc @@ -81,35 +81,21 @@ (remove-exit) (go target-duck-stance #f) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) ) (target-jump-go) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons circle) - ) + + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? circle) (can-feet? #t) ) (go target-attack) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons square) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? square) (can-hands? #t) ) (go target-running-attack) @@ -122,14 +108,9 @@ ) (go target-gun-stance) ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 (if (and (logtest? (-> self game features) (game-feature carry)) - (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons r1) - ) + (recently-pressed? r1) ) (go target-carry-pickup) ) @@ -160,13 +141,8 @@ (remove-exit) (go target-ice-walk) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons l1) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? l1) (and (!= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) (can-roll?)) ) (go target-roll) @@ -184,35 +160,20 @@ (if (want-to-darkjak?) (go target-darkjak-get-on (darkjak-stage active)) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) ) (target-jump-go) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons circle) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? circle) (can-feet? #t) ) (go target-attack) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons square) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? square) (can-hands? #t) ) (go target-running-attack) @@ -224,14 +185,9 @@ (set! (-> self control transv w) 1.0) (go target-turn-around) ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 (if (and (logtest? (-> self game features) (game-feature carry)) - (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons r1) - ) + (recently-pressed? r1) ) (go target-carry-pickup) ) @@ -263,13 +219,8 @@ ) :trans (behavior () ((-> self state-hook)) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) ) (target-jump-go) @@ -454,13 +405,8 @@ ) (set-time! (-> self control sliding-start-time)) ) - (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (when (and (recently-pressed? x) (can-jump? #f) (!= (-> self state-time) (current-time)) ) @@ -472,25 +418,15 @@ (vector-normalize-copy! (-> self control transv) (-> self control force-turn-to-direction) 40960.0) (go target-jump (-> *TARGET-bank* jump-height-min) (-> *TARGET-bank* jump-height-max) *slide-jump-mods*) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons circle) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? circle) (can-feet? #t) (!= (-> self state-time) (current-time)) ) (go target-attack) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons square) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? square) (can-hands? #t) (time-elapsed? (-> self control last-running-attack-end-time) (seconds 0.7)) (!= (-> self state-time) (current-time)) @@ -810,13 +746,8 @@ (if (want-to-darkjak?) (go target-darkjak-get-on (darkjak-stage active)) ) - (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (when (and (recently-pressed? x) (can-jump? #f) ) (if (= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) @@ -949,13 +880,8 @@ (if (want-to-darkjak?) (go target-darkjak-get-on (darkjak-stage active)) ) - (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (when (and (recently-pressed? x) (can-jump? #f) ) (if (= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) @@ -1463,13 +1389,8 @@ ) ) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons square) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? square) (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 73728.0) (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (and (time-elapsed? (-> self control last-time-of-stuck) (the-as time-frame (-> *TARGET-bank* stuck-timeout))) @@ -1834,13 +1755,8 @@ (logclear! (-> self state-flags) (state-flags lleg-still rleg-still lleg-no-ik rleg-no-ik)) ) :trans (behavior () - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) ) (target-jump-go) @@ -1854,24 +1770,14 @@ (go target-walk) ) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons circle) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? circle) (can-feet? #t) ) (go target-attack) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons square) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? square) (can-hands? #t) ) (go target-running-attack) @@ -2092,13 +1998,8 @@ (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) (talker-spawn-func (-> *talker-speech* 328) *entity-pool* (target-pos 0) (the-as region #f)) ) - (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (when (and (recently-pressed? x) (can-jump? #f) ) (set-quaternion! (-> self control) (-> self control dir-targ)) @@ -3492,13 +3393,8 @@ :exit target-exit :trans (behavior () (when (and (!= (-> self control unknown-spool-anim00) 'stuck) (!= (-> self state-time) (current-time))) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons circle) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? circle) (can-feet? #f) ) (go target-attack-air 'flop) @@ -3664,13 +3560,8 @@ (set! (-> self state-hook) (the-as (function none :behavior target) nothing)) ) (else - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? 'target-roll-flip) ) (go target-roll-flip (-> *TARGET-bank* roll-flip-height) (-> *TARGET-bank* roll-flip-dist)) @@ -3828,13 +3719,8 @@ (set! (-> self state-hook) (the-as (function none :behavior target) nothing)) ) (else - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) (or (not (-> *TARGET-bank* strafe-duck-jump)) (not (enabled-gun? self))) ) diff --git a/goal_src/jak2/engine/target/target2.gc b/goal_src/jak2/engine/target/target2.gc index c2d55650e1..c8d777a003 100644 --- a/goal_src/jak2/engine/target/target2.gc +++ b/goal_src/jak2/engine/target/target2.gc @@ -531,13 +531,8 @@ (set! (-> self control anim-handle) (the-as handle #f)) ) :trans (behavior () - (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (when (and (recently-pressed? x) (not (logtest? (-> self state-flags) (state-flags prevent-jump))) (time-elapsed? (-> self state-time) (seconds 0.4)) ) @@ -766,13 +761,8 @@ ) :trans (behavior () (when (and (time-elapsed? (-> self state-time) (seconds 0.2)) - (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (recently-pressed? x) (not (logtest? (-> self state-flags) (state-flags prevent-jump))) ) (cond @@ -1134,35 +1124,20 @@ (if (and (cpad-hold? (-> self control cpad number) l1) (can-duck?)) (go target-duck-stance #f) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons x) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? x) (can-jump? #f) ) (target-jump-go) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons circle) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? circle) (can-feet? #t) ) (go target-attack) ) - (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons square) - ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 + (if (and (recently-pressed? square) (can-hands? #t) ) (go target-running-attack) @@ -1175,14 +1150,9 @@ ) (go target-gun-stance) ) + ;; og:preserve-this - High FPS Fix - https://github.com/open-goal/jak-project/pull/3178 (if (and (logtest? (-> self game features) (game-feature carry)) - (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) - ) - (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) - ) - (pad-buttons r1) - ) + (recently-pressed? r1) ) (go target-carry-pickup) )