jak-project/goal_src/jak2/engine/ui/gui-h.gc
ManDude 18ddd1613c
Jak 2 pc subtitle support (#2672)
Adds support for adding custom subtitles to Jak 2 audio. Comes with a
new editor for the new system and format. Compared to the Jak 1 system,
this is much simpler to make an editor for.

Comes with a few subtitles already made as an example.
Cutscenes are not officially supported but you can technically subtitle
those with editor, so please don't right now.

This new system supports multiple subtitles playing at once (even from a
single source!) and will smartly push the subtitles up if there's a
message already playing:

![image](https://github.com/open-goal/jak-project/assets/7569514/033e6374-a05a-4c31-b029-51868153a932)

![image](https://github.com/open-goal/jak-project/assets/7569514/5298aa6d-a183-446e-bdb6-61c4682df917)

Unlike in Jak 1, it will not hide the bottom HUD when subtitles are
active:

![image](https://github.com/open-goal/jak-project/assets/7569514/d466bfc0-55d0-4689-a6e1-b7784b9fff59)

Sadly this leaves us with not much space for the subtitle region (and
the subtitles are shrunk when the minimap is enabled) but when you have
guards and citizens talking all the time, hiding the HUD every time
anyone spoke would get really frustrating.

The subtitle speaker is also color-coded now, because I thought that
would be fun to do.

TODO:
- [x] proper cutscene support.
- [x] merge mode for cutscenes so we don't have to rewrite the script?

---------

Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
2023-06-08 01:04:16 +01:00

155 lines
4.2 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: gui-h.gc
;; name in dgo: gui-h
;; dgos: ENGINE, GAME
(defenum gui-action
:type uint8
:bitfield #f
(none 0)
(queue 1)
(play 2)
(playing 3)
(stop 4)
(stopping 5)
(abort 6)
(hide 7)
(hidden 8)
(fade 9)
)
(defenum gui-channel
:type uint8
:bitfield #f
(none 0)
(art-load 16)
(art-load-next 17)
(background 18)
(jak 19)
(daxter 20)
(sig 21)
(ashelin 22)
(mog 23)
(jinx 24)
(grim 25)
(kid 26)
(kor 27)
(hal 28)
(voicebox 29)
(guard 30)
(crocadog 31)
(alert 32)
(citizen 33)
(bbush 34)
(krew 35)
(voice 47)
(movie 64)
(blackout 65)
(query 66)
(message 67)
(notice 68)
(subtitle 69)
(supertitle 70)
(notice-low 71)
(subtitle-pc 78) ;; custom
(screen 79)
(hud-upper-right 80)
(hud-upper-left 81)
(hud-lower-right 82)
(hud-lower-left 83)
(hud-lower-left-1 84)
(hud-lower-left-2 85)
(hud-center-right 86)
(hud-center-left 87)
(hud-middle-right 88)
(hud-middle-left 89)
(hud-upper-center 90)
(hud-upper-center-2 91)
(hud 95)
(max 96)
)
(defenum gui-connection-flags
:type uint8
:bitfield #t
(gcf0 0)
(gcf1 1)
(fo-curve 2)
(fo-min 3)
(fo-max 4)
)
(defenum gui-status
:type uint8 ;; not sure
:bitfield #f
(unknown 0)
(pending 1)
(ready 2)
(active 3)
(hide 4)
(stop 5)
)
(declare-type gui-control basic)
(define-extern *gui-control* gui-control)
;; DECOMP BEGINS
(deftype gui-connection (connection)
((priority float :offset 16)
(action gui-action :offset 20)
(channel gui-channel :offset 21)
(anim-part uint8 :offset 22)
(flags gui-connection-flags :offset 23)
(name string :offset 24)
(id sound-id :offset 28)
(handle handle :offset 0)
(time-stamp time-frame :offset 8)
(hold-time time-frame :offset-assert 32)
(fo-min int16 :offset-assert 40)
(fo-max int16 :offset-assert 42)
(fo-curve int8 :offset-assert 44)
(fade uint8 :offset-assert 45)
(pad uint8 2 :offset-assert 46)
)
:method-count-assert 14
:size-assert #x30
:flag-assert #xe00000030
)
(deftype gui-control (basic)
((engine engine :offset-assert 4)
(update-time time-frame :offset-assert 8)
(connections gui-connection 32 :inline :offset-assert 16)
(spool-connections gui-connection 4 :inline :offset-assert 1552)
(ids sound-id 96 :offset-assert 1744)
(times time-frame 96 :offset-assert 2128)
(cmd pair 96 :offset-assert 2896)
)
:method-count-assert 25
:size-assert #xcd0
:flag-assert #x1900000cd0
(:methods
(new (symbol type int) _type_ 0)
(add-process (_type_ process gui-channel gui-action string float time-frame) sound-id 9)
(remove-process (_type_ process gui-channel) none 10)
(stop-str (_type_ gui-connection) int 11)
(gui-control-method-12 (_type_ process gui-channel gui-action string int float sound-id) sound-id 12)
(update (_type_ symbol) int 13)
(lookup-gui-connection-id (_type_ string gui-channel gui-action) sound-id 14)
(lookup-gui-connection (_type_ process gui-channel string sound-id) gui-connection 15)
(set-action! (_type_ gui-action sound-id gui-channel gui-action string (function gui-connection symbol) process) int 16)
(get-status (_type_ sound-id) gui-status 17)
(gui-control-method-18 (_type_ gui-channel) symbol 18)
(handle-command-list (_type_ gui-channel gui-connection) symbol 19)
(set-falloff! (_type_ sound-id symbol int int int) gui-connection 20)
(gui-control-method-21 (_type_ gui-connection vector) int 21)
(gui-control-method-22 (_type_ gui-connection process symbol) none 22)
(handle-command (_type_ gui-channel gui-channel symbol gui-connection) symbol 23)
(channel-id-set! (_type_ gui-connection sound-id) int 24)
)
)