add subtitle UI

This commit is contained in:
Adam Jensen 2023-03-24 07:13:50 +00:00
parent 1240664fcf
commit 226bdd23c3
4 changed files with 38 additions and 2 deletions

View File

@ -270,8 +270,12 @@ void buildUI(dtp::SoundPlex *snd, std::string indent) {
break;
}
case dtp::SoundPlex::SoundPlexSelector_Envelope: // 6
case dtp::SoundPlex::SoundPlexSelector_Envelope: { // 6
auto *data = (dtp::SoundPlex**)snd->m_data;
buildUI(*data, indent + " ");
// TODO
break;
}
case dtp::SoundPlex::SoundPlexSelector_Selector: // 7
break;

View File

@ -2,6 +2,9 @@
#include "Sample.h"
#include "SoundPlexStream.h"
// HACK
extern uint32_t subtitleIndex;
namespace cdc {
SoundPlexStream::SoundPlexStream(
@ -27,6 +30,8 @@ uint32_t SoundPlexStream::Init() {
// TODO
);
subtitleIndex = dtpStream->stringIndex12;
// HACK
((MultiplexStreamImpl*)multiplexStream)->hackSample->Play();

View File

@ -42,7 +42,12 @@ struct SoundPlex {
const char *m_streamName;
int8_t byte4; // TODO
int8_t m_priorityStream;
// TODO
int8_t byte6;
uint32_t dword8;
uint32_t dwordC;
int8_t byte10;
int8_t byte11;
uint16_t stringIndex12;
};
struct Wave {

View File

@ -96,12 +96,14 @@
#endif
cdc::MultiplexStream *neverAskedForThis = nullptr;
uint32_t subtitleIndex = 0;
void howDoYouHandleAllOfThis() {
if (!neverAskedForThis)
neverAskedForThis = cdc::MultiplexStream::CreateSoundStream("vo\\eng\\det1\\adam_jensen\\sq02\\det1_sq02_dia_adam_006b", 0);
((cdc::MultiplexStreamImpl*)neverAskedForThis)->hackSample->Play();
subtitleIndex = 7497;
}
class ImGuiDrawable : public cdc::IRenderDrawable {
@ -872,6 +874,26 @@ int spinnyCube(HWND window,
ImGui::EndMainMenuBar();
}
if (subtitleIndex) {
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoMove;
const float PAD = 30.0f;
const ImGuiViewport* viewport = ImGui::GetMainViewport();
ImVec2 work_pos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any!
ImVec2 work_size = viewport->WorkSize;
ImVec2 window_pos, window_pos_pivot;
window_pos.x = work_pos.x + work_size.x*0.5f;
window_pos.y = work_pos.y + work_size.y - PAD;
window_pos_pivot.x = 0.5f;
window_pos_pivot.y = 1.0f;
ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always, window_pos_pivot);
ImGui::SetNextWindowBgAlpha(0.35f); // Transparent background
bool open = true;
if (ImGui::Begin("subtitlebox", &open, window_flags)) {
ImGui::Text("%s", localstr_get(subtitleIndex));
}
ImGui::End();
}
imGuiDrawable.lastMinuteAdditions = [&]() {
if (showDrawablesWindow) {
cdc::CommonScene *xscene = captures[selectedCapture].second;