fix some jak 1 hint subtitles not showing up (#2782)

There is one instance of the same hint being played for different IDs
which was breaking things.
This commit is contained in:
ManDude 2023-06-28 14:13:47 +01:00 committed by GitHub
parent 1351cb6c9c
commit b3e3f9379e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 16 deletions

View file

@ -523,7 +523,7 @@ void parse_subtitle_json(GameSubtitleDB& db, const GameSubtitleDefinitionFile& f
}
// Now hints
for (const auto& [hint_name, hint_info] : meta_file.hints) {
GameSubtitleSceneInfo scene(SubtitleSceneKind::Hint);
GameSubtitleSceneInfo scene(SubtitleSceneKind::HintNamed);
scene.set_name(hint_name);
/*scene.m_sorting_group = db.m_subtitle_groups->find_group(hint_name);
scene.m_sorting_group_idx = db.m_subtitle_groups->find_group_index(scene.m_sorting_group);*/

View file

@ -152,7 +152,7 @@ class GameSubtitleSceneInfo {
bool operator<(const SubtitleLine& other) const { return (frame < other.frame); }
};
GameSubtitleSceneInfo(SubtitleSceneKind kind) : m_kind(kind) {}
GameSubtitleSceneInfo(SubtitleSceneKind kind) : m_kind(kind), m_id(0), m_sorting_group_idx(-1) {}
const std::string& name() const { return m_name; }
const std::vector<SubtitleLine>& lines() const { return m_lines; }

View file

@ -191,13 +191,14 @@
(defmethod get-scene-by-name subtitle-text-info ((obj subtitle-text-info) (kind pc-subtitle-channel) (name string))
"get a subtitle scene info with the corresponding name. #f = none found"
;; invalid kind so return invalid scene.
(if (or (not name) (= kind (pc-subtitle-channel invalid)))
;; invalid name so return invalid scene.
(if (not name)
(return (the subtitle-text #f)))
(dotimes (i (-> obj length))
;; name and kind matches, return that!
(when (and (= kind (-> obj data i kind)) (string= (-> obj data i name) name))
(when (and (or (= kind (pc-subtitle-channel invalid)) (= kind (-> obj data i kind)))
(string= (-> obj data i name) name))
(return (-> obj data i))
)
)
@ -207,13 +208,10 @@
(defmethod get-scene-by-text-id subtitle-text-info ((obj subtitle-text-info) (kind pc-subtitle-channel) (id text-id))
"get a subtitle scene info with the corresponding name. #f = none found"
;; invalid kind so return invalid scene.
(if (= kind (pc-subtitle-channel invalid))
(return (the subtitle-text #f)))
(dotimes (i (-> obj length))
;; name and kind matches, return that!
(when (and (= kind (-> obj data i kind)) (= (-> obj data i id) id))
(when (and (or (= kind (pc-subtitle-channel invalid)) (= kind (-> obj data i kind)))
(= (-> obj data i id) id))
(return (-> obj data i))
)
)

View file

@ -202,8 +202,8 @@ Val* Compiler::compile_error_guard(const goos::Object& code, Env* env) {
lg::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "Code:\n");
auto code_str = pretty_print::to_string(code, 120);
if (code_str.size() > 120 * 35) {
code_str = code_str.substr(0, 120 * 35) + "...";
if (code_str.size() > 120 * 30) {
code_str = code_str.substr(0, 120 * 30) + "...";
}
lg::print("{}\n", code_str);
@ -229,8 +229,8 @@ Val* Compiler::compile_error_guard(const goos::Object& code, Env* env) {
lg::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "Code:\n");
auto code_str = pretty_print::to_string(code, 120);
if (code_str.size() > 120 * 35) {
code_str = code_str.substr(0, 120 * 35) + "...";
if (code_str.size() > 120 * 30) {
code_str = code_str.substr(0, 120 * 30) + "...";
}
lg::print("{}\n", code_str);

View file

@ -52,7 +52,11 @@ Val* Compiler::compile_goos_macro(const goos::Object& o,
bool good_info = false;
auto info = m_goos.reader.db.get_info_for(o, &good_info);
lg::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "Code:\n");
lg::print("{}\n", pretty_print::to_string(goos_result, 120));
auto code_str = pretty_print::to_string(goos_result, 120);
if (code_str.size() > 120 * 30) {
code_str = code_str.substr(0, 120 * 30) + "...";
}
lg::print("{}\n", code_str);
lg::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "From macro: ");
lg::print(fg(fmt::color::orange), "{}\n", name.print());
if (good_info) {
@ -70,7 +74,11 @@ Val* Compiler::compile_goos_macro(const goos::Object& o,
bool good_info = false;
auto info = m_goos.reader.db.get_info_for(o, &good_info);
lg::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "Code:\n");
lg::print("{}\n", pretty_print::to_string(goos_result, 120));
auto code_str = pretty_print::to_string(goos_result, 120);
if (code_str.size() > 120 * 30) {
code_str = code_str.substr(0, 120 * 30) + "...";
}
lg::print("{}\n", code_str);
lg::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "From macro: ");
lg::print(fg(fmt::color::orange), "{}\n", name.print());
if (good_info) {