From 97c12ebaf408ee389b35f612e09951bd5d3b0eac Mon Sep 17 00:00:00 2001 From: ZedB0T <89345505+Zedb0T@users.noreply.github.com> Date: Wed, 7 Sep 2022 18:18:37 -0400 Subject: [PATCH] [speedrun] Show speedrun information at start of run (#1848) This shows the current settings needed to help provide information when verifying a run, also it removes the two calls to show the version in main.gc and instead does it within the speedrun/auto splitting scope. - Shows Version - Shows if Speedrunner mode is on (technically pointless since the text only displays when it is enabled this more just serves to show that there IS a speedrunner mode to viewers and stuff (josh) So hopefully it may cut down on submissions with the mode off) - Shows if cutscene skips is enabled/disabled. Tested on 16x9 4x3 the really weird one and borderless/fullscreen [![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/qDC-beEg5Es/0.jpg)](https://www.youtube.com/watch?v=qDC-beEg5Es) Co-authored-by: Tyler Wilding --- goal_src/jak1/engine/game/main.gc | 10 +++------- goal_src/jak1/pc/features/speedruns-h.gc | 3 +++ goal_src/jak1/pc/features/speedruns.gc | 22 ++++++++++++++++++++++ goal_src/jak1/pc/pckernel.gc | 4 ++-- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/goal_src/jak1/engine/game/main.gc b/goal_src/jak1/engine/game/main.gc index 7fc0c5395..c136e6964 100644 --- a/goal_src/jak1/engine/game/main.gc +++ b/goal_src/jak1/engine/game/main.gc @@ -695,13 +695,9 @@ (with-profiler "menu" (with-pc - (cond ((and (= (-> *pc-settings* speedrunner-mode?) #t) - (< (-> *autosplit-info-jak1* num-power-cells) 1)) - ;; display the revision before you collect your first powercell - (draw-build-revision)) - ((and (-> *pc-settings* display-sha) *debug-segment*) - ;; otherwise, only draw if we are in debug mode and the setting isn't enabled - (draw-build-revision)))) + (if + (and (-> *pc-settings* display-sha) *debug-segment*) + (draw-build-revision))) (*menu-hook*) (add-ee-profile-frame 'draw :g #x40) diff --git a/goal_src/jak1/pc/features/speedruns-h.gc b/goal_src/jak1/pc/features/speedruns-h.gc index 2464a66fc..15c9bc1c4 100644 --- a/goal_src/jak1/pc/features/speedruns-h.gc +++ b/goal_src/jak1/pc/features/speedruns-h.gc @@ -1,4 +1,7 @@ ;;-*-Lisp-*- (in-package goal) +(define-extern speedrun-mode-update (function none)) (define-extern speedrun-start-run (function none)) +(define-extern speedrun-draw-settings (function none)) + diff --git a/goal_src/jak1/pc/features/speedruns.gc b/goal_src/jak1/pc/features/speedruns.gc index eadc894be..902aad3dd 100644 --- a/goal_src/jak1/pc/features/speedruns.gc +++ b/goal_src/jak1/pc/features/speedruns.gc @@ -1,6 +1,15 @@ ;;-*-Lisp-*- (in-package goal) +(defun speedrun-mode-update () + "A per frame update for speedrunning related stuff" + (when (-> *pc-settings* speedrunner-mode?) + ;; Update auto-splitter + (update-autosplit-info-jak1) + ;; Draw info to the screen + (speedrun-draw-settings)) + (none)) + (defun speedrun-start-run () ;; randomize game id so the autosplitter knows to restart (update-autosplit-jak1-new-game) @@ -17,3 +26,16 @@ ;; enable auto saving by default (set! (-> *setting-control* default auto-save) #t) (none)) + +(defun speedrun-draw-settings () + "Draw speedrun related settings in the bottom left corner" + (when (and (-> *pc-settings* speedrunner-mode?) + (< (-> *autosplit-info-jak1* num-power-cells) 1)) + (with-dma-buffer-add-bucket ((buf (-> (current-frame) global-buf)) + (bucket-id debug-no-zbuf)) + (draw-string-xy (string-format "OpenGOAL Version: ~S ~%Speedrun mode: ~A ~%Cutscene Skips ~A" + *pc-settings-built-sha* + (-> *pc-settings* speedrunner-mode?) + (-> *pc-settings* cutscene-skips?)) + buf 0 (- 224 (* 8 4)) (font-color flat-yellow) (font-flags shadow kerning)))) + (none)) diff --git a/goal_src/jak1/pc/pckernel.gc b/goal_src/jak1/pc/pckernel.gc index 0b2240fe4..3f0d5104a 100644 --- a/goal_src/jak1/pc/pckernel.gc +++ b/goal_src/jak1/pc/pckernel.gc @@ -327,8 +327,8 @@ ;; update auto-splitter info (when (-> *pc-settings* speedrunner-mode?) - (with-profiler "autosplit-update-jak1" - (update-autosplit-info-jak1))) + (with-profiler "speedrun-update-jak1" + (speedrun-mode-update))) (when (not (-> obj use-vis?)) (set! (-> *video-parms* relative-x-scale) (-> obj aspect-ratio-reciprocal))