mirror of
https://github.com/open-goal/jak-project.git
synced 2024-11-23 14:20:07 +00:00
g/j2: fix interleaving of local and external highscores (#3264)
Local scores weren't going above external scores even if they were higher, a few test cases: ![Screenshot 2023-12-19 182412](https://github.com/open-goal/jak-project/assets/13153231/bf3c700d-0f23-441e-b537-88794532523b) ![Screenshot 2023-12-19 182446](https://github.com/open-goal/jak-project/assets/13153231/18d5d6eb-54b1-466e-8302-ca629677344f) ![Screenshot 2023-12-19 182442](https://github.com/open-goal/jak-project/assets/13153231/7de763a5-3587-416f-8755-1868049b92ed) ![Screenshot 2023-12-19 182421](https://github.com/open-goal/jak-project/assets/13153231/d44c1b5b-5f4f-4151-a1f0-e28d7612ed9d)
This commit is contained in:
parent
99da5da441
commit
6cfb89a78a
@ -7440,6 +7440,7 @@
|
||||
(progress-highscores-local-time #x1313)
|
||||
(progress-fps-disclaimer-warning #x1314)
|
||||
(progress-fps-disclaimer #x1315)
|
||||
(progress-highscores-local-score #x1316)
|
||||
(trick-board-none #x1320)
|
||||
(trick-board-spin #x1321)
|
||||
(trick-board-boost #x1322)
|
||||
@ -53476,4 +53477,4 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define-extern *default-envmap-shader* adgif-shader)
|
||||
(define-extern *generic-envmap-texture* texture)
|
||||
(define-extern *generic-envmap-texture* texture)
|
||||
|
@ -167,6 +167,7 @@
|
||||
"1313": "Local Time",
|
||||
"1314": "Warning!",
|
||||
"1315": "This setting is highly experimental. When not played at 60 frames per second, visual and gameplay issues may arise as a result.",
|
||||
"1316": "Local Score",
|
||||
"1320": "None",
|
||||
"1321": "Spin",
|
||||
"1322": "Boost",
|
||||
|
@ -755,6 +755,7 @@
|
||||
(progress-highscores-local-time #x1313)
|
||||
(progress-fps-disclaimer-warning #x1314)
|
||||
(progress-fps-disclaimer #x1315)
|
||||
(progress-highscores-local-score #x1316)
|
||||
(trick-board-none #x1320)
|
||||
(trick-board-spin #x1321)
|
||||
(trick-board-boost #x1322)
|
||||
|
@ -359,19 +359,12 @@
|
||||
(set! (-> font-ctx scale) old-scale))
|
||||
(none))
|
||||
|
||||
(defun progress-pc-is-higher-score-preferred? ((highscore-index int))
|
||||
(case highscore-index
|
||||
((0) #t)
|
||||
((1) #t)
|
||||
((2) #t)
|
||||
((3) #t)
|
||||
((4) #t)
|
||||
((5) #t)
|
||||
((13) #t)
|
||||
((14) #t)
|
||||
(else #f)))
|
||||
(defun progress-pc-local-entry-label ((highscore-index int))
|
||||
(if (and (>= highscore-index 5) (<= highscore-index 12))
|
||||
(text-id progress-highscores-local-time)
|
||||
(text-id progress-highscores-local-score)))
|
||||
|
||||
(defun progress-pc-get-next-external-score ((highscore-index int) (rows-already-printed int))
|
||||
(defun progress-pc-get-next-score ((highscore-index int) (rows-already-printed int))
|
||||
"Fetches the next valid score, merges with local scores. Score will be returned, name will be in [[*pc-cpp-temp-string*]]
|
||||
this is a bit inefficient, but it lets us avoid keeping track of state"
|
||||
(let ((return-next-value? #f)
|
||||
@ -380,8 +373,7 @@
|
||||
(max-local-times (progress-pc-get-num-nonzero-local-scores highscore-index))
|
||||
(max-external-times (progress-pc-max-external-scores highscore-index))
|
||||
(times-enumerated 0)
|
||||
(local-score-ptr (get-game-score-ref *game-info* (get-highscore-score highscore-index)))
|
||||
(higher-score-preferred? (progress-pc-is-higher-score-preferred? highscore-index)))
|
||||
(local-score-ptr (get-game-score-ref *game-info* (get-highscore-score highscore-index))))
|
||||
;; first check if we should return the next value
|
||||
(while (< times-enumerated (progress-pc-max-highscore-rows highscore-index))
|
||||
(when (>= times-enumerated rows-already-printed)
|
||||
@ -391,35 +383,35 @@
|
||||
((and (< local-index max-local-times) (< external-index max-external-times))
|
||||
(progress-pc-get-external-time highscore-index external-index)
|
||||
(cond
|
||||
((and (not higher-score-preferred?) (< (-> local-score-ptr local-index) (-> *progress-pc-generic-store* custom-highscore-score)))
|
||||
(inc! times-enumerated)
|
||||
((> (-> local-score-ptr local-index) (-> *progress-pc-generic-store* custom-highscore-score))
|
||||
;; local score is higher, use the local one
|
||||
(if return-next-value?
|
||||
(begin
|
||||
(clear *pc-cpp-temp-string*)
|
||||
(format *pc-cpp-temp-string* "~S~S" "~[~1L" (lookup-text! *common-text* (text-id progress-highscores-local-time) #f))
|
||||
(return (-> local-score-ptr local-index)))
|
||||
(inc! local-index)))
|
||||
(begin
|
||||
(clear *pc-cpp-temp-string*)
|
||||
(format *pc-cpp-temp-string* "~S~S" "~[~1L" (lookup-text! *common-text* (progress-pc-local-entry-label highscore-index) #f))
|
||||
(return (-> local-score-ptr local-index)))
|
||||
(inc! local-index)))
|
||||
(else
|
||||
(inc! times-enumerated)
|
||||
;; otherwise, use the external one
|
||||
(if return-next-value?
|
||||
(return (-> *progress-pc-generic-store* custom-highscore-score))
|
||||
(inc! external-index)))))
|
||||
(begin
|
||||
(return (-> *progress-pc-generic-store* custom-highscore-score)))
|
||||
(inc! external-index)))))
|
||||
;; case where we only have local times left
|
||||
((< local-index max-local-times)
|
||||
(inc! times-enumerated)
|
||||
(if return-next-value?
|
||||
(begin
|
||||
(clear *pc-cpp-temp-string*)
|
||||
(format *pc-cpp-temp-string* "~S~S" "~[~1L" (lookup-text! *common-text* (text-id progress-highscores-local-time) #f))
|
||||
(format *pc-cpp-temp-string* "~S~S" "~[~1L" (lookup-text! *common-text* (progress-pc-local-entry-label highscore-index) #f))
|
||||
(return (-> local-score-ptr local-index)))
|
||||
(inc! local-index)))
|
||||
;; case where we only have external times left
|
||||
((< external-index max-external-times)
|
||||
(progress-pc-get-external-time highscore-index external-index)
|
||||
(inc! times-enumerated)
|
||||
(if return-next-value?
|
||||
(return (-> *progress-pc-generic-store* custom-highscore-score))
|
||||
(inc! external-index)))))
|
||||
(inc! external-index))))
|
||||
(inc! times-enumerated))
|
||||
-1.0))
|
||||
|
||||
(defmethod draw-option ((this menu-highscores-option) (progress progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
@ -555,7 +547,7 @@
|
||||
;; so we merge them so you can see how you locally stack up against the competition
|
||||
(dotimes (row-index 8)
|
||||
(let* ((num-rows-already-printed (+ row-index (* (-> *progress-pc-generic-store* current-highscore-page-index) 8)))
|
||||
(score (progress-pc-get-next-external-score (-> this page-index) num-rows-already-printed)))
|
||||
(score (progress-pc-get-next-score (-> this page-index) num-rows-already-printed)))
|
||||
(set! (-> highscore-row place) row-index)
|
||||
(set! (-> highscore-row score) score)
|
||||
(when (> score 0)
|
||||
|
@ -964,13 +964,15 @@
|
||||
(set! (-> this slide-dir) 1.0)))
|
||||
((or (cpad-pressed? 0 down l-analog-down)
|
||||
(and (cpad-hold? 0 down l-analog-down) (>= (- (current-time) (-> this last-move)) (seconds 0.2))))
|
||||
(when (< (* (inc (-> *progress-pc-generic-store* current-highscore-page-index)) 8) (progress-pc-max-highscore-rows (-> this page-index)))
|
||||
(when (and (-> *pc-settings* speedrunner-mode?)
|
||||
(< (* (inc (-> *progress-pc-generic-store* current-highscore-page-index)) 8) (progress-pc-max-highscore-rows (-> this page-index))))
|
||||
(set! (-> this last-move) (current-time))
|
||||
(sound-play "secrets-scroll")
|
||||
(inc! (-> *progress-pc-generic-store* current-highscore-page-index))))
|
||||
((or (cpad-pressed? 0 up l-analog-up)
|
||||
(and (cpad-hold? 0 up l-analog-up) (>= (- (current-time) (-> this last-move)) (seconds 0.2))))
|
||||
(when (> (-> *progress-pc-generic-store* current-highscore-page-index) 0)
|
||||
(when (and (-> *pc-settings* speedrunner-mode?)
|
||||
(> (-> *progress-pc-generic-store* current-highscore-page-index) 0))
|
||||
(set! (-> this last-move) (current-time))
|
||||
(sound-play "secrets-scroll")
|
||||
(dec! (-> *progress-pc-generic-store* current-highscore-page-index))))
|
||||
|
Loading…
Reference in New Issue
Block a user