mirror of
https://github.com/open-goal/jak-project
synced 2026-08-07 10:16:45 -04:00
dd21b5c942
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
184 lines
12 KiB
Common Lisp
184 lines
12 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
(define *autosplit-info-jak2* (new 'static 'autosplit-info))
|
|
(pc-init-autosplitter-struct)
|
|
;; Setup Version
|
|
(set! (-> *autosplit-info-jak2* version-major) 0)
|
|
(set! (-> *autosplit-info-jak2* version-minor) 1)
|
|
;; Setup markers
|
|
(charp<-string (-> *autosplit-info-jak2* end-marker) "end")
|
|
;; Setup Padding
|
|
(charp<-string (-> *autosplit-info-jak2* padding-stats) "padding-stats!")
|
|
(charp<-string (-> *autosplit-info-jak2* padding-controls) "padding-controls!")
|
|
|
|
(defmacro autosplit-flag-task-complete! (field-name task-name)
|
|
"Given a field name in the autosplitter struct, and a [[game-task]] name to check, sets either a 0 or a 1"
|
|
`(begin
|
|
(if (!= (-> this ,field-name) (if (task-complete? *game-info* (game-task ,task-name)) 1 0))
|
|
(format 0 "AUTOSPLIT for ~A~%" (quote ,task-name)))
|
|
(set! (-> this ,field-name) (if (task-complete? *game-info* (game-task ,task-name)) 1 0))))
|
|
|
|
(defmacro autosplit-flag-task-node-closed! (field-name task-node-name)
|
|
"Given a field name in the autosplitter struct, and a [[game-task-node]] name to check, sets either a 0 or a 1"
|
|
`(begin
|
|
(if (!= (-> this ,field-name) (if (task-node-closed? (game-task-node ,task-node-name)) 1 0))
|
|
(format 0 "AUTOSPLIT for ~A~%" (quote ,task-node-name)))
|
|
(set! (-> this ,field-name) (if (task-node-closed? (game-task-node ,task-node-name)) 1 0))))
|
|
|
|
(defmethod update! ((this autosplit-info))
|
|
;; general statistics
|
|
;; when we are blacked out in loads the value of these are temporarily 0, and that messes with the auto splitter.
|
|
(let ((in-blackout? (>= (-> *game-info* blackout-time) (current-time))))
|
|
(when (not in-blackout?)
|
|
(set! (-> this num-orbs) (the int (-> *game-info* skill-total)))
|
|
(set! (-> this num-skullgems) (the int (-> *game-info* gem-total)))
|
|
;; ending conditions
|
|
;; all collectables
|
|
;; - check for all orbs (which require all missions conveniently)
|
|
;; - also check for all darkjak powers
|
|
(set! (-> this all-collectables-acquired?)
|
|
(if (and (logtest? (-> *game-info* features) (game-feature darkjak-giant))
|
|
(>= (-> this num-orbs) 286))
|
|
1 0)))
|
|
)
|
|
;; loading/cutscene related flags
|
|
(set! (-> this in-cutscene?) (if (movie?) 1 0))
|
|
;; need resolution flags
|
|
(autosplit-flag-task-complete! res-fortress-escape fortress-escape)
|
|
(autosplit-flag-task-complete! res-city-help-kid city-help-kid)
|
|
(autosplit-flag-task-complete! res-city-vehicle-training city-vehicle-training)
|
|
(autosplit-flag-task-complete! res-ruins-tower ruins-tower)
|
|
(autosplit-flag-task-complete! res-atoll-water atoll-water)
|
|
(autosplit-flag-task-complete! res-fortress-dump fortress-dump)
|
|
(autosplit-flag-task-complete! res-city-krew-delivery city-krew-delivery)
|
|
(autosplit-flag-task-complete! res-city-red-gun-training city-red-gun-training)
|
|
(autosplit-flag-task-complete! res-atoll-sig atoll-sig)
|
|
(autosplit-flag-task-complete! res-sewer-enemy sewer-enemy)
|
|
(autosplit-flag-task-complete! res-strip-rescue strip-rescue)
|
|
(autosplit-flag-task-complete! res-atoll-battle atoll-battle)
|
|
(autosplit-flag-task-complete! res-mountain-lens mountain-lens)
|
|
(autosplit-flag-task-complete! res-mountain-gear mountain-gear)
|
|
(autosplit-flag-task-complete! res-mountain-shard mountain-shard)
|
|
(autosplit-flag-task-complete! res-mountain-collection mountain-collection)
|
|
(autosplit-flag-task-complete! res-city-keira-delivery city-keira-delivery)
|
|
(autosplit-flag-task-complete! res-stadium-board1 stadium-board1)
|
|
(autosplit-flag-task-complete! res-city-krew-collection city-krew-collection)
|
|
(autosplit-flag-task-complete! res-city-yellow-gun-training city-yellow-gun-training)
|
|
(autosplit-flag-task-complete! res-drill-eggs drill-eggs)
|
|
(autosplit-flag-task-complete! res-city-power city-power)
|
|
(autosplit-flag-task-complete! res-palace-cable palace-cable)
|
|
(autosplit-flag-task-complete! res-palace-boss palace-boss)
|
|
(autosplit-flag-task-complete! res-city-shuttle city-shuttle)
|
|
(autosplit-flag-task-complete! res-ruins-enemy ruins-enemy)
|
|
(autosplit-flag-task-complete! res-city-blue-gun-training city-blue-gun-training)
|
|
(autosplit-flag-task-complete! res-forest-scouts forest-scouts)
|
|
(autosplit-flag-task-complete! res-city-escort-kid city-escort-kid)
|
|
(autosplit-flag-task-complete! res-dig-knock-down dig-knock-down)
|
|
(autosplit-flag-task-complete! res-strip-grenade strip-grenade)
|
|
(autosplit-flag-task-complete! res-drill-ship drill-ship)
|
|
(autosplit-flag-task-complete! res-city-port-run city-port-run)
|
|
(autosplit-flag-task-complete! res-city-meet-brutter city-meet-brutter)
|
|
(autosplit-flag-task-complete! res-sewer-board sewer-board)
|
|
(autosplit-flag-task-complete! res-forest-hunt forest-hunt)
|
|
(autosplit-flag-task-complete! res-city-intercept-tanker city-intercept-tanker)
|
|
(autosplit-flag-task-complete! res-stadium-race-class3 stadium-race-class3)
|
|
(autosplit-flag-task-complete! res-city-protect-water-slums city-protect-water-slums)
|
|
(autosplit-flag-task-complete! res-dig-find-totem dig-find-totem)
|
|
(autosplit-flag-task-complete! res-city-destroy-guard-vehicles city-destroy-guard-vehicles)
|
|
(autosplit-flag-task-complete! res-city-play-onin-game city-play-onin-game)
|
|
(autosplit-flag-task-complete! res-canyon-insert-items canyon-insert-items)
|
|
(autosplit-flag-task-complete! res-tomb-poles tomb-poles)
|
|
(autosplit-flag-task-complete! res-tomb-water tomb-water)
|
|
(autosplit-flag-task-complete! res-tomb-boss tomb-boss)
|
|
(autosplit-flag-task-complete! res-fortress-save-friends fortress-save-friends)
|
|
(autosplit-flag-task-complete! res-sewer-escort sewer-escort)
|
|
(autosplit-flag-task-complete! res-city-dark-gun-training city-dark-gun-training)
|
|
(autosplit-flag-task-complete! res-stadium-race-class2 stadium-race-class2)
|
|
(autosplit-flag-task-complete! res-city-stop-bomb-bots city-stop-bomb-bots)
|
|
(autosplit-flag-task-complete! res-city-errol-challenge city-errol-challenge)
|
|
(autosplit-flag-task-complete! res-strip-drop strip-drop)
|
|
(autosplit-flag-task-complete! res-ruins-mech ruins-mech)
|
|
(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-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)
|
|
(autosplit-flag-task-complete! res-city-whack city-whack)
|
|
(autosplit-flag-task-complete! res-under-mech under-mech)
|
|
(autosplit-flag-task-complete! res-under-sig under-sig)
|
|
(autosplit-flag-task-complete! res-city-defend-stadium city-defend-stadium)
|
|
(autosplit-flag-task-complete! res-consite-find-baron consite-find-baron)
|
|
(autosplit-flag-task-complete! res-nest-get-to-gun nest-get-to-gun)
|
|
(autosplit-flag-task-complete! res-nest-enter nest-enter)
|
|
(autosplit-flag-task-complete! res-nest-boss nest-boss)
|
|
(autosplit-flag-task-complete! res-city-win city-win)
|
|
(autosplit-flag-task-complete! res-city-oracle city-oracle)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-ring-1 city-burning-bush-ring-1)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-1 city-burning-bush-get-to-1)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-2 city-burning-bush-get-to-2)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-3 city-burning-bush-get-to-3)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-4 city-burning-bush-get-to-4)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-collection-1 city-burning-bush-collection-1)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-racepoint-1 city-burning-bush-racepoint-1)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-ring-2 city-burning-bush-ring-2)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-5 city-burning-bush-get-to-5)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-6 city-burning-bush-get-to-6)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-shuttle-1 city-burning-bush-shuttle-1)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-7 city-burning-bush-get-to-7)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-8 city-burning-bush-get-to-8)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-9 city-burning-bush-get-to-9)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-collection-2 city-burning-bush-collection-2)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-10 city-burning-bush-get-to-10)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-11 city-burning-bush-get-to-11)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-ring-3 city-burning-bush-ring-3)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-12 city-burning-bush-get-to-12)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-bombbot-1 city-burning-bush-bombbot-1)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-13 city-burning-bush-get-to-13)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-14 city-burning-bush-get-to-14)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-get-to-15 city-burning-bush-get-to-15)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-collection-3 city-burning-bush-collection-3)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-race-errol city-burning-bush-race-errol)
|
|
(autosplit-flag-task-complete! res-city-burning-bush-race-port city-burning-bush-race-port)
|
|
(autosplit-flag-task-complete! res-stadium-burning-bush-race-board stadium-burning-bush-race-board)
|
|
(autosplit-flag-task-complete! res-stadium-burning-bush-race-class3 stadium-burning-bush-race-class3)
|
|
(autosplit-flag-task-complete! res-stadium-burning-bush-race-class2 stadium-burning-bush-race-class2)
|
|
(autosplit-flag-task-complete! res-stadium-burning-bush-race-class1 stadium-burning-bush-race-class1)
|
|
(autosplit-flag-task-complete! res-stadium-burning-bush-race-class3-r stadium-burning-bush-race-class3-r)
|
|
(autosplit-flag-task-complete! res-stadium-burning-bush-race-class2-r stadium-burning-bush-race-class2-r)
|
|
(autosplit-flag-task-complete! res-stadium-burning-bush-race-class1-r stadium-burning-bush-race-class1-r)
|
|
;; misc other tasks
|
|
(autosplit-flag-task-node-closed! tomb-poles-poles tomb-poles-poles) ;; left tomb/daxter boulder start
|
|
(autosplit-flag-task-node-closed! fortress-save-friends-introduction fortress-save-friends-introduction) ;; talk to torn (before rescue friends)
|
|
(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)
|
|
(none))
|
|
|
|
|
|
(defmethod reset! ((this autosplit-info))
|
|
(set! (-> this game-hash) (pc-get-unix-timestamp))
|
|
(set! (-> this kor-dead?) 0)
|
|
(none))
|
|
|
|
(defmethod debug-draw ((this autosplit-info))
|
|
(clear *temp-string*)
|
|
(format *temp-string* "kor-dead?: ~D~%" (-> this kor-dead?))
|
|
(format *temp-string* "all-collectables-acquired?: ~D~%" (-> this all-collectables-acquired?))
|
|
(with-dma-buffer-add-bucket ((buf (-> (current-frame) global-buf)) (bucket-id debug-no-zbuf1))
|
|
;; reset bucket settings prior to drawing - font won't do this for us, and
|
|
;; draw-raw-image can sometimes mess them up. (intro sequence)
|
|
(dma-buffer-add-gs-set-flusha buf (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)) (tex1-1 (new 'static 'gs-tex1 :mmag #x1 :mmin #x1)))
|
|
(let ((font-ctx (new 'stack 'font-context *font-default-matrix* 10 50 0.0 (font-color default) (font-flags shadow kerning large))))
|
|
(set! (-> font-ctx scale) 0.325)
|
|
(draw-string-adv *temp-string* buf font-ctx)))
|
|
(none))
|