Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ced9710
Merge branch 'master' into tweak/actor-management
RobbeBryssinck May 25, 2022
d36a330
Merge branch 'stability' into tweak/actor-management
RobbeBryssinck May 25, 2022
77a64e7
Merge branch 'stability' into tweak/actor-management
RobbeBryssinck May 25, 2022
4c47a5e
Merge branch 'stability' into tweak/actor-management
RobbeBryssinck May 26, 2022
be4aafc
WIP: transfer actors to quest leader (does not work)
RobbeBryssinck May 26, 2022
7222a5a
WIP: ai background process list debugger
RobbeBryssinck May 28, 2022
6cd70c5
fix: actor stuck on traveling through door
RobbeBryssinck May 28, 2022
77c0098
fix: the door problem (again)
RobbeBryssinck May 28, 2022
1562621
tweak: actually send the thing
RobbeBryssinck May 28, 2022
81b338b
fix: MoveActor bug
RobbeBryssinck May 29, 2022
b1912d8
fix: don't tp temporaries
RobbeBryssinck May 29, 2022
b93cb7f
fix: server crash
RobbeBryssinck May 29, 2022
677daaa
fix: build error
RobbeBryssinck May 29, 2022
e0baaa4
tweak: delete all old crash dumps
RobbeBryssinck May 29, 2022
b208a1c
tweak: don't deselect current quest on connect
RobbeBryssinck May 29, 2022
8631066
tweak: take ownership debug button
RobbeBryssinck May 29, 2022
497d679
fix: build error
RobbeBryssinck May 29, 2022
b64d0c6
tweak: added logging
RobbeBryssinck May 29, 2022
398b4c3
Merge branch 'feat/ai' into tweak/actor-management
RobbeBryssinck May 29, 2022
4695f95
tweak: entity validity debugging
RobbeBryssinck May 29, 2022
b77fbf3
tweak: improved entities debugger
RobbeBryssinck May 29, 2022
991337b
fix: wrongful ownership transfer
RobbeBryssinck May 29, 2022
7c6a9ed
feat: transfer ownership to party leader on creation
RobbeBryssinck May 29, 2022
0bb89bc
feat: party leader hosts all actors
RobbeBryssinck May 29, 2022
c543200
tweak: don't transfer ownership of mounts to quest leader
RobbeBryssinck May 29, 2022
563cf47
fix: isOwner bool on assignment
RobbeBryssinck May 29, 2022
2ca9a43
tweak: teleport actor to me button
RobbeBryssinck May 29, 2022
c6bf19c
fix: double applying of RemoteComponent
RobbeBryssinck May 29, 2022
a11649e
fix: form id comparison
RobbeBryssinck May 29, 2022
c1870b9
fix: potential disconnect crash
RobbeBryssinck May 29, 2022
d32f31e
tweak: improved equipment sync
RobbeBryssinck May 30, 2022
197f0cc
fix: properly update magic equipment
RobbeBryssinck May 30, 2022
0e9d36b
tweak: worn armor debugger
RobbeBryssinck May 30, 2022
4bf7cdb
tweak: apply remote inventory for claimed actor
RobbeBryssinck May 30, 2022
f0c6f25
tweak: send current inventory on assigned char
RobbeBryssinck May 30, 2022
5b08474
tweak: weapon draw impovements
RobbeBryssinck May 30, 2022
97bd3dc
tweak: request spawn data after relinquish control
RobbeBryssinck May 30, 2022
5651b65
fix: conjure familiar ghost effect apply
RobbeBryssinck May 30, 2022
a5c3ad7
fix: transfer temp actors
RobbeBryssinck May 30, 2022
397e971
feat: improved quest debugger
RobbeBryssinck May 31, 2022
046aadd
fix: entity actor mover
RobbeBryssinck May 31, 2022
3f53434
fix: double queue of event
RobbeBryssinck May 31, 2022
c6341b5
tweak: TiltedCore debug symbols
RobbeBryssinck May 31, 2022
6d1de7c
tweak: limit quest debugger to quest leader
RobbeBryssinck May 31, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: improved quest debugger
  • Loading branch information
RobbeBryssinck committed May 31, 2022
commit 397e9717a980332d6418437d19636b66870439d2
13 changes: 13 additions & 0 deletions Code/client/Events/MoveActorEvent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

struct MoveActorEvent
{
MoveActorEvent(uint32_t aFormId, uint32_t aCellId, NiPoint3 aPosition)
: FormId(aFormId), CellId(aCellId), Position(aPosition)
{
}

uint32_t FormId;
uint32_t CellId;
NiPoint3 Position;
};
11 changes: 11 additions & 0 deletions Code/client/Games/Skyrim/Forms/TESQuest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@

#include <Games/Overrides.h>

TESObjectREFR* TESQuest::GetAliasedRef(uint32_t aAliasID) noexcept
{
TP_THIS_FUNCTION(TGetAliasedRef, BSPointerHandle<TESObjectREFR>*, TESQuest, BSPointerHandle<TESObjectREFR>*, uint32_t);
POINTER_SKYRIMSE(TGetAliasedRef, getAliasedRef, 25066);

BSPointerHandle<TESObjectREFR> result{};
ThisCall(getAliasedRef, this, &result, aAliasID);

return TESObjectREFR::GetByHandle(result.handle.iBits);
}

TESQuest::State TESQuest::getState()
{
if (flags >= 0)
Expand Down
10 changes: 9 additions & 1 deletion Code/client/Games/Skyrim/Forms/TESQuest.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
#include <Components/TESFullName.h>
#include <Forms/BGSStoryManagerTree.h>

struct BGSScene : TESForm
{
GameArray<void*> phases;
GameArray<uint32_t> actorIds;
};

struct TESQuest : BGSStoryManagerTreeForm
{
enum class State : uint8_t
Expand Down Expand Up @@ -91,7 +97,7 @@ struct TESQuest : BGSStoryManagerTreeForm
*/
GameList<Objective> objectives; // 0x00F8
char pad108[0x100]; // 0x0108
GameArray<void*> scenes; // 0x0208
GameArray<BGSScene*> scenes; // 0x0208
char pad210[8]; // 0x0210
uint16_t currentStage; // 0x0228
bool alreadyRun; // 0x022A
Expand All @@ -101,6 +107,8 @@ struct TESQuest : BGSStoryManagerTreeForm
uint64_t unkFlags;
char pad250[24];

TESObjectREFR* GetAliasedRef(uint32_t aiAliasID) noexcept;

bool IsStageDone(uint16_t stageIndex);
void SetCompleted(bool force);

Expand Down
36 changes: 35 additions & 1 deletion Code/client/Services/Debug/DebugService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <Events/UpdateEvent.h>
#include <Events/DialogueEvent.h>
#include <Events/SubtitleEvent.h>
#include <Events/MoveActorEvent.h>

#include <Games/References.h>

Expand Down Expand Up @@ -97,6 +98,7 @@ DebugService::DebugService(entt::dispatcher& aDispatcher, World& aWorld, Transpo
m_drawImGuiConnection = aImguiService.OnDraw.connect<&DebugService::OnDraw>(this);
m_dialogueConnection = m_dispatcher.sink<DialogueEvent>().connect<&DebugService::OnDialogue>(this);
m_dispatcher.sink<SubtitleEvent>().connect<&DebugService::OnSubtitle>(this);
m_dispatcher.sink<MoveActorEvent>().connect<&DebugService::OnMoveActor>(this);
}

void DebugService::OnDialogue(const DialogueEvent& acEvent) noexcept
Expand All @@ -115,11 +117,40 @@ void DebugService::OnSubtitle(const SubtitleEvent& acEvent) noexcept
SubtitleText = acEvent.Text;
}

// TODO: yeah, i'm aware of how dumb this looks, but things crash if
// you do it directly by adding an event to the queue, no symbols for tiltedcore when debugging,
// so this'll do for now
struct MoveData
{
Actor* pActor = nullptr;
TESObjectCELL* pCell = nullptr;
NiPoint3 position;
} moveData;

void DebugService::OnMoveActor(const MoveActorEvent& acEvent) noexcept
{
Actor* pActor = Cast<Actor>(TESForm::GetById(acEvent.FormId));
TESObjectCELL* pCell = Cast<TESObjectCELL>(TESForm::GetById(acEvent.CellId));

if (!pActor || !pCell)
return;

moveData.pActor = pActor;
moveData.pCell = pCell;
moveData.position = acEvent.Position;
}

void DebugService::OnUpdate(const UpdateEvent& acUpdateEvent) noexcept
{
if (!BSGraphics::GetMainWindow()->IsForeground())
return;

if (moveData.pActor)
{
moveData.pActor->MoveTo(moveData.pCell, moveData.position);
moveData.pActor = nullptr;
}

static std::atomic<bool> s_f8Pressed = false;
static std::atomic<bool> s_f7Pressed = false;
static std::atomic<bool> s_f6Pressed = false;
Expand Down Expand Up @@ -167,13 +198,16 @@ void DebugService::OnUpdate(const UpdateEvent& acUpdateEvent) noexcept
{
s_f8Pressed = true;

Actor* pActor = Cast<Actor>(TESForm::GetById(0x1a677));
pActor->MoveTo(PlayerCharacter::Get()->parentCell, PlayerCharacter::Get()->position);

#if 0
static bool s_enabled = true;

FadeOutGame(s_enabled, true, 1.f, true, 0.f);

s_enabled = !s_enabled;

#if 0
static bool s_enabled = true;
static bool s_firstPerson = false;

Expand Down
3 changes: 2 additions & 1 deletion Code/client/Services/Debug/Views/EntitiesView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ void DebugService::DisplayLocalComponent(LocalComponent& aLocalComponent, const
m_world.GetRunner().Queue([acFormId]() {
Actor* pActor = Cast<Actor>(TESForm::GetById(acFormId));
PlayerCharacter* pPlayer = PlayerCharacter::Get();
pActor->MoveTo(pPlayer->parentCell, pPlayer->position);
if (pActor)
pActor->MoveTo(pPlayer->parentCell, pPlayer->position);
});
}

Expand Down
56 changes: 46 additions & 10 deletions Code/client/Services/Debug/Views/QuestDebugView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

#include <PlayerCharacter.h>
#include <Forms/TESQuest.h>
#include <Forms/TESObjectCELL.h>

#include <Events/MoveActorEvent.h>

#include <imgui.h>

Expand All @@ -30,25 +33,58 @@ void DebugService::DrawQuestDebugView()

foundQuests.insert(pQuest->formID);

if (pQuest->IsActive())
{
ImGui::TextColored({255.f, 0.f, 255.f, 255.f}, "%s|%x|%s", pQuest->idName.AsAscii(),
pQuest->flags, pQuest->fullName.value.AsAscii());
if (!pQuest->IsActive())
continue;

for (auto* stage : pQuest->stages)
char questName[256];
sprintf_s(questName, std::size(questName), "%s (%s)", pQuest->fullName.value.AsAscii(), pQuest->idName.AsAscii());
if (!ImGui::CollapsingHeader(questName))
continue;

if (ImGui::CollapsingHeader("Stages"))
{
for (auto* pStage : pQuest->stages)
{
ImGui::TextColored({0.f, 255.f, 255.f, 255.f}, "Stage: %d, is done? %s", stage->stageIndex, stage->IsDone() ? "true" : "false");
ImGui::TextColored({0.f, 255.f, 255.f, 255.f}, "Stage: %d, is done? %s", pStage->stageIndex, pStage->IsDone() ? "true" : "false");

char setStage[64];
sprintf_s(setStage, std::size(setStage), "Set stage (%d)", stage->stageIndex);
sprintf_s(setStage, std::size(setStage), "Set stage (%d)", pStage->stageIndex);

if (ImGui::Button(setStage))
pQuest->ScriptSetStage(stage->stageIndex);
pQuest->ScriptSetStage(pStage->stageIndex);
}
}
else

if (ImGui::CollapsingHeader("Actors"))
{
ImGui::Text("%s|%x|%s", pQuest->idName.AsAscii(), pQuest->flags, pQuest->fullName.value.AsAscii());
Set<uint32_t> foundActors{};

for (BGSScene* pScene : pQuest->scenes)
{
for (uint32_t actorId : pScene->actorIds)
{
Actor* pActor = Cast<Actor>(pQuest->GetAliasedRef(actorId));
if (!pActor)
continue;

if (foundActors.contains(pActor->formID))
continue;

foundActors.insert(pActor->formID);

char name[256];
sprintf_s(name, std::size(name), "%s (%x)", pActor->baseForm->GetName(), pActor->formID);
ImGui::BulletText(name);

ImGui::PushID(pActor->formID);
if (ImGui::Button("Teleport to me"))
{
auto* pPlayer = PlayerCharacter::Get();
m_world.GetRunner().Trigger(MoveActorEvent(pActor->formID, pPlayer->parentCell->formID, pPlayer->position));
}
ImGui::PopID();
}
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions Code/client/Services/DebugService.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ struct ImguiService;
struct UpdateEvent;
struct DialogueEvent;
struct SubtitleEvent;
struct MoveActorEvent;

struct TransportService;
struct BSAnimationGraphManager;
Expand All @@ -25,6 +26,7 @@ struct DebugService
void OnUpdate(const UpdateEvent&) noexcept;
void OnDialogue(const DialogueEvent&) noexcept;
void OnSubtitle(const SubtitleEvent&) noexcept;
void OnMoveActor(const MoveActorEvent&) noexcept;

void SetDebugId(const uint32_t aFormId) noexcept;

Expand Down