mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 00:57:44 -04:00
Improvements/fixes to the subtitle editor (#1516)
This commit is contained in:
parent
944edd5938
commit
fa3f4b0a88
|
@ -46,24 +46,20 @@ bool write_subtitle_db_to_files(const GameSubtitleDB& db) {
|
|||
file_contents += fmt::format(" :hint #x{0:x}", scene_info.m_id);
|
||||
}
|
||||
file_contents += "\n";
|
||||
if (scene_info.m_lines.empty()) {
|
||||
file_contents += fmt::format(" ()\n");
|
||||
} else {
|
||||
for (const auto& line : scene_info.m_lines) {
|
||||
// Clear screen entries
|
||||
if (line.line_utf8.empty()) {
|
||||
file_contents += fmt::format(" ({})\n", line.frame);
|
||||
} else {
|
||||
file_contents += fmt::format(" ({}", line.frame);
|
||||
if (line.offscreen && scene_info.m_kind == SubtitleSceneKind::Movie) {
|
||||
file_contents += " :offscreen";
|
||||
}
|
||||
file_contents += fmt::format(" \"{}\"", line.speaker_utf8);
|
||||
// escape quotes
|
||||
std::string temp = line.line_utf8;
|
||||
temp = std::regex_replace(temp, std::regex("\""), "\\\"");
|
||||
file_contents += fmt::format(" \"{}\")\n", temp);
|
||||
for (const auto& line : scene_info.m_lines) {
|
||||
// Clear screen entries
|
||||
if (line.line_utf8.empty()) {
|
||||
file_contents += fmt::format(" ({})\n", line.frame);
|
||||
} else {
|
||||
file_contents += fmt::format(" ({}", line.frame);
|
||||
if (line.offscreen && scene_info.m_kind == SubtitleSceneKind::Movie) {
|
||||
file_contents += " :offscreen";
|
||||
}
|
||||
file_contents += fmt::format(" \"{}\"", line.speaker_utf8);
|
||||
// escape quotes
|
||||
std::string temp = line.line_utf8;
|
||||
temp = std::regex_replace(temp, std::regex("\""), "\\\"");
|
||||
file_contents += fmt::format(" \"{}\")\n", temp);
|
||||
}
|
||||
}
|
||||
file_contents += " )\n";
|
||||
|
|
|
@ -47,7 +47,7 @@ int64_t get_int(const goos::Object& obj) {
|
|||
|
||||
const goos::Object& car(const goos::Object& x) {
|
||||
if (!x.is_pair()) {
|
||||
throw std::runtime_error("invalid pair");
|
||||
throw std::runtime_error("car: invalid pair");
|
||||
}
|
||||
|
||||
return x.as_pair()->car;
|
||||
|
@ -55,7 +55,7 @@ const goos::Object& car(const goos::Object& x) {
|
|||
|
||||
const goos::Object& cdr(const goos::Object& x) {
|
||||
if (!x.is_pair()) {
|
||||
throw std::runtime_error("invalid pair");
|
||||
throw std::runtime_error("cdr: invalid pair");
|
||||
}
|
||||
|
||||
return x.as_pair()->cdr;
|
||||
|
@ -255,7 +255,7 @@ void parse_subtitle(const goos::Object& data,
|
|||
auto entries = cdr(obj);
|
||||
if (head.is_int()) {
|
||||
kind = SubtitleSceneKind::Hint;
|
||||
} else if (car(entries).is_symbol()) {
|
||||
} else if (entries.is_pair() && car(entries).is_symbol()) {
|
||||
const auto& parm = car(entries).as_symbol()->name;
|
||||
if (parm == ":hint") {
|
||||
entries = cdr(entries);
|
||||
|
@ -325,7 +325,8 @@ void parse_subtitle(const goos::Object& data,
|
|||
auto speaker_str = font->convert_utf8_to_game(speaker_utf8);
|
||||
scene.add_line(time, line_str, line_utf8, speaker_str, speaker_utf8, offscreen);
|
||||
} else {
|
||||
throw std::runtime_error("Each entry must be a list");
|
||||
throw std::runtime_error(
|
||||
fmt::format("{} | Each entry must be a non-empty list", scene.name()));
|
||||
}
|
||||
});
|
||||
for (auto& [lang, bank] : banks) {
|
||||
|
@ -392,15 +393,27 @@ int GameSubtitleGroups::find_group_index(const std::string& group_name) {
|
|||
|
||||
void GameSubtitleGroups::remove_scene(const std::string& group_name,
|
||||
const std::string& scene_name) {
|
||||
// TODO - validate group_name
|
||||
if (m_groups.count(group_name) == 0) {
|
||||
lg::error("Subtitle group {} doesn't exist! Abort.", group_name);
|
||||
return;
|
||||
}
|
||||
m_groups[group_name].erase(
|
||||
std::remove(m_groups[group_name].begin(), m_groups[group_name].end(), scene_name),
|
||||
m_groups[group_name].end());
|
||||
}
|
||||
|
||||
void GameSubtitleGroups::add_scene(const std::string& group_name, const std::string& scene_name) {
|
||||
// TODO - validate group_name
|
||||
// TODO - don't add duplicates
|
||||
m_groups[group_name].push_back(scene_name);
|
||||
std::string group = group_name;
|
||||
if (m_groups.count(group_name) == 0) {
|
||||
lg::error("Subtitle group {} doesn't exist! Add to uncategorized.", group_name);
|
||||
group = uncategorized_group;
|
||||
}
|
||||
auto it = std::find(m_groups[group].begin(), m_groups[group].end(), scene_name);
|
||||
if (it != m_groups[group].end()) {
|
||||
lg::error("Scene {} already exists in group {}", scene_name, group);
|
||||
} else {
|
||||
m_groups[group].push_back(scene_name);
|
||||
}
|
||||
}
|
||||
|
||||
GameSubtitleDB load_subtitle_project() {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <unordered_set>
|
||||
|
||||
#include "common/goos/Object.h"
|
||||
#include "common/log/log.h"
|
||||
#include "common/util/Assert.h"
|
||||
#include "common/util/FontUtils.h"
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -8,10 +8,6 @@
|
|||
;; sidekick
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; village1
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; oracle
|
||||
;; -----------------
|
||||
|
@ -20,6 +16,14 @@
|
|||
(0 "ORÁCULO" "HABÉIS DEMOSTRADO SER HONESTOS. É AQUÍ UNA BATERÍA.")
|
||||
)
|
||||
|
||||
;; -----------------
|
||||
;; training
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; village1
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; beach
|
||||
;; -----------------
|
||||
|
@ -36,10 +40,42 @@
|
|||
;; firecanyon
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; village2
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; swamp
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; rolling
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; sunken
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; ogre
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; village3
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; snowy
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; spidercave
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; lavatube
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; citadel
|
||||
;; -----------------
|
||||
|
@ -48,10 +84,6 @@
|
|||
;; finalboss
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; training
|
||||
;; -----------------
|
||||
|
||||
;; -----------------
|
||||
;; uncategorized
|
||||
;; -----------------
|
||||
|
|
|
@ -278,7 +278,7 @@
|
|||
"entity_type": "geologist",
|
||||
"process_name": "geologist-1",
|
||||
"continue_name": "village2-start",
|
||||
"move_to": [-56.6, 11.0, 32.9],
|
||||
"move_to": [194.6, 11.0, -1605.9],
|
||||
"execute_code": "(send-event __GET-PROCESS__ 'play-anim)",
|
||||
"requirements": []
|
||||
},
|
||||
|
|
|
@ -2,16 +2,24 @@
|
|||
"_groups": [
|
||||
"intro",
|
||||
"sidekick",
|
||||
"village1",
|
||||
"oracle",
|
||||
"training",
|
||||
"village1",
|
||||
"beach",
|
||||
"jungle",
|
||||
"misty",
|
||||
"firecanyon",
|
||||
"village2",
|
||||
"swamp",
|
||||
"rolling",
|
||||
"sunken",
|
||||
"ogre",
|
||||
"village3",
|
||||
"snowy",
|
||||
"spidercave",
|
||||
"lavatube",
|
||||
"citadel",
|
||||
"finalboss",
|
||||
"training",
|
||||
"uncategorized"
|
||||
],
|
||||
"beach": [
|
||||
|
@ -49,18 +57,18 @@
|
|||
"BIR-LO02",
|
||||
"BIR-LO03",
|
||||
"sksp0019",
|
||||
"sksp0026",
|
||||
"sksp0030",
|
||||
"sksp0034",
|
||||
"sksp0020",
|
||||
"sksp0022",
|
||||
"sksp0023",
|
||||
"sksp0024",
|
||||
"sksp0025",
|
||||
"sksp0026",
|
||||
"sksp0027",
|
||||
"sksp0029",
|
||||
"sagevb01",
|
||||
"sksp0030",
|
||||
"sksp0034",
|
||||
"sksp0443",
|
||||
"sagevb01",
|
||||
"mayor-introduction",
|
||||
"mayor-reminder-beams",
|
||||
"mayor-reminder-donation",
|
||||
|
@ -72,7 +80,10 @@
|
|||
"bird-lady-introduction",
|
||||
"bird-lady-reminder-1",
|
||||
"bird-lady-reminder-2",
|
||||
"bird-lady-beach-resolution"
|
||||
"bird-lady-beach-resolution",
|
||||
"sksp0028",
|
||||
"sksp0021",
|
||||
"BIR-am08"
|
||||
],
|
||||
"citadel": [
|
||||
"green-sagecage-introduction",
|
||||
|
@ -189,8 +200,6 @@
|
|||
"FIS-LO05",
|
||||
"FIS-TA01",
|
||||
"FIS-TA02",
|
||||
"FIS-TA1A",
|
||||
"FIS-TA2A",
|
||||
"FIS-TA03",
|
||||
"FIS-TA04",
|
||||
"FIS-TA05",
|
||||
|
@ -200,42 +209,58 @@
|
|||
"FIS-TA09",
|
||||
"FIS-TA10",
|
||||
"FIS-TA11",
|
||||
"sksp0038",
|
||||
"sksp0040",
|
||||
"sksp0041",
|
||||
"FIS-TA1A",
|
||||
"FIS-TA2A",
|
||||
"asstvb02",
|
||||
"sksp0011",
|
||||
"sksp0039",
|
||||
"sksp0018",
|
||||
"sksp0037",
|
||||
"sksp0b42",
|
||||
"asstvb02",
|
||||
"sksp0038",
|
||||
"sksp0039",
|
||||
"sksp0040",
|
||||
"sksp0041",
|
||||
"sksp0049",
|
||||
"sksp0050",
|
||||
"sksp0051",
|
||||
"sksp0052",
|
||||
"sksp0053",
|
||||
"sksp0054",
|
||||
"sksp0b42",
|
||||
"fisher-introduction",
|
||||
"fisher-reminder-1",
|
||||
"fisher-reject",
|
||||
"fisher-accept",
|
||||
"fisher-resolution"
|
||||
],
|
||||
"lavatube": [
|
||||
"asstva74",
|
||||
"assistant-lavatube-start-resolution",
|
||||
"assistant-lavatube-end-resolution",
|
||||
"sksp0375"
|
||||
],
|
||||
"misty": [
|
||||
"asstvb03",
|
||||
"sagevb02",
|
||||
"sksp0031",
|
||||
"sksp0064",
|
||||
"sksp0067",
|
||||
"sksp0056",
|
||||
"sksp0059",
|
||||
"sksp0060",
|
||||
"sksp0056",
|
||||
"sksp0062",
|
||||
"sksp0063",
|
||||
"sagevb02",
|
||||
"asstvb03",
|
||||
"sksp0064",
|
||||
"sksp0067",
|
||||
"sksp0069",
|
||||
"sksp0070",
|
||||
"sksp0435"
|
||||
],
|
||||
"ogre": [
|
||||
"gamcam23",
|
||||
"asstvb23",
|
||||
"flying-lurker-intro",
|
||||
"asstvb24",
|
||||
"sksp0321",
|
||||
"asstvb25"
|
||||
],
|
||||
"oracle": [
|
||||
"oracle-intro-1",
|
||||
"oracle-reminder-1",
|
||||
|
@ -244,12 +269,35 @@
|
|||
"oracle-right-eye-2",
|
||||
"oracle-left-eye-2",
|
||||
"oracle-right-eye-3",
|
||||
"oracle-left-eye-3"
|
||||
"oracle-left-eye-3",
|
||||
"oracle-intro-2",
|
||||
"oracle-reminder-2",
|
||||
"oracle-intro-3"
|
||||
],
|
||||
"rolling": [
|
||||
"asstvb20",
|
||||
"sagevb03",
|
||||
"sksp0109",
|
||||
"sksp0112",
|
||||
"sksp0113",
|
||||
"sksp0114",
|
||||
"sksp0116",
|
||||
"sksp0119",
|
||||
"sksp0120",
|
||||
"sksp0121"
|
||||
],
|
||||
"sidekick": [
|
||||
"sksp0014",
|
||||
"sksp0009",
|
||||
"sksp0035",
|
||||
"death-0181",
|
||||
"death-0182",
|
||||
"death-0184",
|
||||
"death-0186",
|
||||
"death-0187",
|
||||
"death-0191",
|
||||
"death-0193",
|
||||
"death-0195",
|
||||
"death-0197",
|
||||
"death-0199",
|
||||
"death-0202",
|
||||
"sksp0001",
|
||||
"sksp0002",
|
||||
"sksp0003",
|
||||
|
@ -258,6 +306,12 @@
|
|||
"sksp0006",
|
||||
"sksp0007",
|
||||
"sksp0008",
|
||||
"sksp0009",
|
||||
"sksp0014",
|
||||
"sksp0035",
|
||||
"sksp0071",
|
||||
"sksp0072",
|
||||
"sksp0073",
|
||||
"sksp009a",
|
||||
"sksp009b",
|
||||
"sksp009c",
|
||||
|
@ -268,17 +322,84 @@
|
|||
"sksp009i",
|
||||
"sksp009j",
|
||||
"sksp009k",
|
||||
"sksp0071",
|
||||
"sksp0072",
|
||||
"sksp0073",
|
||||
"sksp0145"
|
||||
"sksp0110",
|
||||
"sksp0145",
|
||||
"sksp0328"
|
||||
],
|
||||
"snowy": [
|
||||
"sksp0346",
|
||||
"sksp0350",
|
||||
"sksp0360",
|
||||
"sksp0345"
|
||||
],
|
||||
"spidercave": [
|
||||
"sksp0332",
|
||||
"sksp0333",
|
||||
"sksp0327",
|
||||
"sksp0334",
|
||||
"sksp0341"
|
||||
],
|
||||
"sunken": [
|
||||
"sksp0123",
|
||||
"sksp0124",
|
||||
"sksp0128",
|
||||
"sksp0133",
|
||||
"sksp0134",
|
||||
"asstvb22",
|
||||
"sksp0131",
|
||||
"sksp0127",
|
||||
"sksp0130",
|
||||
"sksp0125"
|
||||
],
|
||||
"swamp": [
|
||||
"billy-introduction",
|
||||
"billy-reject",
|
||||
"billy-accept",
|
||||
"billy-resolution",
|
||||
"billy-reminder-1"
|
||||
"billy-reminder-1",
|
||||
"BIL-AM01",
|
||||
"BIL-AM02",
|
||||
"BIL-AM03",
|
||||
"BIL-AM04",
|
||||
"BIL-AM05",
|
||||
"BIL-AM06",
|
||||
"BIL-AM07",
|
||||
"BIL-AM08",
|
||||
"BIL-AM1A",
|
||||
"BIL-AM2A",
|
||||
"BIL-AM2B",
|
||||
"BIL-LO01",
|
||||
"BIL-LO02",
|
||||
"BIL-LO03",
|
||||
"BIL-LO1A",
|
||||
"BIL-LO2A",
|
||||
"BIL-LO2B",
|
||||
"BIL-TA01",
|
||||
"BIL-TA02",
|
||||
"BIL-TA03",
|
||||
"BIL-TA04",
|
||||
"BIL-TA05",
|
||||
"BIL-TA08",
|
||||
"BIL-TA09",
|
||||
"BIL-TA1A",
|
||||
"BIL-TA2A",
|
||||
"BIL-TA3A",
|
||||
"BIL-TA4A",
|
||||
"BIL-TA4B",
|
||||
"BIL-TA5A",
|
||||
"SKSP009F",
|
||||
"asstvb21",
|
||||
"sagevb04",
|
||||
"sksp0138",
|
||||
"sksp0143",
|
||||
"sksp0144",
|
||||
"sksp0151",
|
||||
"sksp0152",
|
||||
"sksp0156",
|
||||
"sksp0157",
|
||||
"sksp0158",
|
||||
"sksp0159",
|
||||
"sksp0160"
|
||||
],
|
||||
"training": [
|
||||
"asstvb40",
|
||||
|
@ -311,11 +432,6 @@
|
|||
],
|
||||
"uncategorized": [],
|
||||
"village1": [
|
||||
"SAGELP03",
|
||||
"SAGELP04",
|
||||
"SAGELP05",
|
||||
"SAGELP06",
|
||||
"SAGELP11",
|
||||
"ASSTLP01",
|
||||
"ASSTLP02",
|
||||
"ASSTLP03",
|
||||
|
@ -332,14 +448,19 @@
|
|||
"FAR-AM2A",
|
||||
"FAR-LO01",
|
||||
"FAR-LO1A",
|
||||
"SAGELP03",
|
||||
"SAGELP04",
|
||||
"SAGELP05",
|
||||
"SAGELP06",
|
||||
"SAGELP11",
|
||||
"asstvb04",
|
||||
"asstvb08",
|
||||
"sksp0010",
|
||||
"sksp0013",
|
||||
"sksp0015",
|
||||
"sksp0017",
|
||||
"sksp0043",
|
||||
"sksp018a",
|
||||
"asstvb04",
|
||||
"asstvb08",
|
||||
"sage-introduction-misty-cannon",
|
||||
"sage-reminder-1-misty-cannon",
|
||||
"sage-reminder-1-ecorocks",
|
||||
|
@ -357,6 +478,137 @@
|
|||
"explorer-introduction",
|
||||
"explorer-reminder-1",
|
||||
"explorer-reminder-2",
|
||||
"explorer-resolution"
|
||||
"explorer-resolution",
|
||||
"EXP-LO1A"
|
||||
],
|
||||
"village2": [
|
||||
"asstvb28",
|
||||
"asstvb29",
|
||||
"asstvb30",
|
||||
"ASSTLP23",
|
||||
"ASSTLP24",
|
||||
"SAGELP20",
|
||||
"SAGELP21",
|
||||
"SAGELP22",
|
||||
"SAGELP23",
|
||||
"SAGELP24",
|
||||
"asstvb72",
|
||||
"assistant-village2-introduction",
|
||||
"sage-bluehut-introduction-crop-dusting",
|
||||
"assistant-village2-introduction-room",
|
||||
"sage-bluehut-reminder-1-crop-dusting",
|
||||
"assistant-village2-reminder-1-room",
|
||||
"sage-bluehut-introduction-prec-arm",
|
||||
"sage-bluehut-reminder-1-prec-arm",
|
||||
"assistant-village2-introduction-flutflut",
|
||||
"assistant-village2-reminder-1-flutflut",
|
||||
"assistant-village2-introduction-robbers",
|
||||
"assistant-village2-reminder-1-robbers",
|
||||
"asstvb71",
|
||||
"assistant-village2-resolution",
|
||||
"GEO-AM01",
|
||||
"GEO-AM02",
|
||||
"GEO-AM03",
|
||||
"GEO-AM04",
|
||||
"GEO-AM05",
|
||||
"GEO-AM06",
|
||||
"GEO-AM07",
|
||||
"GEO-AM08",
|
||||
"GEO-LO01",
|
||||
"GEO-LO02",
|
||||
"geologist-introduction",
|
||||
"geologist-reminder-money",
|
||||
"geologist-resolution-money",
|
||||
"geologist-reminder-moles",
|
||||
"geologist-resolution-moles",
|
||||
"GAM-AM01",
|
||||
"GAM-AM02",
|
||||
"GAM-AM03",
|
||||
"GAM-AM04",
|
||||
"GAM-AM05",
|
||||
"GAM-AM06",
|
||||
"GAM-AM07",
|
||||
"GAM-AM08",
|
||||
"GAM-AM09",
|
||||
"GAM-AM10",
|
||||
"GAM-AM11",
|
||||
"GAM-AM12",
|
||||
"GAM-AM13",
|
||||
"gambler-reminder-race",
|
||||
"gambler-reminder-money",
|
||||
"gambler-introduction-1",
|
||||
"gambler-resolution-money",
|
||||
"gambler-resolution-race",
|
||||
"WAR-LO1A",
|
||||
"WAR-LO1B",
|
||||
"WAR-LO1C",
|
||||
"warrior-introduction",
|
||||
"warrior-reminder-1",
|
||||
"warrior-resolution"
|
||||
],
|
||||
"village3": [
|
||||
"asstv103",
|
||||
"asstva73",
|
||||
"asstvb75",
|
||||
"asstvb76",
|
||||
"sage-village3-introduction",
|
||||
"ASSTLP31",
|
||||
"ASSTLP32",
|
||||
"ASSTLP33",
|
||||
"ASSTLP34",
|
||||
"ASSTLP35",
|
||||
"ASSTLP36",
|
||||
"ASSTLP37",
|
||||
"SAGELP31",
|
||||
"SAGELP32",
|
||||
"SAGELP33",
|
||||
"SAGELP34",
|
||||
"SAGELP35",
|
||||
"SAGELP36",
|
||||
"SAGELP37",
|
||||
"SAGELP38",
|
||||
"assistant-village3-reminder",
|
||||
"sage-village3-introduction-dark-eco",
|
||||
"sage-village3-reminder-1-dark-eco",
|
||||
"sage-village3-introduction-rams",
|
||||
"sage-village3-reminder-1-rams",
|
||||
"MSH-AM09",
|
||||
"MSH-AM1A",
|
||||
"minershort-introduction-orbs",
|
||||
"minershort-resolution-1-orbs",
|
||||
"minershort-reminder-2-orbs",
|
||||
"minershort-reminder-1-orbs",
|
||||
"minershort-resolution-2-orbs",
|
||||
"minershort-introduction-gnawers",
|
||||
"minershort-reminder-1-gnawers",
|
||||
"MIN-LO01",
|
||||
"MIN-LO03",
|
||||
"MIN-LO04",
|
||||
"MIN-LO05",
|
||||
"MIN-LO06",
|
||||
"MSH-AM01",
|
||||
"MSH-AM02",
|
||||
"MSH-AM03",
|
||||
"MSH-AM04",
|
||||
"MSH-AM05",
|
||||
"MSH-AM06",
|
||||
"MSH-AM07",
|
||||
"MSH-AM08",
|
||||
"MSH-AM10",
|
||||
"MSH-AM11",
|
||||
"MSH-AM12",
|
||||
"MSH-AM2A",
|
||||
"MSH-AM3A",
|
||||
"MTA-AM01",
|
||||
"MTA-AM02",
|
||||
"MTA-AM03",
|
||||
"MTA-AM04",
|
||||
"MTA-AM05",
|
||||
"MTA-AM06",
|
||||
"MTA-AM07",
|
||||
"MTA-AM08",
|
||||
"MTA-AM09",
|
||||
"asstv104",
|
||||
"asstv105"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ void SubtitleEditor::draw_window() {
|
|||
ImGui::Text("Saved!");
|
||||
ImGui::PopStyleColor();
|
||||
} else {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, m_success_text_color);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, m_error_text_color);
|
||||
ImGui::Text("Error!");
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
@ -182,8 +182,14 @@ void SubtitleEditor::draw_window() {
|
|||
|
||||
if (ImGui::TreeNode("All Cutscenes")) {
|
||||
ImGui::InputText("New Scene Name", &m_new_scene_name);
|
||||
// TODO - make this a dropdown
|
||||
ImGui::InputText("New Scene Group", &m_new_scene_group);
|
||||
if (ImGui::BeginCombo("Sorting Group", m_new_scene_group.c_str())) {
|
||||
for (size_t i = 0; i < m_subtitle_db.m_subtitle_groups->m_group_order.size(); ++i) {
|
||||
if (ImGui::Selectable(m_subtitle_db.m_subtitle_groups->m_group_order[i].c_str())) {
|
||||
m_new_scene_group = m_subtitle_db.m_subtitle_groups->m_group_order[i];
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::InputText("Filter", &m_filter, ImGuiInputTextFlags_::ImGuiInputTextFlags_AutoSelectAll);
|
||||
if (is_scene_in_current_lang(m_new_scene_name)) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, m_error_text_color);
|
||||
|
@ -195,7 +201,8 @@ void SubtitleEditor::draw_window() {
|
|||
ImGui::Text("You must provide a group to sort the scene into!");
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
if (!is_scene_in_current_lang(m_new_scene_name) && !m_new_scene_group.empty()) {
|
||||
if (!is_scene_in_current_lang(m_new_scene_name) && !m_new_scene_name.empty() &&
|
||||
!m_new_scene_group.empty()) {
|
||||
if (ImGui::Button("Add Scene")) {
|
||||
GameSubtitleSceneInfo newScene;
|
||||
newScene.m_name = m_new_scene_name;
|
||||
|
@ -203,8 +210,17 @@ void SubtitleEditor::draw_window() {
|
|||
newScene.m_id = 0; // TODO - id is always zero, bug in subtitles.cpp?
|
||||
newScene.m_sorting_group = m_new_scene_group;
|
||||
m_subtitle_db.m_banks.at(m_current_language)->add_scene(newScene);
|
||||
m_subtitle_db.m_subtitle_groups->add_scene(newScene.m_sorting_group, newScene.m_name);
|
||||
if (m_add_new_scene_as_current) {
|
||||
auto& scenes = m_subtitle_db.m_banks.at(m_current_language)->m_scenes;
|
||||
auto& scene_info = scenes[m_new_scene_name];
|
||||
m_current_scene = &scene_info;
|
||||
}
|
||||
m_new_scene_name = "";
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Add as Current Scene", &m_add_new_scene_as_current);
|
||||
ImGui::NewLine();
|
||||
}
|
||||
|
||||
draw_all_cutscene_groups();
|
||||
|
@ -213,10 +229,17 @@ void SubtitleEditor::draw_window() {
|
|||
|
||||
if (ImGui::TreeNode("All Hints")) {
|
||||
ImGui::InputText("New Scene Name", &m_new_scene_name);
|
||||
// TODO - make this a dropdown
|
||||
ImGui::InputText("New Scene ID (hex)", &m_new_scene_id);
|
||||
ImGui::InputText("New Scene Group", &m_new_scene_group);
|
||||
ImGui::InputText("Filter", &m_filter, ImGuiInputTextFlags_::ImGuiInputTextFlags_AutoSelectAll);
|
||||
if (ImGui::BeginCombo("Sorting Group", m_new_scene_group.c_str())) {
|
||||
for (size_t i = 0; i < m_subtitle_db.m_subtitle_groups->m_group_order.size(); ++i) {
|
||||
if (ImGui::Selectable(m_subtitle_db.m_subtitle_groups->m_group_order[i].c_str())) {
|
||||
m_new_scene_group = m_subtitle_db.m_subtitle_groups->m_group_order[i];
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::InputText("Filter", &m_filter_hints,
|
||||
ImGuiInputTextFlags_::ImGuiInputTextFlags_AutoSelectAll);
|
||||
if (is_scene_in_current_lang(m_new_scene_name)) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, m_error_text_color);
|
||||
ImGui::Text("Scene already exists with that name, no!");
|
||||
|
@ -227,7 +250,8 @@ void SubtitleEditor::draw_window() {
|
|||
ImGui::Text("You must provide a group to sort the scene into!");
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
if (!is_scene_in_current_lang(m_new_scene_name) && !m_new_scene_group.empty()) {
|
||||
if (!is_scene_in_current_lang(m_new_scene_name) && !m_new_scene_name.empty() &&
|
||||
!m_new_scene_group.empty()) {
|
||||
if (ImGui::Button("Add Scene")) {
|
||||
GameSubtitleSceneInfo newScene;
|
||||
newScene.m_name = m_new_scene_name;
|
||||
|
@ -238,8 +262,11 @@ void SubtitleEditor::draw_window() {
|
|||
newScene.m_kind = SubtitleSceneKind::HintNamed;
|
||||
newScene.m_id = strtoul(m_new_scene_id.c_str(), nullptr, 16);
|
||||
}
|
||||
// currently hints have no way in the editor to add a line, so give us one for free
|
||||
newScene.add_line(0, "", "", "", "", false);
|
||||
newScene.m_sorting_group = m_new_scene_group;
|
||||
m_subtitle_db.m_banks.at(m_current_language)->add_scene(newScene);
|
||||
m_subtitle_db.m_subtitle_groups->add_scene(newScene.m_sorting_group, newScene.m_name);
|
||||
m_new_scene_name = "";
|
||||
}
|
||||
}
|
||||
|
@ -337,7 +364,9 @@ void SubtitleEditor::draw_repl_options() {
|
|||
|
||||
void SubtitleEditor::draw_all_cutscene_groups() {
|
||||
for (auto& group_name : m_subtitle_db.m_subtitle_groups->m_group_order) {
|
||||
ImGui::SetNextItemOpen(true);
|
||||
if (!m_filter.empty() && m_filter != m_filter_placeholder) {
|
||||
ImGui::SetNextItemOpen(true);
|
||||
}
|
||||
if (ImGui::TreeNode(group_name.c_str())) {
|
||||
draw_all_scenes(group_name, false);
|
||||
draw_all_scenes(group_name, true);
|
||||
|
@ -348,7 +377,9 @@ void SubtitleEditor::draw_all_cutscene_groups() {
|
|||
|
||||
void SubtitleEditor::draw_all_hint_groups() {
|
||||
for (auto& group_name : m_subtitle_db.m_subtitle_groups->m_group_order) {
|
||||
ImGui::SetNextItemOpen(true);
|
||||
if (!m_filter_hints.empty() && m_filter_hints != m_filter_placeholder) {
|
||||
ImGui::SetNextItemOpen(true);
|
||||
}
|
||||
if (ImGui::TreeNode(group_name.c_str())) {
|
||||
draw_all_hints(group_name, false);
|
||||
draw_all_hints(group_name, true);
|
||||
|
@ -427,8 +458,8 @@ void SubtitleEditor::draw_all_hints(std::string group_name, bool base_cutscenes)
|
|||
scene_info.m_kind != SubtitleSceneKind::HintNamed) {
|
||||
continue;
|
||||
}
|
||||
if ((!m_filter.empty() && m_filter != m_filter_placeholder) &&
|
||||
scene_name.find(m_filter) == std::string::npos) {
|
||||
if ((!m_filter_hints.empty() && m_filter_hints != m_filter_placeholder) &&
|
||||
scene_name.find(m_filter_hints) == std::string::npos) {
|
||||
continue;
|
||||
}
|
||||
if (base_cutscenes) {
|
||||
|
@ -478,6 +509,7 @@ void SubtitleEditor::draw_subtitle_options(GameSubtitleSceneInfo& scene, bool cu
|
|||
if (ImGui::Button("Play Hint")) {
|
||||
repl_play_hint(scene.m_name);
|
||||
}
|
||||
// TODO add "Remove Hint" button (if you named it wrong or something)
|
||||
ImGui::SameLine();
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, m_disabled_text_color);
|
||||
ImGui::TextWrapped("You may have to click twice, load times cause issues");
|
||||
|
@ -511,9 +543,12 @@ void SubtitleEditor::draw_subtitle_options(GameSubtitleSceneInfo& scene, bool cu
|
|||
std::string summary;
|
||||
if (subtitleLine.line_utf8.empty()) {
|
||||
summary = fmt::format("[{}] Clear Screen", subtitleLine.frame);
|
||||
} else {
|
||||
} else if (subtitleLine.line_utf8.length() >= 30) {
|
||||
summary = fmt::format("[{}] {} - '{}...'", subtitleLine.frame, subtitleLine.speaker_utf8,
|
||||
subtitleLine.line_utf8.substr(0, 30));
|
||||
} else {
|
||||
summary = fmt::format("[{}] {} - '{}'", subtitleLine.frame, subtitleLine.speaker_utf8,
|
||||
subtitleLine.line_utf8.substr(0, 30));
|
||||
}
|
||||
if (subtitleLine.line_utf8.empty()) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, m_disabled_text_color);
|
||||
|
@ -530,8 +565,10 @@ void SubtitleEditor::draw_subtitle_options(GameSubtitleSceneInfo& scene, bool cu
|
|||
ImGui::InputText("Text", &subtitleLine.line_utf8);
|
||||
ImGui::Checkbox("Offscreen?", &subtitleLine.offscreen);
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, m_warning_color);
|
||||
if (ImGui::Button("Remove Line")) {
|
||||
scene.m_lines.erase(scene.m_lines.begin() + i);
|
||||
if (scene.m_lines.size() > 1) { // prevent creating an empty scene
|
||||
if (ImGui::Button("Remove Line")) {
|
||||
scene.m_lines.erase(scene.m_lines.begin() + i);
|
||||
}
|
||||
}
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::TreePop();
|
||||
|
@ -544,8 +581,8 @@ void SubtitleEditor::draw_subtitle_options(GameSubtitleSceneInfo& scene, bool cu
|
|||
void SubtitleEditor::draw_new_cutscene_line_form() {
|
||||
ImGui::InputInt("Frame Number", &m_current_scene_frame,
|
||||
ImGuiInputTextFlags_::ImGuiInputTextFlags_CharsDecimal);
|
||||
ImGui::InputText("Text", &m_current_scene_text);
|
||||
ImGui::InputText("Speaker", &m_current_scene_speaker);
|
||||
ImGui::InputText("Text", &m_current_scene_text);
|
||||
ImGui::Checkbox("Offscreen", &m_current_scene_offscreen);
|
||||
bool rendered_text_entry_btn = false;
|
||||
if (m_current_scene_frame < 0 || m_current_scene_text.empty() ||
|
||||
|
@ -567,9 +604,9 @@ void SubtitleEditor::draw_new_cutscene_line_form() {
|
|||
} else {
|
||||
if (rendered_text_entry_btn) {
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Add Clear Screen Entry")) {
|
||||
m_current_scene->add_line(m_current_scene_frame, "", "", "", "", false);
|
||||
}
|
||||
}
|
||||
if (ImGui::Button("Add Clear Screen Entry")) {
|
||||
m_current_scene->add_line(m_current_scene_frame, "", "", "", "", false);
|
||||
}
|
||||
}
|
||||
ImGui::NewLine();
|
||||
|
|
|
@ -52,6 +52,7 @@ class SubtitleEditor {
|
|||
std::string m_current_scene_text = "";
|
||||
std::string m_current_scene_speaker = "";
|
||||
bool m_current_scene_offscreen = false;
|
||||
bool m_add_new_scene_as_current = false;
|
||||
|
||||
std::string m_new_scene_name = "";
|
||||
std::string m_new_scene_group = "";
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
(defconstant PC_SUBTITLE_FILE_SIZE (* 128 1024)) ;; 128K heap for subtitles. adjust later if necessary.
|
||||
(defconstant PC_SUBTITLE_FILE_SIZE (* 192 1024)) ;; 192K heap for subtitles. adjust later if necessary.
|
||||
(defconstant PC_SUBTITLE_FILE_NAME "subtit")
|
||||
(defconstant PC_SUBTITLE_STR_ADJUST 17)
|
||||
(defglobalconstant PC_SUBTITLE_DEBUG #f)
|
||||
|
|
Loading…
Reference in a new issue