mirror of
https://github.com/open-goal/jak-project
synced 2026-07-02 12:36:42 -04:00
a7eee4fdc9
* fix typo * more typo * shorten discord rpc text * allow expanding enums after the fact (untested) * make `game_text` work similar to subtitles * update progress decomp * update some types + `do-not-decompile` in bitfield * fixes and fall back to original progress code * update `progress` decomp with new enums * update config files * fix enums and debug menu * always allocate (but not use) a lot of particles * small rework to display mode options * revert resolution/aspect-ratio symbol mess * begin the override stuff * make `progress-draw` more readable * more fixes * codacy good boy points * first step overriding code * finish progress overrides, game options menu fully functional! * minor fixes * Update game.gp * Update sparticle-launcher.gc * clang * change camera controls text * oops * some cleanup * derp * nice job * implement menu scrolling lol * make scrollable menus less cramped, fix arrows * make some carousell things i guess * add msaa carousell to test * oops * Update progress-pc.gc * make `pc-get-screen-size` (untested) * resolution menu * input fixes * return when selecting resolution * scroll fixes * Update progress-pc.gc * add "fit to screen" button * bug * complete resolutions menu * aspect ratio menu * subtitles language * subtitle speaker * final adjustments * ref test * fix tests * fix ref! * reduce redundancy a bit * fix mem leaks? * save settings on progress exit * fix init reorder * remove unused code * rename goal project-like files to the project extension * sha display toggle * aspect ratio settings fixes * dont store text db's in compiler * properly save+load native aspect stuff
88 lines
2.5 KiB
C++
88 lines
2.5 KiB
C++
#pragma once
|
|
#include "common/util/FontUtils.h"
|
|
#include "common/util/Assert.h"
|
|
#include <string>
|
|
#include <map>
|
|
#include <unordered_set>
|
|
#include <memory>
|
|
|
|
class GameSubtitleSceneInfo {
|
|
public:
|
|
GameSubtitleSceneInfo() {}
|
|
GameSubtitleSceneInfo(std::string name) : m_name(name) {}
|
|
|
|
struct SubtitleLine {
|
|
SubtitleLine(int frame, std::string line, std::string speaker, bool offscreen)
|
|
: frame(frame), line(line), speaker(speaker), offscreen(offscreen) {}
|
|
|
|
int frame;
|
|
std::string line;
|
|
std::string speaker;
|
|
bool offscreen;
|
|
};
|
|
|
|
const std::string& name() const { return m_name; }
|
|
const std::vector<SubtitleLine>& lines() const { return m_lines; }
|
|
void clear_lines() { m_lines.clear(); }
|
|
void from_other_scene(GameSubtitleSceneInfo& scene) {
|
|
m_name = scene.name();
|
|
m_lines = scene.lines();
|
|
}
|
|
|
|
void add_line(int frame, std::string line, std::string speaker, bool offscreen) {
|
|
m_lines.emplace_back(frame, line, speaker, offscreen);
|
|
}
|
|
|
|
private:
|
|
std::string m_name;
|
|
std::vector<SubtitleLine> m_lines;
|
|
};
|
|
|
|
class GameSubtitleBank {
|
|
public:
|
|
GameSubtitleBank(int lang_id) : m_lang_id(lang_id) {}
|
|
|
|
int lang() const { return m_lang_id; }
|
|
const std::map<std::string, GameSubtitleSceneInfo>& scenes() const { return m_scenes; }
|
|
|
|
bool scene_exists(const std::string& name) const { return m_scenes.find(name) != m_scenes.end(); }
|
|
GameSubtitleSceneInfo& scene_by_name(const std::string& name) { return m_scenes.at(name); }
|
|
void add_scene(GameSubtitleSceneInfo& scene) {
|
|
ASSERT(!scene_exists(scene.name()));
|
|
m_scenes[scene.name()] = scene;
|
|
}
|
|
|
|
private:
|
|
int m_lang_id;
|
|
|
|
std::map<std::string, GameSubtitleSceneInfo> m_scenes;
|
|
};
|
|
|
|
/*!
|
|
* The subtitles database contains a subtitles bank for each language.
|
|
* Each subtitles bank contains a series of subtitle scene infos.
|
|
*/
|
|
class GameSubtitleDB {
|
|
public:
|
|
const std::map<int, std::shared_ptr<GameSubtitleBank>>& banks() const { return m_banks; }
|
|
|
|
bool bank_exists(int id) const { return m_banks.find(id) != m_banks.end(); }
|
|
|
|
std::shared_ptr<GameSubtitleBank> add_bank(std::shared_ptr<GameSubtitleBank> bank) {
|
|
ASSERT(!bank_exists(bank->lang()));
|
|
m_banks[bank->lang()] = bank;
|
|
return bank;
|
|
}
|
|
std::shared_ptr<GameSubtitleBank> bank_by_id(int id) {
|
|
if (!bank_exists(id)) {
|
|
return nullptr;
|
|
}
|
|
return m_banks.at(id);
|
|
}
|
|
|
|
private:
|
|
std::map<int, std::shared_ptr<GameSubtitleBank>> m_banks;
|
|
};
|
|
|
|
void compile_game_subtitle(const std::vector<std::string>& filenames, GameTextVersion text_ver);
|