mirror of
https://github.com/rrika/cdcEngineDXHR.git
synced 2024-11-23 13:39:54 +00:00
show briefing lines + profile pictures
This commit is contained in:
parent
12d92ec9ff
commit
a70e915558
@ -130,20 +130,11 @@ struct ActorNpcExtraData {
|
||||
dtp::Interaction *defaultInteraction; // 3C
|
||||
};
|
||||
|
||||
void buildUI(UIActions& uiact, dtp::ConversationGraphBase *dtpGraph); // game/Conversation/Inspector.cpp
|
||||
|
||||
void buildUI(UIActions& uiact, dtp::Interaction *interaction) {
|
||||
if (interaction->dword0 && interaction->dtpGraph) {
|
||||
uint32_t tier = interaction->dtpGraph->tier;
|
||||
ImGui::Text("tier %d", tier);
|
||||
ImGui::Indent();
|
||||
if (tier == 1) {
|
||||
auto *nodeList = &static_cast<dtp::ConversationGraph*>(interaction->dtpGraph)->sub8->nodeList;
|
||||
for (uint32_t i=0; i<nodeList->dword0; i++) {
|
||||
dtp::ConversationGraphNode *node = &nodeList->nodes[i];
|
||||
ImGui::Text("node %d: %s", i, node->typeName);
|
||||
}
|
||||
}
|
||||
ImGui::Unindent();
|
||||
}
|
||||
if (interaction->dword0 && interaction->dtpGraph)
|
||||
buildUI(uiact, interaction->dtpGraph);
|
||||
else if (interaction->dword0)
|
||||
ImGui::Text("no graph");
|
||||
else
|
||||
|
@ -20,5 +20,11 @@ target_sources(dxhr PRIVATE
|
||||
objects/objects.cpp
|
||||
objects/UberObject_DX3.cpp)
|
||||
|
||||
if (ENABLE_IMGUI)
|
||||
target_sources(dxhr PRIVATE
|
||||
Conversation/Inspector.cpp)
|
||||
endif()
|
||||
|
||||
add_subdirectory(script/game)
|
||||
add_subdirectory(ui)
|
||||
|
||||
|
52
game/Conversation/Inspector.cpp
Normal file
52
game/Conversation/Inspector.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
#include "cdcLocale/localstr.h"
|
||||
#include "cdcRender/surfaces/PCDX11Texture.h"
|
||||
#include "cdcResource/ResolveSection.h"
|
||||
#include "cdcSound/SoundPlex.h"
|
||||
#include "game/dtp/conversation.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "UIActions.h"
|
||||
|
||||
|
||||
void buildUI(UIActions& uiact, dtp::ConversationGraphBase *dtpGraph) {
|
||||
uint32_t tier = dtpGraph->tier;
|
||||
ImGui::Text("tier %d", tier);
|
||||
ImGui::Indent();
|
||||
// if (tier == 1) {
|
||||
auto *nodeList = &static_cast<dtp::ConversationGraph*>(dtpGraph)->sub8->nodeList;
|
||||
for (uint32_t i=0; i<nodeList->dword0; i++) {
|
||||
dtp::ConversationGraphNode *node = &nodeList->nodes[i];
|
||||
ImGui::Text("node[%d] %s %s", i, node->dtpPath, node->typeName);
|
||||
if (strcmp(node->typeName, "Line") == 0) {
|
||||
dtp::BriefingLine *line = node->line;
|
||||
ImGui::PushID(line->voiceLineIndex);
|
||||
auto *plex = (dtp::SoundPlex*)cdc::g_resolveSections[7]->GetBasePointer(line->voiceLineIndex);
|
||||
if (plex) {
|
||||
if (ImGui::SmallButton("Play")) {
|
||||
cdc::SOUND_StartPaused(plex, /*delay=*/ 0.0f);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
}
|
||||
if (line->profile) {
|
||||
ImGui::Text("%s:", localstr_get(line->profile->nameIndex));
|
||||
ImGui::SameLine();
|
||||
if (line->profile->texture) {
|
||||
auto *resource = (cdc::RenderResource*)cdc::g_resolveSections[5]->GetBasePointer(line->profile->texture);
|
||||
if (auto tex = dynamic_cast<cdc::PCDX11Texture*>(resource))
|
||||
ImGui::Image(
|
||||
tex->createShaderResourceView(), ImVec2(64, 64));
|
||||
}
|
||||
}
|
||||
auto *un = line->untranslated;
|
||||
auto *tr = localstr_get(line->stringIndex);
|
||||
if (un && tr && strcmp(un, tr) != 0) {
|
||||
ImGui::Text("%s", tr);
|
||||
ImGui::Text("%s", un);
|
||||
} else {
|
||||
ImGui::Text("%s", un);
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
}
|
||||
// }
|
||||
ImGui::Unindent();
|
||||
}
|
@ -1,15 +1,35 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
namespace cdc { class RenderResource; }
|
||||
|
||||
namespace dtp {
|
||||
|
||||
// nodes
|
||||
|
||||
struct ConversationGraphNode { // made-up name
|
||||
uint32_t dword0;
|
||||
struct BriefingProfile {
|
||||
uint16_t nameIndex;
|
||||
uint16_t nonPlayer;
|
||||
// cdc::RenderResource *texture;
|
||||
uint32_t texture;
|
||||
};
|
||||
|
||||
struct BriefingLine {
|
||||
BriefingProfile *profile; // 0
|
||||
uint32_t dword4;
|
||||
uint32_t dword8;
|
||||
const char *typeName;
|
||||
uint32_t voiceLineIndex; // C
|
||||
uint32_t stringIndex; // 10
|
||||
const char *untranslated;
|
||||
};
|
||||
|
||||
struct ConversationGraphNode { // made-up name
|
||||
const char *count; // eg. "(099)"
|
||||
const char *dtpPath; // eg. "dtp\conversation\briefingnodes\Briefing_Line.dtp"
|
||||
union {
|
||||
BriefingLine *line; // 8
|
||||
};
|
||||
const char *typeName; // eg. "Line"
|
||||
uint32_t dword10;
|
||||
uint32_t dword14;
|
||||
uint32_t dword18;
|
||||
@ -32,7 +52,11 @@ struct ConversationBase { // made-up name
|
||||
};
|
||||
|
||||
struct ConversationBriefing : ConversationBase {
|
||||
uint32_t pad[(0x60-0x4) / 4]; // 4
|
||||
char pad4[0x18-0x4];
|
||||
const char *name18;
|
||||
char pad1C[0x24-0x1C];
|
||||
const char *name24;
|
||||
char pad28[0x60-0x28];
|
||||
ConversationGraphNodeList nodeList; // 60
|
||||
};
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "game/Actor/InventoryPlayer.h"
|
||||
#include "game/dtp/objecttypes/globaldatabase.h"
|
||||
#include "game/dtp/objecttypes/globalloading.h"
|
||||
#include "game/dtp/conversation.h"
|
||||
#include "game/dtp/pickup.h"
|
||||
#include "game/DeferredRenderingObject.h"
|
||||
#include "game/DX3Player.h"
|
||||
@ -187,6 +188,9 @@ public:
|
||||
DRMIndex drmIndex;
|
||||
|
||||
#if ENABLE_IMGUI
|
||||
|
||||
void buildUI(UIActions& uiact, dtp::ConversationGraphBase *dtpGraph); // game/Conversation/Inspector.cpp
|
||||
|
||||
struct DRMExplorer {
|
||||
|
||||
void draw(UIActions& uiact, bool *showWindow) {
|
||||
@ -250,6 +254,12 @@ struct DRMExplorer {
|
||||
ImGui::PopID();
|
||||
|
||||
}
|
||||
if (section.type == 7 && section.allocFlags == 42) { // DTP (Conversation)
|
||||
auto *convGraph = (dtp::ConversationGraphBase*)cdc::g_resolveSections[7]->GetBasePointer(section.id);
|
||||
ImGui::PushID(section.id);
|
||||
buildUI(uiact, convGraph);
|
||||
ImGui::PopID();
|
||||
}
|
||||
if (section.type == 8) { // Script
|
||||
if (auto *ty = (cdc::ScriptType*)cdc::g_resolveSections[8]->GetBasePointer(section.id)) {
|
||||
ImGui::SameLine();
|
||||
|
Loading…
Reference in New Issue
Block a user