Implement FlxStreamBuffer and beginnings of ConsoleCommands in unreal

This commit is contained in:
2023-10-24 01:44:09 -04:00
parent 9dc9d31d54
commit 5381b5708a
6 changed files with 106 additions and 219 deletions

View File

@@ -132,24 +132,41 @@ void AIntegrationGameModeBase::UpdateTangibles() {
TangibleManager->DeleteFarawayTangibles();
}
void AIntegrationGameModeBase::ExecuteDebuggingCommand(const FString &fs) {
if (fs == "\\invokeplayer") {
// FlxLockedWrapper w(LockableWrapper);
// int64 player = w.GetActor();
// w->play_invoke_player(w.Get(), player, datapk);
} else {
ConsoleOutput.AppendLine(TEXT("Unknown Command"));
}
}
void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs)
{
FlxLockedWrapper w(LockableWrapper);
if (w->engine != nullptr)
{
const TCHAR* fstchar = *fs;
if (sizeof(TCHAR) == 2)
{
ConsoleOutput.AppendLine(FString("> ") + fs);
std::u16string_view fsview((const char16_t*)fstchar, fs.Len());
std::string utf8 = drvutil::utf16_to_utf8(fsview);
utf8 = utf8 + "\n";
w->play_recv_incoming(w.Get(), 0, utf8.size(), utf8.c_str());
ConsoleOutput.AppendLine(FString("> ") + fs);
// This is a bad way to do this. The problem is that if some
// lua code contains '\\', we'll catch it instead of passing it
// through. There's no simple solution, though.
if (fs[0] == '\\') {
ExecuteDebuggingCommand(fs);
} else {
const TCHAR* fstchar = *fs;
if (sizeof(TCHAR) == 2)
{
std::u16string_view fsview((const char16_t*)fstchar, fs.Len());
std::string utf8 = drvutil::utf16_to_utf8(fsview);
utf8 = utf8 + "\n";
w->play_recv_incoming(w.Get(), 0, utf8.size(), utf8.c_str());
}
}
}
}
void AIntegrationGameModeBase::Tick(float deltaseconds)
{
Super::Tick(deltaseconds);