Change some class naming conventions
This commit is contained in:
Binary file not shown.
BIN
Content/TanActor.uasset
LFS
BIN
Content/TanActor.uasset
LFS
Binary file not shown.
BIN
Content/TangibleActor.uasset
LFS
Normal file
BIN
Content/TangibleActor.uasset
LFS
Normal file
Binary file not shown.
@@ -1,18 +1,18 @@
|
||||
|
||||
#include "AnimQueue.h"
|
||||
|
||||
FAnimStep FAnimQueueDecoder::ReadStep() {
|
||||
FAnimStep result;
|
||||
FlxAnimStep FlxAnimQueueDecoder::ReadStep() {
|
||||
FlxAnimStep result;
|
||||
result.Hash = Decoder.read_uint64();
|
||||
result.Body = Decoder.read_string_view();
|
||||
return result;
|
||||
}
|
||||
|
||||
FAnimField FAnimStepDecoder::ReadField() {
|
||||
FAnimField result;
|
||||
FlxAnimField FlxAnimStepDecoder::ReadField() {
|
||||
FlxAnimField result;
|
||||
result.Name = Decoder.read_string_view();
|
||||
result.Persistent = Decoder.read_bool();
|
||||
result.Type = (EAnimValueType)Decoder.read_uint8();
|
||||
result.Type = (ElxAnimValueType)Decoder.read_uint8();
|
||||
switch (result.Type) {
|
||||
case T_STRING: {
|
||||
result.S = Decoder.read_string_view();
|
||||
@@ -42,39 +42,39 @@ FAnimField FAnimStepDecoder::ReadField() {
|
||||
return result;
|
||||
}
|
||||
|
||||
FString FAnimQueueDecoder::DebugString(std::string_view queue) {
|
||||
FString FlxAnimQueueDecoder::DebugString(std::string_view queue) {
|
||||
FString result;
|
||||
FAnimQueueDecoder decoder(queue);
|
||||
FlxAnimQueueDecoder decoder(queue);
|
||||
while (!decoder.AtEOF()) {
|
||||
FAnimStep step = decoder.ReadStep();
|
||||
FString stepdebug = FAnimStepDecoder::DebugString(step);
|
||||
FlxAnimStep step = decoder.ReadStep();
|
||||
FString stepdebug = FlxAnimStepDecoder::DebugString(step);
|
||||
result.Appendf(TEXT("%s\n"), *stepdebug);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
FString FAnimStepDecoder::DebugString(const FAnimStep& step) {
|
||||
FString FlxAnimStepDecoder::DebugString(const FlxAnimStep& step) {
|
||||
FString result;
|
||||
FAnimStepDecoder decoder(step);
|
||||
FlxAnimStepDecoder decoder(step);
|
||||
bool first = true;
|
||||
while (!decoder.AtEOF()) {
|
||||
FAnimField field = decoder.ReadField();
|
||||
FlxAnimField field = decoder.ReadField();
|
||||
if (!first) {
|
||||
result.Append(TEXT(" "));
|
||||
}
|
||||
result.Append(FString(field.Name.size(), (const UTF8CHAR*)field.Name.data()));
|
||||
result.Append(field.Persistent ? TEXT("=") : TEXT(":"));
|
||||
switch (field.Type) {
|
||||
case EAnimValueType::T_STRING:
|
||||
case ElxAnimValueType::T_STRING:
|
||||
result.Append(FString(field.S.size(), (const UTF8CHAR*)field.S.data()));
|
||||
break;
|
||||
case EAnimValueType::T_NUMBER:
|
||||
case ElxAnimValueType::T_NUMBER:
|
||||
result.Appendf(TEXT("%lf"), field.X);
|
||||
break;
|
||||
case EAnimValueType::T_BOOLEAN:
|
||||
case ElxAnimValueType::T_BOOLEAN:
|
||||
result.Append((field.X) == 1.0 ? TEXT("true") : TEXT("false"));
|
||||
break;
|
||||
case EAnimValueType::T_XYZ:
|
||||
case ElxAnimValueType::T_XYZ:
|
||||
result.Appendf(TEXT("%lf,%lf,%lf"), field.X, field.Y, field.Z);
|
||||
break;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ FString FAnimStepDecoder::DebugString(const FAnimStep& step) {
|
||||
//// store the hashes, not the steps. The First element
|
||||
//// of the queue is the oldest item.
|
||||
////
|
||||
//TDeque<FAnimStoredStep> AQ;
|
||||
//TDeque<FlxAnimStoredStep> AQ;
|
||||
|
||||
//// The sequence number of the first item in AQ.
|
||||
////
|
||||
@@ -106,7 +106,7 @@ FString FAnimStepDecoder::DebugString(const FAnimStep& step) {
|
||||
//TArray<uint64> AbortedHashes;
|
||||
|
||||
|
||||
FAnimTracker::FAnimTracker() {
|
||||
FlxAnimTracker::FlxAnimTracker() {
|
||||
AQ.Empty();
|
||||
FirstSeqno = 0;
|
||||
HashToSeqno.Empty();
|
||||
@@ -114,7 +114,7 @@ FAnimTracker::FAnimTracker() {
|
||||
AbortedHashes.Empty();
|
||||
}
|
||||
|
||||
void FAnimTracker::Update(std::string_view encqueue) {
|
||||
void FlxAnimTracker::Update(std::string_view encqueue) {
|
||||
// Check for an exact match. If the most recent entry
|
||||
// in encqueue has the same hash as the most recent
|
||||
// entry in AQ, then that's an exact match. Or,
|
||||
@@ -128,7 +128,7 @@ void FAnimTracker::Update(std::string_view encqueue) {
|
||||
}
|
||||
} else {
|
||||
if (!AQ.IsEmpty()) {
|
||||
FStringDecoder qdecoder(encqueue);
|
||||
FlxStringDecoder qdecoder(encqueue);
|
||||
uint64 hash = qdecoder.read_uint64();
|
||||
if (hash == AQ.Last().Hash) {
|
||||
return;
|
||||
@@ -143,11 +143,11 @@ void FAnimTracker::Update(std::string_view encqueue) {
|
||||
// At the same time, push all non-matching records
|
||||
// after the matching record onto a stack of new records.
|
||||
//
|
||||
FAnimQueueDecoder decoder(encqueue);
|
||||
TArray<FAnimStep> newsteps;
|
||||
FlxAnimQueueDecoder decoder(encqueue);
|
||||
TArray<FlxAnimStep> newsteps;
|
||||
int32 matchingseqno = -1;
|
||||
while (!decoder.AtEOF()) {
|
||||
FAnimStep step = decoder.ReadStep();
|
||||
FlxAnimStep step = decoder.ReadStep();
|
||||
int32* stepseq = HashToSeqno.Find(step.Hash);
|
||||
if (stepseq == nullptr) {
|
||||
newsteps.Emplace(step);
|
||||
@@ -172,7 +172,7 @@ void FAnimTracker::Update(std::string_view encqueue) {
|
||||
// Transfer the new animations onto the queue.
|
||||
//
|
||||
while (!newsteps.IsEmpty()) {
|
||||
FAnimStep step = newsteps.Pop();
|
||||
FlxAnimStep step = newsteps.Pop();
|
||||
int32 seqno = FirstSeqno + AQ.Num();
|
||||
AQ.EmplaceLast(step.Hash, step.Body);
|
||||
HashToSeqno.Emplace(step.Hash, seqno);
|
||||
@@ -202,25 +202,25 @@ void FAnimTracker::Update(std::string_view encqueue) {
|
||||
}
|
||||
}
|
||||
|
||||
TArray<uint64> FAnimTracker::GetAborted() {
|
||||
TArray<uint64> FlxAnimTracker::GetAborted() {
|
||||
TArray<uint64> result;
|
||||
result = std::move(AbortedHashes);
|
||||
AbortedHashes.Empty();
|
||||
return result;
|
||||
}
|
||||
|
||||
bool FAnimTracker::AnyUnstarted() {
|
||||
bool FlxAnimTracker::AnyUnstarted() {
|
||||
int offset = UnstartedSeqno - FirstSeqno;
|
||||
return (offset < AQ.Num());
|
||||
}
|
||||
|
||||
FAnimStoredStep FAnimTracker::GetUnstarted() {
|
||||
FlxAnimStoredStep FlxAnimTracker::GetUnstarted() {
|
||||
int offset = UnstartedSeqno - FirstSeqno;
|
||||
check(offset < AQ.Num());
|
||||
return AQ[offset];
|
||||
}
|
||||
|
||||
void FAnimTracker::Started(uint64 hash) {
|
||||
void FlxAnimTracker::Started(uint64 hash) {
|
||||
int offset = UnstartedSeqno - FirstSeqno;
|
||||
check(offset < AQ.Num());
|
||||
check(AQ[offset].Hash == hash);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
//
|
||||
////////////////////////////////////////////////
|
||||
|
||||
enum EAnimValueType {
|
||||
enum ElxAnimValueType {
|
||||
T_STRING,
|
||||
T_NUMBER,
|
||||
T_BOOLEAN,
|
||||
@@ -22,28 +22,28 @@ enum EAnimValueType {
|
||||
//
|
||||
// An single animation step.
|
||||
//
|
||||
// The body consists of a sequence of FAnimField
|
||||
// The body consists of a sequence of FlxAnimField
|
||||
// records. The body is encoded, to read the
|
||||
// FAnimField records you need an FAnimStepDecoder.
|
||||
// FlxAnimField records you need an FlxAnimStepDecoder.
|
||||
// This comes in two versions: the string version,
|
||||
// and the string_view version.
|
||||
//
|
||||
////////////////////////////////////////////////
|
||||
|
||||
struct FAnimStep {
|
||||
struct FlxAnimStep {
|
||||
uint64 Hash;
|
||||
std::string_view Body;
|
||||
|
||||
FAnimStep() : Hash(0), Body("") {}
|
||||
FAnimStep(uint64 h, std::string_view b) : Hash(h), Body(b) {}
|
||||
FlxAnimStep() : Hash(0), Body("") {}
|
||||
FlxAnimStep(uint64 h, std::string_view b) : Hash(h), Body(b) {}
|
||||
};
|
||||
|
||||
struct FAnimStoredStep {
|
||||
struct FlxAnimStoredStep {
|
||||
uint64 Hash;
|
||||
std::string Body;
|
||||
|
||||
FAnimStoredStep() : Hash(0), Body("") {}
|
||||
FAnimStoredStep(uint64 h, std::string_view b) : Hash(h), Body(b) {}
|
||||
FlxAnimStoredStep() : Hash(0), Body("") {}
|
||||
FlxAnimStoredStep(uint64 h, std::string_view b) : Hash(h), Body(b) {}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////
|
||||
@@ -60,10 +60,10 @@ struct FAnimStoredStep {
|
||||
//
|
||||
////////////////////////////////////////////////
|
||||
|
||||
struct FAnimField {
|
||||
struct FlxAnimField {
|
||||
std::string_view Name;
|
||||
bool Persistent;
|
||||
EAnimValueType Type;
|
||||
ElxAnimValueType Type;
|
||||
double X, Y, Z;
|
||||
std::string_view S;
|
||||
};
|
||||
@@ -79,14 +79,14 @@ struct FAnimField {
|
||||
//
|
||||
////////////////////////////////////////////////
|
||||
|
||||
class FAnimQueueDecoder {
|
||||
class FlxAnimQueueDecoder {
|
||||
private:
|
||||
FStringDecoder Decoder;
|
||||
FlxStringDecoder Decoder;
|
||||
|
||||
public:
|
||||
// Initialize the FAnimQueueDecoder with the encoded animation queue.
|
||||
// Initialize the FlxAnimQueueDecoder with the encoded animation queue.
|
||||
//
|
||||
FAnimQueueDecoder(std::string_view s) : Decoder(s) {}
|
||||
FlxAnimQueueDecoder(std::string_view s) : Decoder(s) {}
|
||||
|
||||
// Return true if the parser has reached the end of the string.
|
||||
//
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
|
||||
// Read one animation step.
|
||||
//
|
||||
FAnimStep ReadStep();
|
||||
FlxAnimStep ReadStep();
|
||||
|
||||
// Convert an AnimQueue to an FString.
|
||||
//
|
||||
@@ -106,21 +106,21 @@ public:
|
||||
// An Animation Step Decoder.
|
||||
//
|
||||
// This acts a lot like a stream reader,
|
||||
// it reads one FAnimField at a time from
|
||||
// it reads one FlxAnimField at a time from
|
||||
// the animation queue until you reach
|
||||
// 'end-of-file'.
|
||||
//
|
||||
////////////////////////////////////////////////
|
||||
|
||||
class FAnimStepDecoder {
|
||||
class FlxAnimStepDecoder {
|
||||
private:
|
||||
FStringDecoder Decoder;
|
||||
FlxStringDecoder Decoder;
|
||||
|
||||
public:
|
||||
// Initialize the FAnimStepDecoder from the FAnimStep.
|
||||
// Initialize the FlxAnimStepDecoder from the FlxAnimStep.
|
||||
//
|
||||
FAnimStepDecoder(const FAnimStep &step) : Decoder(step.Body) {}
|
||||
FAnimStepDecoder(const FAnimStoredStep& step) : Decoder(step.Body) {}
|
||||
FlxAnimStepDecoder(const FlxAnimStep &step) : Decoder(step.Body) {}
|
||||
FlxAnimStepDecoder(const FlxAnimStoredStep& step) : Decoder(step.Body) {}
|
||||
|
||||
// Return true if the parser has reached the end of the string.
|
||||
//
|
||||
@@ -128,16 +128,16 @@ public:
|
||||
|
||||
// Read one field.
|
||||
//
|
||||
FAnimField ReadField();
|
||||
FlxAnimField ReadField();
|
||||
|
||||
// Convert an AnimStep to an FString.
|
||||
//
|
||||
static FString DebugString(const FAnimStep &step);
|
||||
static FString DebugString(const FlxAnimStep &step);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////
|
||||
//
|
||||
// FAnimTracker
|
||||
// FlxAnimTracker
|
||||
//
|
||||
// This class monitors the animation queue for a single
|
||||
// tangible. It can identify when a new animation has
|
||||
@@ -147,13 +147,13 @@ public:
|
||||
//
|
||||
////////////////////////////////////////////////
|
||||
|
||||
class FAnimTracker {
|
||||
class FlxAnimTracker {
|
||||
public:
|
||||
// Our own copy of the animation queue. We only
|
||||
// store the hashes, not the steps. The First element
|
||||
// of the queue is the oldest item.
|
||||
//
|
||||
TDeque<FAnimStoredStep> AQ;
|
||||
TDeque<FlxAnimStoredStep> AQ;
|
||||
|
||||
// The sequence number of the first item in AQ.
|
||||
//
|
||||
@@ -175,7 +175,7 @@ public:
|
||||
//
|
||||
// Initially, the tracker is in the empty (Clear) state.
|
||||
//
|
||||
FAnimTracker();
|
||||
FlxAnimTracker();
|
||||
|
||||
// Update from the specified animation queue.
|
||||
//
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
//
|
||||
// You may only call this if AnyUnstarted returns true.
|
||||
//
|
||||
FAnimStoredStep GetUnstarted();
|
||||
FlxAnimStoredStep GetUnstarted();
|
||||
|
||||
// Declare that an animation has been started.
|
||||
//
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace DebugPrintControl {
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void FConsoleOutput::Truncate() {
|
||||
void FlxConsoleOutput::Truncate() {
|
||||
int lines = 50;
|
||||
int csize = Content.Len();
|
||||
int total = 0;
|
||||
@@ -160,7 +160,7 @@ void FConsoleOutput::Truncate() {
|
||||
}
|
||||
}
|
||||
|
||||
bool FConsoleOutput::MaybeAppendNewline() {
|
||||
bool FlxConsoleOutput::MaybeAppendNewline() {
|
||||
int csize = Content.Len();
|
||||
if ((csize > 0) && (Content[csize - 1] != '\n')) {
|
||||
Content += TEXT("\n");
|
||||
@@ -171,7 +171,7 @@ bool FConsoleOutput::MaybeAppendNewline() {
|
||||
}
|
||||
}
|
||||
|
||||
bool FConsoleOutput::MaybeAppendText(const FString& text) {
|
||||
bool FlxConsoleOutput::MaybeAppendText(const FString& text) {
|
||||
if (!text.IsEmpty()) {
|
||||
Content += text;
|
||||
return true;
|
||||
@@ -181,7 +181,7 @@ bool FConsoleOutput::MaybeAppendText(const FString& text) {
|
||||
}
|
||||
}
|
||||
|
||||
void FConsoleOutput::Append(const FString& text) {
|
||||
void FlxConsoleOutput::Append(const FString& text) {
|
||||
bool modified = MaybeAppendText(text);
|
||||
if (modified) {
|
||||
Dirty = true;
|
||||
@@ -189,7 +189,7 @@ void FConsoleOutput::Append(const FString& text) {
|
||||
}
|
||||
}
|
||||
|
||||
void FConsoleOutput::AppendLine(const FString& text) {
|
||||
void FlxConsoleOutput::AppendLine(const FString& text) {
|
||||
bool modified = MaybeAppendNewline();
|
||||
modified |= MaybeAppendText(text);
|
||||
modified |= MaybeAppendNewline();
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace DebugPrintControl {
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
class FConsoleOutput {
|
||||
class FlxConsoleOutput {
|
||||
private:
|
||||
FString Content;
|
||||
bool Dirty;
|
||||
|
||||
@@ -36,7 +36,7 @@ AIntegrationGameModeBase::~AIntegrationGameModeBase()
|
||||
// at the moment we trigger it.
|
||||
//
|
||||
uint32 AIntegrationGameModeBase::Run() {
|
||||
FLockedWrapper lockedwrap(LockableWrapper);
|
||||
FlxLockedWrapper lockedwrap(LockableWrapper);
|
||||
Sockets->Update(lockedwrap);
|
||||
lockedwrap->play_invoke_event_update(lockedwrap.Get(), EngineSeconds);
|
||||
Sockets->Update(lockedwrap);
|
||||
@@ -52,7 +52,7 @@ void AIntegrationGameModeBase::ResetToInitialState()
|
||||
|
||||
// Now that the thread's gone, we should be able to
|
||||
// just claim and hold the lock on the wrapper.
|
||||
FLockedWrapper w(LockableWrapper);
|
||||
FlxLockedWrapper w(LockableWrapper);
|
||||
|
||||
// Release and close all sockets.
|
||||
if (Sockets != nullptr)
|
||||
@@ -76,7 +76,7 @@ void AIntegrationGameModeBase::ResetToInitialState()
|
||||
|
||||
void AIntegrationGameModeBase::UpdateConsoleOutput() {
|
||||
// Copy Luprex Stdout into the console.
|
||||
FLockedWrapper lockedwrap(LockableWrapper);
|
||||
FlxLockedWrapper lockedwrap(LockableWrapper);
|
||||
if (Playing) {
|
||||
ConsoleOutput.Append(lockedwrap.FetchStdout());
|
||||
}
|
||||
@@ -96,7 +96,7 @@ void AIntegrationGameModeBase::UpdateConsoleOutput() {
|
||||
|
||||
void AIntegrationGameModeBase::MaybeTriggerUpdateTask(float deltaseconds) {
|
||||
if (!Playing) return;
|
||||
FLockedWrapper lockedwrap(LockableWrapper);
|
||||
FlxLockedWrapper lockedwrap(LockableWrapper);
|
||||
if (EngineSeconds >= NextThreadTrigger)
|
||||
{
|
||||
LuprexUpdateTask.Trigger();
|
||||
@@ -106,7 +106,7 @@ void AIntegrationGameModeBase::MaybeTriggerUpdateTask(float deltaseconds) {
|
||||
|
||||
void AIntegrationGameModeBase::UpdateTangibles() {
|
||||
if (!Playing) return;
|
||||
FLockedWrapper w(LockableWrapper);
|
||||
FlxLockedWrapper w(LockableWrapper);
|
||||
int64 actor = w.GetActor();
|
||||
TangibleManager.SetActor(actor);
|
||||
TangibleManager.SetNear(w.GetNear(actor, 100, 100, 100));
|
||||
@@ -119,18 +119,18 @@ void AIntegrationGameModeBase::UpdateTangibles() {
|
||||
for (int i = 0; i < tanids.Num(); i++) {
|
||||
uint64_t tanid = tanids[i];
|
||||
std::string_view aqueue = aqueues[i];
|
||||
UTangible* t = TangibleManager.GetTangible(tanid);
|
||||
UlxTangible* t = TangibleManager.GetTangible(tanid);
|
||||
check(t != nullptr);
|
||||
t->AnimTracker.Update(aqueue);
|
||||
|
||||
TArray<uint64> aborted = t->AnimTracker.GetAborted();
|
||||
for (uint64 hash : aborted) {
|
||||
ITangibleInterface::Execute_AbortAnimation(t->Actor, hash);
|
||||
IlxTangibleInterface::Execute_AbortAnimation(t->Actor, hash);
|
||||
}
|
||||
|
||||
if (t->AnimTracker.AnyUnstarted()) {
|
||||
FAnimStoredStep step = t->AnimTracker.GetUnstarted();
|
||||
bool started = ITangibleInterface::Execute_StartAnimation(t->Actor, step.Hash, step.Body.size());
|
||||
FlxAnimStoredStep step = t->AnimTracker.GetUnstarted();
|
||||
bool started = IlxTangibleInterface::Execute_StartAnimation(t->Actor, step.Hash, step.Body.size());
|
||||
if (started) {
|
||||
t->AnimTracker.Started(step.Hash);
|
||||
}
|
||||
@@ -140,7 +140,7 @@ void AIntegrationGameModeBase::UpdateTangibles() {
|
||||
|
||||
void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs)
|
||||
{
|
||||
FLockedWrapper w(LockableWrapper);
|
||||
FlxLockedWrapper w(LockableWrapper);
|
||||
if (w->engine != nullptr)
|
||||
{
|
||||
const TCHAR* fstchar = *fs;
|
||||
@@ -181,7 +181,7 @@ void AIntegrationGameModeBase::BeginPlay()
|
||||
// Now we're just going to claim the wrapper
|
||||
// lock for the remainder. When we create the thread,
|
||||
// the thread will hang until we release this lock.
|
||||
FLockedWrapper w(LockableWrapper);
|
||||
FlxLockedWrapper w(LockableWrapper);
|
||||
|
||||
// Sanity checks. Make sure everything is clean.
|
||||
checkf(!LuprexUpdateTask.IsRunning(), TEXT("There should be no thread here."));
|
||||
@@ -221,7 +221,7 @@ void AIntegrationGameModeBase::BeginPlay()
|
||||
|
||||
// If we successfully created a luprex engine, create a socket system and a worker thread.
|
||||
if (Playing) {
|
||||
Sockets.Reset(FLpxSockets::Create(w));
|
||||
Sockets.Reset(FlxSockets::Create(w));
|
||||
std::string error = Sockets->GetError();
|
||||
check(error.empty());
|
||||
LuprexUpdateTask.Startup(this);
|
||||
|
||||
@@ -60,17 +60,17 @@ public:
|
||||
FTangibleManager TangibleManager;
|
||||
|
||||
// This stores the entire text currently visible in the console.
|
||||
FConsoleOutput ConsoleOutput;
|
||||
FlxConsoleOutput ConsoleOutput;
|
||||
|
||||
// The Luprex EngineWrapper, with a Mutex to protect it.
|
||||
// To access it, construct a FLockedWrapper.
|
||||
FLockableWrapper LockableWrapper;
|
||||
// To access it, construct a FlxLockedWrapper.
|
||||
FlxLockableWrapper LockableWrapper;
|
||||
|
||||
// This utility runs the luprex update and socket update in a thread.
|
||||
FTriggeredTask LuprexUpdateTask;
|
||||
|
||||
// Luprex socket system. Aside from construction, only touched by Luprex thread.
|
||||
TUniquePtr<FLpxSockets> Sockets;
|
||||
TUniquePtr<FlxSockets> Sockets;
|
||||
|
||||
// True if 'BeginPlay' has been successfully completed.
|
||||
//
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
using namespace CommonTypes;
|
||||
|
||||
void FLockedWrapper::InitWrapper() {
|
||||
void FlxLockedWrapper::InitWrapper() {
|
||||
if (Lockable.Wrapper.play_initialize != nullptr) {
|
||||
// Already initialized.
|
||||
return;
|
||||
@@ -21,7 +21,7 @@ void FLockedWrapper::InitWrapper() {
|
||||
}
|
||||
}
|
||||
|
||||
FString FLockedWrapper::FetchStdout() {
|
||||
FString FlxLockedWrapper::FetchStdout() {
|
||||
uint32_t ndata; const char* data;
|
||||
Lockable.Wrapper.get_outgoing(Get(), 0, &ndata, &data);
|
||||
|
||||
@@ -36,18 +36,18 @@ FString FLockedWrapper::FetchStdout() {
|
||||
return FString(cps.size(), (const UCS2CHAR*)(&cps[0]));
|
||||
}
|
||||
|
||||
int64 FLockedWrapper::GetActor() {
|
||||
int64 FlxLockedWrapper::GetActor() {
|
||||
return Lockable.Wrapper.get_actor_id(Get());
|
||||
}
|
||||
|
||||
IdView FLockedWrapper::GetNear(int64 id, double rx, double ry, double rz) {
|
||||
IdView FlxLockedWrapper::GetNear(int64 id, double rx, double ry, double rz) {
|
||||
uint32 size;
|
||||
int64* data;
|
||||
Lockable.Wrapper.get_tangibles_near(Get(), id, rx, ry, rz, &size, &data);
|
||||
return IdView(data, size);
|
||||
}
|
||||
|
||||
StringViewVec FLockedWrapper::GetAnimationQueues(IdView ids) {
|
||||
StringViewVec FlxLockedWrapper::GetAnimationQueues(IdView ids) {
|
||||
// How many animation queues are we fetching?
|
||||
int num = ids.Num();
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
#include "lpx-enginewrapper.hpp"
|
||||
#include "CommonTypes.h"
|
||||
|
||||
// Class FLockableWrapper
|
||||
// Class FlxLockableWrapper
|
||||
//
|
||||
// Contains the EngineWrapper and a Mutex to lock it.
|
||||
// This class has no methods. To access the EngineWrapper,
|
||||
// construct a FLockedWrapper, and then dereference it
|
||||
// construct a FlxLockedWrapper, and then dereference it
|
||||
// using operator right arrow.
|
||||
//
|
||||
class FLockableWrapper {
|
||||
class FlxLockableWrapper {
|
||||
private:
|
||||
FCriticalSection Mutex;
|
||||
EngineWrapper Wrapper;
|
||||
@@ -24,12 +24,12 @@ private:
|
||||
TArray<const char*> AQStrBuffer;
|
||||
|
||||
public:
|
||||
friend class FLockedWrapper;
|
||||
friend class FlxLockedWrapper;
|
||||
};
|
||||
|
||||
class FLockedWrapper {
|
||||
class FlxLockedWrapper {
|
||||
private:
|
||||
FLockableWrapper& Lockable;
|
||||
FlxLockableWrapper& Lockable;
|
||||
|
||||
public:
|
||||
// Import these types into our Namespace.
|
||||
@@ -38,13 +38,13 @@ public:
|
||||
using StringViewVec = CommonTypes::StringViewVec;
|
||||
|
||||
public:
|
||||
// The constructor of the FLockedWrapper claims the mutex.
|
||||
FLockedWrapper(FLockableWrapper& w) : Lockable(w) {
|
||||
// The constructor of the FlxLockedWrapper claims the mutex.
|
||||
FlxLockedWrapper(FlxLockableWrapper& w) : Lockable(w) {
|
||||
Lockable.Mutex.Lock();
|
||||
}
|
||||
|
||||
// The destructor of the FLockedWrapper releases the mutex.
|
||||
~FLockedWrapper() {
|
||||
// The destructor of the FlxLockedWrapper releases the mutex.
|
||||
~FlxLockedWrapper() {
|
||||
Lockable.Mutex.Unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ static const char* dummy_key =
|
||||
"HcKc9a4WXhC7yu79e5BnKWltHXY=\n"
|
||||
"-----END PRIVATE KEY-----\n";
|
||||
|
||||
class FLpxSocketsI;
|
||||
class FlxSocketsI;
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -96,11 +96,11 @@ class FLpxSocketsI;
|
||||
class FLpxListener
|
||||
{
|
||||
public:
|
||||
FLpxSocketsI *LSI;
|
||||
FlxSocketsI *LSI;
|
||||
int BoundPort;
|
||||
FSocket* Socket;
|
||||
|
||||
FLpxListener(FLpxSocketsI *lsi, int bp, FSocket* sock);
|
||||
FLpxListener(FlxSocketsI *lsi, int bp, FSocket* sock);
|
||||
~FLpxListener();
|
||||
|
||||
void AcceptConnection();
|
||||
@@ -122,7 +122,7 @@ enum EChanState {
|
||||
class FLpxChannel
|
||||
{
|
||||
public:
|
||||
FLpxSocketsI* LSI;
|
||||
FlxSocketsI* LSI;
|
||||
EChanState State;
|
||||
int ChannelID;
|
||||
FSocket* Socket;
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
// buffer, that's inexplicable and therefore serious.
|
||||
void CloseChannelIfSSLErrorIsSerious(int retval);
|
||||
|
||||
FLpxChannel(FLpxSocketsI *lsi, FSocket* sock, int chid, SSL_CTX* ctx, EChanState state);
|
||||
FLpxChannel(FlxSocketsI *lsi, FSocket* sock, int chid, SSL_CTX* ctx, EChanState state);
|
||||
FLpxChannel() : FLpxChannel(nullptr, nullptr, 0, nullptr, CHAN_INACTIVE) {}
|
||||
~FLpxChannel() { }
|
||||
};
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
class FLpxSocketsI : public FLpxSockets
|
||||
class FlxSocketsI : public FlxSockets
|
||||
{
|
||||
public:
|
||||
// Fatal error status.
|
||||
@@ -208,8 +208,8 @@ public:
|
||||
SSL_CTX* ClientSecureCTX;
|
||||
SSL_CTX* ClientInsecureCTX;
|
||||
|
||||
FLpxSocketsI(FLockedWrapper &w);
|
||||
virtual ~FLpxSocketsI() override;
|
||||
FlxSocketsI(FlxLockedWrapper &w);
|
||||
virtual ~FlxSocketsI() override;
|
||||
|
||||
// Copy the trace to the DPrint output.
|
||||
void DPrintTrace();
|
||||
@@ -229,10 +229,10 @@ public:
|
||||
void HandleSocketInputOutput();
|
||||
|
||||
// Force Close Everything.
|
||||
virtual void ForceCloseEverything(FLockedWrapper& w);
|
||||
virtual void ForceCloseEverything(FlxLockedWrapper& w);
|
||||
|
||||
// Main update routine.
|
||||
virtual void Update(FLockedWrapper &w) override;
|
||||
virtual void Update(FlxLockedWrapper &w) override;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
@@ -506,7 +506,7 @@ static void BIODiscard(BIO* b, int nbytes, char* chbuf) {
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma optimize("", off)
|
||||
FLpxChannel::FLpxChannel(FLpxSocketsI* lsi, FSocket* sock, int chid, SSL_CTX* ctx, EChanState st)
|
||||
FLpxChannel::FLpxChannel(FlxSocketsI* lsi, FSocket* sock, int chid, SSL_CTX* ctx, EChanState st)
|
||||
{
|
||||
LSI = lsi;
|
||||
ChannelID = chid;
|
||||
@@ -767,7 +767,7 @@ void FLpxChannel::Advance()
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
FLpxListener::FLpxListener(FLpxSocketsI *lsi, int bp, FSocket *sock)
|
||||
FLpxListener::FLpxListener(FlxSocketsI *lsi, int bp, FSocket *sock)
|
||||
{
|
||||
LSI = lsi;
|
||||
BoundPort = bp;
|
||||
@@ -804,7 +804,7 @@ void FLpxListener::AcceptConnection()
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void FLpxSocketsI::SetError(const std::string& s)
|
||||
void FlxSocketsI::SetError(const std::string& s)
|
||||
{
|
||||
if (FatalError.empty()) {
|
||||
FatalError = s;
|
||||
@@ -812,7 +812,7 @@ void FLpxSocketsI::SetError(const std::string& s)
|
||||
}
|
||||
|
||||
|
||||
FLpxSocketsI::FLpxSocketsI(FLockedWrapper &w)
|
||||
FlxSocketsI::FlxSocketsI(FlxLockedWrapper &w)
|
||||
{
|
||||
// We retain this pointer only so long as we have the wrapper lock.
|
||||
Luprex = w.Get();
|
||||
@@ -857,7 +857,7 @@ FLpxSocketsI::FLpxSocketsI(FLockedWrapper &w)
|
||||
Luprex = nullptr;
|
||||
}
|
||||
|
||||
void FLpxSocketsI::ForceCloseEverything(FLockedWrapper& w)
|
||||
void FlxSocketsI::ForceCloseEverything(FlxLockedWrapper& w)
|
||||
{
|
||||
// We retain this pointer only so long as we have the wrapper lock.
|
||||
Luprex = w.Get();
|
||||
@@ -877,7 +877,7 @@ void FLpxSocketsI::ForceCloseEverything(FLockedWrapper& w)
|
||||
Luprex = nullptr;
|
||||
}
|
||||
|
||||
FLpxSocketsI::~FLpxSocketsI()
|
||||
FlxSocketsI::~FlxSocketsI()
|
||||
{
|
||||
checkf(Channels.IsEmpty(), TEXT("Must call ForceCloseEverything before destructor"));
|
||||
|
||||
@@ -900,7 +900,7 @@ FLpxSocketsI::~FLpxSocketsI()
|
||||
// TODO: Be more thorough.
|
||||
}
|
||||
|
||||
void FLpxSocketsI::DPrintTrace()
|
||||
void FlxSocketsI::DPrintTrace()
|
||||
{
|
||||
char* data;
|
||||
int ndata = BIO_get_mem_data(TraceBIO, &data);
|
||||
@@ -909,7 +909,7 @@ void FLpxSocketsI::DPrintTrace()
|
||||
BIO_reset(TraceBIO);
|
||||
}
|
||||
|
||||
bool FLpxSocketsI::ListeningOnPort(int p)
|
||||
bool FlxSocketsI::ListeningOnPort(int p)
|
||||
{
|
||||
for (const FLpxListener& l : Listeners)
|
||||
{
|
||||
@@ -918,7 +918,7 @@ bool FLpxSocketsI::ListeningOnPort(int p)
|
||||
return false;
|
||||
}
|
||||
|
||||
void FLpxSocketsI::HandleListenPorts()
|
||||
void FlxSocketsI::HandleListenPorts()
|
||||
{
|
||||
uint32_t nports; const uint32_t* ports;
|
||||
Luprex->get_listen_ports(Luprex, &nports, &ports);
|
||||
@@ -941,7 +941,7 @@ void FLpxSocketsI::HandleListenPorts()
|
||||
}
|
||||
|
||||
|
||||
void FLpxSocketsI::HandleNewOutgoingSockets()
|
||||
void FlxSocketsI::HandleNewOutgoingSockets()
|
||||
{
|
||||
uint32_t nchids; const uint32_t* chids;
|
||||
Luprex->get_new_outgoing(Luprex, &nchids, &chids);
|
||||
@@ -980,7 +980,7 @@ void FLpxSocketsI::HandleNewOutgoingSockets()
|
||||
}
|
||||
|
||||
|
||||
void FLpxSocketsI::RemoveInactiveChannels()
|
||||
void FlxSocketsI::RemoveInactiveChannels()
|
||||
{
|
||||
int i = 0;
|
||||
int n = Channels.Num();
|
||||
@@ -1003,7 +1003,7 @@ void FLpxSocketsI::RemoveInactiveChannels()
|
||||
|
||||
|
||||
|
||||
void FLpxSocketsI::HandleSocketInputOutput()
|
||||
void FlxSocketsI::HandleSocketInputOutput()
|
||||
{
|
||||
for (FLpxListener& listener : Listeners)
|
||||
{
|
||||
@@ -1020,7 +1020,7 @@ void FLpxSocketsI::HandleSocketInputOutput()
|
||||
RemoveInactiveChannels();
|
||||
}
|
||||
|
||||
void FLpxSocketsI::Update(FLockedWrapper &w)
|
||||
void FlxSocketsI::Update(FlxLockedWrapper &w)
|
||||
{
|
||||
// We retain this pointer only so long as we have the wrapper lock.
|
||||
Luprex = w.Get();
|
||||
@@ -1032,7 +1032,7 @@ void FLpxSocketsI::Update(FLockedWrapper &w)
|
||||
Luprex = nullptr;
|
||||
}
|
||||
|
||||
FLpxSockets* FLpxSockets::Create(FLockedWrapper &w)
|
||||
FlxSockets* FlxSockets::Create(FlxLockedWrapper &w)
|
||||
{
|
||||
return new FLpxSocketsI(w);
|
||||
return new FlxSocketsI(w);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "LockedWrapper.h"
|
||||
#include <string>
|
||||
|
||||
// Class FLpxSockets
|
||||
// Class FlxSockets
|
||||
//
|
||||
// This class is responsible for creating outgoing and incoming
|
||||
// sockets for the Luprex engine. It then relays data into and out
|
||||
@@ -13,39 +13,39 @@
|
||||
// It only has one interesting method: Update(). This one method
|
||||
// does all the communication for the Luprex engine. Note that
|
||||
// there aren't any methods where Unreal can query the state
|
||||
// of the FLpxSockets. That's because this class is for
|
||||
// of the FlxSockets. That's because this class is for
|
||||
// communication between Luprex and outside servers and clients,
|
||||
// NOT for communication with Unreal.
|
||||
//
|
||||
// The FLpxSockets keeps a pointer to the EngineWrapper.
|
||||
// The EngineWrapper must outlive the FLpxSockets.
|
||||
// The FlxSockets keeps a pointer to the EngineWrapper.
|
||||
// The EngineWrapper must outlive the FlxSockets.
|
||||
//
|
||||
// This class is an abstract base class. A derived class
|
||||
// implements all the behavior.
|
||||
//
|
||||
|
||||
class FLpxSockets;
|
||||
class FlxSockets;
|
||||
struct EngineWrapper;
|
||||
|
||||
class FLpxSockets
|
||||
class FlxSockets
|
||||
{
|
||||
protected:
|
||||
FLpxSockets() {}
|
||||
FlxSockets() {}
|
||||
|
||||
public:
|
||||
// Create the Luprex socket system.
|
||||
static FLpxSockets* Create(FLockedWrapper &w);
|
||||
static FlxSockets* Create(FlxLockedWrapper &w);
|
||||
|
||||
// Close all sockets.
|
||||
virtual void ForceCloseEverything(FLockedWrapper& w) = 0;
|
||||
virtual void ForceCloseEverything(FlxLockedWrapper& w) = 0;
|
||||
|
||||
// The update routine relays data into and out of
|
||||
// luprex via TCP/IP sockets.
|
||||
virtual void Update(FLockedWrapper& w) = 0;
|
||||
virtual void Update(FlxLockedWrapper& w) = 0;
|
||||
|
||||
// Delete the luprex socket system.
|
||||
// You must call ForceCloseEverything first.
|
||||
virtual ~FLpxSockets() {}
|
||||
virtual ~FlxSockets() {}
|
||||
|
||||
// Obtain any error status report.
|
||||
virtual std::string GetError() = 0;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "StringDecoder.h"
|
||||
|
||||
FStringDecoder::FStringDecoder(std::string_view s) {
|
||||
FlxStringDecoder::FlxStringDecoder(std::string_view s) {
|
||||
Text = s.data();
|
||||
Size = s.size();
|
||||
ErrBeyondEOF = false;
|
||||
ErrStringTooLong = false;
|
||||
}
|
||||
|
||||
std::string_view FStringDecoder::read_string_view() {
|
||||
std::string_view FlxStringDecoder::read_string_view() {
|
||||
size_t length = read_length();
|
||||
if (length > Size) {
|
||||
ErrBeyondEOF = true;
|
||||
@@ -19,7 +19,7 @@ std::string_view FStringDecoder::read_string_view() {
|
||||
return result;
|
||||
}
|
||||
|
||||
void FStringDecoder::set_at_eof() {
|
||||
void FlxStringDecoder::set_at_eof() {
|
||||
Text += Size;
|
||||
Size = 0;
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//
|
||||
// FStringDecoder
|
||||
// FlxStringDecoder
|
||||
//
|
||||
// This class is used to decipher 8-bit strings that
|
||||
// contain packed ints, strings, and other data.
|
||||
// The typical example of usage is to decipher the
|
||||
// serialized animation queues fed to us by Luprex.
|
||||
//
|
||||
// The FStringDecoder doesn't make a copy of the string
|
||||
// The FlxStringDecoder doesn't make a copy of the string
|
||||
// you pass in, instead, it stores a pointer to it.
|
||||
// So be sure not to free the string until you're
|
||||
// done analyzing it.
|
||||
@@ -26,7 +26,7 @@
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
class FStringDecoder : public BaseReader<FStringDecoder> {
|
||||
class FlxStringDecoder : public BaseReader<FlxStringDecoder> {
|
||||
private:
|
||||
const char* Text;
|
||||
size_t Size;
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
// Initialize the string decoder with a text to analyze.
|
||||
//
|
||||
FStringDecoder(std::string_view s);
|
||||
FlxStringDecoder(std::string_view s);
|
||||
|
||||
// Get the size of the remaining text.
|
||||
//
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class INTEGRATION_API UTangible : public UObject
|
||||
class INTEGRATION_API UlxTangible : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
UPROPERTY()
|
||||
AActor* Actor;
|
||||
|
||||
FAnimTracker AnimTracker;
|
||||
FlxAnimTracker AnimTracker;
|
||||
|
||||
void Init(AActor* a) {
|
||||
Actor = a;
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
#include "TangibleInterface.h"
|
||||
|
||||
// Add default functionality here for any ITangibleInterface functions that are not pure virtual.
|
||||
// Add default functionality here for any IlxTangibleInterface functions that are not pure virtual.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
// This class does not need to be modified.
|
||||
UINTERFACE(Blueprintable)
|
||||
class UTangibleInterface : public UInterface
|
||||
class UlxTangibleInterface : public UInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
};
|
||||
@@ -16,15 +16,15 @@ class UTangibleInterface : public UInterface
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class INTEGRATION_API ITangibleInterface
|
||||
class INTEGRATION_API IlxTangibleInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// Add interface functions to this class. This is the class that will be inherited to implement this interface.
|
||||
public:
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Tangible Functionality")
|
||||
bool AbortAnimation(int64 hash);
|
||||
bool StartAnimation(int64 hash, int StrLen);
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Tangible Functionality")
|
||||
bool StartAnimation(int64 hash, int StrLen);
|
||||
bool AbortAnimation(int64 hash);
|
||||
};
|
||||
|
||||
@@ -21,8 +21,8 @@ void FTangibleManager::Init(UWorld *world, UClass* tanact) {
|
||||
Near = IdView();
|
||||
}
|
||||
|
||||
UTangible *FTangibleManager::GetTangible(int64 id) {
|
||||
UTangible **p = IdToTangible.Find(id);
|
||||
UlxTangible *FTangibleManager::GetTangible(int64 id) {
|
||||
UlxTangible **p = IdToTangible.Find(id);
|
||||
if (p == nullptr) {
|
||||
return nullptr;
|
||||
} else {
|
||||
@@ -30,16 +30,16 @@ UTangible *FTangibleManager::GetTangible(int64 id) {
|
||||
}
|
||||
}
|
||||
|
||||
UTangible *FTangibleManager::MakeTangible(int64 id) {
|
||||
UTangible *& p = IdToTangible.FindOrAdd(id);
|
||||
UlxTangible *FTangibleManager::MakeTangible(int64 id) {
|
||||
UlxTangible *& p = IdToTangible.FindOrAdd(id);
|
||||
if (p == nullptr) {
|
||||
FVector location(0,0,0);
|
||||
FRotator rotation(0, 0, 0);
|
||||
FActorSpawnParameters params;
|
||||
AActor* a = World->SpawnActor(ClassTangibleActor, &location, &rotation, params);
|
||||
check(a != nullptr);
|
||||
check(a->GetClass()->ImplementsInterface(UTangibleInterface::StaticClass()));
|
||||
p = NewObject<UTangible>();
|
||||
check(a->GetClass()->ImplementsInterface(UlxTangibleInterface::StaticClass()));
|
||||
p = NewObject<UlxTangible>();
|
||||
p->Init(a);
|
||||
}
|
||||
return p;
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
|
||||
// Given a tangible ID, look up actor pointer (or NULL if actor was deleted)
|
||||
UPROPERTY()
|
||||
TMap<int64, UTangible*> IdToTangible;
|
||||
TMap<int64, UlxTangible*> IdToTangible;
|
||||
|
||||
// Actor tangible Id.
|
||||
int64 Actor;
|
||||
@@ -42,10 +42,10 @@ public:
|
||||
void Init(UWorld *world, UClass* tanact);
|
||||
|
||||
// Get the tangible if it exists, otherwise return NULL
|
||||
UTangible* GetTangible(int64 id);
|
||||
UlxTangible* GetTangible(int64 id);
|
||||
|
||||
// Get the tangible if it exists, otherwise create it.
|
||||
UTangible* MakeTangible(int64 id);
|
||||
UlxTangible* MakeTangible(int64 id);
|
||||
|
||||
// Delete the tangible.
|
||||
void DeleteTangible(int64 id);
|
||||
|
||||
Reference in New Issue
Block a user