Speedrun fixes (jak 1 buzzer counts, jak 2 race intro autosplit) (#4103)

fixes https://github.com/open-goal/jak-project/issues/4021 for jak1

also fixes a small bug for jak2 where the speedrun menu wasn't properly
closed on resetting run, which would break the debug menu until you
toggled the speedrun menu again. Looks like Hatkid already caught and
fixed this in jak3

goes along with https://github.com/open-goal/speedrunning/pull/29
This commit is contained in:
Matt Dallmeyer
2025-12-27 19:55:01 -08:00
committed by GitHub
parent 04f1f93bec
commit dd21b5c942
4 changed files with 52 additions and 3 deletions
+40
View File
@@ -49,6 +49,16 @@
(game-task firecanyon-end)
(game-task firecanyon-buzzer)))
(define *hub1-buzzer-task-list*
(new 'static 'boxed-array :type game-task
(game-task training-buzzer)
(game-task village1-buzzer)
(game-task beach-buzzer)
(game-task jungle-buzzer)
(game-task misty-buzzer)
(game-task firecanyon-buzzer)
))
(define *hub2-cell-list*
(new 'static
'boxed-array
@@ -89,6 +99,15 @@
(game-task ogre-secret)
(game-task ogre-buzzer)))
(define *hub2-buzzer-task-list*
(new 'static 'boxed-array :type game-task
(game-task village2-buzzer)
(game-task sunken-buzzer)
(game-task swamp-buzzer)
(game-task rolling-buzzer)
(game-task ogre-buzzer)
))
(define *hub3-cell-list*
(new 'static
'boxed-array
@@ -232,6 +251,18 @@
(set! (-> *setting-control* default auto-save) #t)
(none))
(defun buzzer-task-collect-all ((buzz-task game-task))
(let* ((ctrl (get-task-control buzz-task))
(buzz-bits (get-reminder ctrl 0)))
(dotimes (buzz-index (the int (-> *FACT-bank* buzzer-max-default)))
;; increment total if we haven't collected it before
(if (not (logtest? buzz-bits (ash 1 buzz-index))) (+! (-> *game-info* buzzer-total) 1.0))
;; set the updated bits
(set! buzz-bits (logior buzz-bits (ash 1 buzz-index)))
(save-reminder ctrl buzz-bits 0)))
(none)
)
(defun setup-speedrun-post-blackout ()
(when (and (-> *speedrun-info* needs-post-blackout-setup?)
(>= (-> *display* base-frame-counter) (-> *game-info* blackout-time)))
@@ -350,6 +381,9 @@
;; give all orbs from hub1
(set! (-> *game-info* money-total) 600.0) ;; 50+50+150+150+150+50
(set! (-> *game-info* money) 180.0) ;; 50+50+150+150+150+50 - (90+90+120+120)
;; give all flies from hub1 (updates both buzzer-total and task reminder bitmasks)
(dotimes (idx (length *hub1-buzzer-task-list*))
(buzzer-task-collect-all (-> *hub1-buzzer-task-list* idx)))
)
(((speedrun-category hub3-100))
;; skip intro cutscene
@@ -365,6 +399,12 @@
;; give all orbs from hub1+2
(set! (-> *game-info* money-total) 1300.0) ;; 50+50+150+150+150+50 + 50+200+200+200+50
(set! (-> *game-info* money) 370.0) ;; 50+50+150+150+150+50 - (90+90+120+120) + 50+200+200+200+50 - (90+90+90+120+120)
;; give all flies from hub1 (updates both buzzer-total and task reminder bitmasks)
(dotimes (idx (length *hub1-buzzer-task-list*))
(buzzer-task-collect-all (-> *hub1-buzzer-task-list* idx)))
;; give all flies from hub2 (updates both buzzer-total and task reminder bitmasks)
(dotimes (idx (length *hub2-buzzer-task-list*))
(buzzer-task-collect-all (-> *hub2-buzzer-task-list* idx)))
)
(((speedrun-category all-cutscenes))
;; no post-blackout actions needed
+4 -1
View File
@@ -80,7 +80,7 @@
(res-forest-protect uint8)
(res-drill-mech uint8)
(res-city-save-lurkers uint8)
(res-stadium-race-class uint8)
(res-stadium-race-class1 uint8)
(res-palace-sneak-in uint8)
(res-castle-break-in uint8)
(res-castle-boss uint8)
@@ -133,6 +133,9 @@
(sewer-escort-get-gun uint8) ;; get peacemaker
(forest-protect-introduction uint8) ;; talk to onin (protect samos)
(forest-protect-meeting uint8) ;; talk to samos (protect samos)
(int-stadium-race-class3 uint8) ;; talk to keira (class 3)
(int-stadium-race-class2 uint8) ;; talk to keira (class 2)
(int-stadium-race-class1 uint8) ;; talk to keira (class 1)
;; TODO - orbs in level X
;; end marker just to make things look nice in a memory view
+4 -1
View File
@@ -102,7 +102,7 @@
(autosplit-flag-task-complete! res-forest-protect forest-protect)
(autosplit-flag-task-complete! res-drill-mech drill-mech)
(autosplit-flag-task-complete! res-city-save-lurkers city-save-lurkers)
(autosplit-flag-task-complete! res-stadium-race-class stadium-race-class)
(autosplit-flag-task-complete! res-stadium-race-class1 stadium-race-class)
(autosplit-flag-task-complete! res-palace-sneak-in palace-sneak-in)
(autosplit-flag-task-complete! res-castle-break-in castle-break-in)
(autosplit-flag-task-complete! res-castle-boss castle-boss)
@@ -155,6 +155,9 @@
(autosplit-flag-task-node-closed! sewer-escort-get-gun sewer-escort-get-gun) ;; get peacemaker
(autosplit-flag-task-node-closed! forest-protect-introduction forest-protect-introduction) ;; talk to onin (protect samos)
(autosplit-flag-task-node-closed! forest-protect-meeting forest-protect-meeting) ;; talk to samos (protect samos)
(autosplit-flag-task-node-closed! int-stadium-race-class3 stadium-race-class3-introduction) ;; talk to keira (class 3)
(autosplit-flag-task-node-closed! int-stadium-race-class2 stadium-race-class2-introduction) ;; talk to keira (class 2)
(autosplit-flag-task-node-closed! int-stadium-race-class1 stadium-race-class1-introduction) ;; talk to keira (class 1)
;; debug only, draw stuff to the screen so i don't have to stare at a memory editor
;; (debug-draw this)
+4 -1
View File
@@ -253,7 +253,10 @@
(define *speedrun-popup-menu-entries*
(new 'static 'boxed-array :type popup-menu-entry
(new 'static 'popup-menu-button :label "Reset"
:on-confirm (lambda () (send-event (ppointer->process *speedrun-manager*) 'invoke (speedrun-menu-command reset))))
:on-confirm
(lambda ()
(send-event (ppointer->process *speedrun-manager*) 'invoke (speedrun-menu-command reset))
(send-event (ppointer->process (-> *speedrun-manager* 0 popup-menu)) 'close-menu)))
(new 'static 'popup-menu-submenu :label "Built-in category select"
:entries (new 'static 'boxed-array :type popup-menu-entry
(new 'static 'popup-menu-flag :label "Normal"