From c37304c2dd4d13e30d9f175be51bba05edfc4f9d Mon Sep 17 00:00:00 2001 From: Matt Dallmeyer Date: Thu, 2 Apr 2026 18:15:32 -0700 Subject: [PATCH] [jak3] Fix arena token not respawning bug (#4150) a bit of a hack but I'm not sure what else to do besides completely unload/reload wasstadb-obs. open to suggestions here is the bug https://youtu.be/C1KZlRFbjys?t=50 --- goal_src/jak3/levels/wascity/wasstadium/wasstadb-obs.gc | 9 +++++++++ goal_src/jak3/pc/features/speedruns.gc | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/goal_src/jak3/levels/wascity/wasstadium/wasstadb-obs.gc b/goal_src/jak3/levels/wascity/wasstadium/wasstadb-obs.gc index a6f5e355ac..cbf06402de 100644 --- a/goal_src/jak3/levels/wascity/wasstadium/wasstadb-obs.gc +++ b/goal_src/jak3/levels/wascity/wasstadium/wasstadb-obs.gc @@ -742,6 +742,15 @@ (define *arena-trainer-checkpoint-tokens* (new 'static 'array uint64 2 #xffffffffffffffff #x0)) +;; og:preserve-this helper to reset these globals in between speedruns, otherwise new game can skip straight past tokens +(defun reset-arena-trainer-globals () + (set! *arena-trainer-checkpoint-valid* (the-as object #f)) + (set! *arena-trainer-checkpoint-time* 0.0) + (set! (-> *arena-trainer-checkpoint-tokens* 0) #xffffffffffffffff) + (set! (-> *arena-trainer-checkpoint-tokens* 1) #x0) + (none) + ) + (deftype task-manager-arena-training (task-manager) ((judge-h handle) (arrow-h handle) diff --git a/goal_src/jak3/pc/features/speedruns.gc b/goal_src/jak3/pc/features/speedruns.gc index 62c10f63cb..8be2eb0824 100644 --- a/goal_src/jak3/pc/features/speedruns.gc +++ b/goal_src/jak3/pc/features/speedruns.gc @@ -142,6 +142,7 @@ lighteco darkeco)) +(define-extern reset-arena-trainer-globals (function none)) (defmethod start-run! ((this speedrun-info)) ;; turn on speedrun verification display (true! (-> this display-run-info?)) @@ -150,6 +151,9 @@ (send-event (ppointer->process *speedrun-manager*) 'start-run) ;; ensure any required settings are enabled (enforce-settings! this) + ;; make sure silly arena-trainer globals are reset if we're resetting from arena + (when (process-by-name "arena-training-1-collect" *entity-pool*) + (reset-arena-trainer-globals)) ;; finalize any category specific setup code (case (-> this category) (((speedrun-category newgame-normal))