Skip to content

Commit

Permalink
g/j2: Fix subtitle setting persisting and add a toggle for the hint s…
Browse files Browse the repository at this point in the history
…ubtitles (#3689)

Fixes #3663
  • Loading branch information
xTVaser authored Oct 1, 2024
1 parent 5b8bb8f commit 66c4552
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions decompiler/config/jak2/all-types.gc
Original file line number Diff line number Diff line change
Expand Up @@ -8818,6 +8818,7 @@ Unlike [[engine]], users can use [[engine-pers]] as a parent class."
(progress-graphics-msaa-off #x1338)
(progress-graphics-display #x1339)
(language-name-finnish #x133a)
(progress-hint-subtitles #x133b)
)
;; ---text-id-h:text-id

Expand Down
3 changes: 2 additions & 1 deletion game/assets/jak2/text/game_custom_text_en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,6 @@
"1337": "PS2 LOD Distance",
"1338": "Off",
"1339": "Display",
"133a": "<FLAG_FINLAND> Suomi"
"133a": "<FLAG_FINLAND> Suomi",
"133b": "Hint Subtitles"
}
1 change: 1 addition & 0 deletions goal_src/jak2/engine/ui/text-id-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@
(progress-graphics-msaa-off #x1338)
(progress-graphics-display #x1339)
(language-name-finnish #x133a)
(progress-hint-subtitles #x133b)
)
;; ---text-id

Expand Down
2 changes: 2 additions & 0 deletions goal_src/jak2/pc/pckernel-impl.gc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
(controller-led-status? symbol)
(speedrunner-mode-custom-bind uint32)
(memcard-subtitles? symbol)
(hint-subtitles? symbol)

(text-language pc-language) ;; language for game text
)
Expand Down Expand Up @@ -168,6 +169,7 @@
(set! (-> obj memcard-volume-dialog) 0.75)
(set! (-> obj memcard-vibration?) #t)
(set! (-> obj memcard-subtitles?) #f)
(set! (-> obj hint-subtitles?) #t)
0)

(defmethod reset-extra ((obj pc-settings-jak2) (call-handlers symbol))
Expand Down
3 changes: 3 additions & 0 deletions goal_src/jak2/pc/pckernel.gc
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@
(set! (-> *setting-control* user-default music-volume) (-> obj memcard-volume-music))
(set! (-> *setting-control* user-default dialog-volume) (-> obj memcard-volume-dialog))
(set! (-> *setting-control* user-default vibration) (-> obj memcard-vibration?))
(set! (-> *setting-control* user-default subtitle) (-> obj memcard-subtitles?))
obj)

(defmethod set-game-setting! ((obj pc-settings-jak2) (setting symbol) (value symbol))
Expand Down Expand Up @@ -767,6 +768,7 @@
(("cheats-unlocked") (set! (-> obj cheats-unlocked) (the-as pc-cheats (file-stream-read-int file))))
(("cheats-backup") (file-stream-read-int file)) ;; TODO - Don't remove this, parsing code can't handle unexpected keys
(("memcard-subtitles?") (set! (-> obj memcard-subtitles?) (file-stream-read-symbol file)))
(("hint-subtitles?") (set! (-> obj hint-subtitles?) (file-stream-read-symbol file)))
(("music-unlocked")
(dotimes (i (/ (align64 (-> obj music-unlocked length)) 64))
(bit-array<-int64 (-> obj music-unlocked) (* i 64) (file-stream-read-int file))
Expand Down Expand Up @@ -819,6 +821,7 @@
(format file " (cheats-purchased #x~x)~%" (-> obj cheats-purchased))
(format file " (cheats-unlocked #x~x)~%" (-> obj cheats-unlocked))
(format file " (memcard-subtitles? ~A)~%" (-> obj memcard-subtitles?))
(format file " (hint-subtitles? ~A)~%" (-> obj hint-subtitles?))

(format file " (music-unlocked")
(dotimes (i (/ (align64 (-> obj music-unlocked length)) 64))
Expand Down
13 changes: 13 additions & 0 deletions goal_src/jak2/pc/progress/progress-static-pc.gc
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,17 @@ This gives us more freedom to write code how we want.
(pc-settings-save)
(set! (-> *setting-control* user-default subtitle) val))))

(defmacro game-options-pc-hint-subtitle-toggle ()
`(new 'static 'menu-generic-boolean-option
:name (text-id progress-hint-subtitles)
:truthy-text (text-id progress-on)
:falsey-text (text-id progress-off)
:get-value-fn (lambda () (-> *pc-settings* hint-subtitles?))
:should-disable? (lambda () (not (-> *pc-settings* memcard-subtitles?)))
:on-confirm (lambda ((val symbol))
(set! (-> *pc-settings* hint-subtitles?) val)
(pc-settings-save))))

(defmacro game-options-pc-subtitle-language ()
`(new 'static 'menu-generic-carousel-option
:name (text-id progress-sound-subtitle-language)
Expand Down Expand Up @@ -454,6 +465,7 @@ This gives us more freedom to write code how we want.
(progress-new-generic-scrolling-page (text-id progress-root-game-options)
(game-options-pc-input-options)
(game-options-pc-subtitle-toggle)
(game-options-pc-hint-subtitle-toggle)
(game-options-pc-subtitle-language)
(game-options-pc-sound-language)
(game-options-pc-text-language)
Expand All @@ -466,6 +478,7 @@ This gives us more freedom to write code how we want.
(progress-new-generic-scrolling-page (text-id progress-root-game-options)
(game-options-pc-input-options)
(game-options-pc-subtitle-toggle)
(game-options-pc-hint-subtitle-toggle)
(game-options-pc-subtitle-language)
(game-options-pc-sound-language)
(game-options-pc-text-language)
Expand Down
4 changes: 3 additions & 1 deletion goal_src/jak2/pc/subtitle2.gc
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,9 @@
(set! (-> self font origin y) cur-y)

;; check if we should actually draw subtitles and do it
(when (and (-> *setting-control* user-current subtitle) (or *gui-kick-str* (= *master-mode* 'game)))
(when (and (-> *setting-control* user-current subtitle)
(or (-> self movie-mode?) (-> *pc-settings* hint-subtitles?))
(or *gui-kick-str* (= *master-mode* 'game)))
(set-action! *gui-control* (gui-action play) (-> self gui-id)
(gui-channel none) (gui-action none) (the-as string #f) (the-as (function gui-connection symbol) #f) (the-as process #f))

Expand Down

0 comments on commit 66c4552

Please sign in to comment.