-
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add universal roomscale movement option
- Loading branch information
Showing
8 changed files
with
139 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include <vector> | ||
#include "UObjectArray.hpp" | ||
|
||
#include "AActor.hpp" | ||
|
||
namespace sdk { | ||
UClass* AActor::static_class() { | ||
return sdk::find_uobject<UClass>(L"Class /Script/Engine.Actor"); | ||
} | ||
|
||
bool AActor::set_actor_location(const glm::vec3& location, bool sweep, bool teleport) { | ||
static const auto func = static_class()->find_function(L"K2_SetActorLocation"); | ||
static const auto fhitresult = sdk::find_uobject<UScriptStruct>(L"ScriptStruct /Script/Engine.HitResult"); | ||
|
||
// Need to dynamically allocate the params because of unknown FHitResult size | ||
std::vector<uint8_t> params{}; | ||
|
||
// add a vec3 | ||
params.insert(params.end(), (uint8_t*)&location, (uint8_t*)&location + sizeof(glm::vec3)); | ||
// add a bool | ||
params.insert(params.end(), (uint8_t*)&sweep, (uint8_t*)&sweep + sizeof(bool)); | ||
// align | ||
params.insert(params.end(), 3, 0); | ||
// add a FHitResult | ||
params.insert(params.end(), fhitresult->get_struct_size(), 0); | ||
// add a bool | ||
params.insert(params.end(), (uint8_t*)&teleport, (uint8_t*)&teleport + sizeof(bool)); | ||
// add a bool | ||
bool ret = false; | ||
void* ret_ptr = &ret; | ||
params.insert(params.end(), (uint8_t*)&ret_ptr, (uint8_t*)&ret_ptr + sizeof(void*)); | ||
|
||
this->process_event(func, params.data()); | ||
|
||
return ret; | ||
} | ||
|
||
glm::vec3 AActor::get_actor_location() { | ||
static const auto func = static_class()->find_function(L"K2_GetActorLocation"); | ||
|
||
struct { | ||
glm::vec3 result{}; | ||
} params; | ||
|
||
this->process_event(func, ¶ms); | ||
|
||
return params.result; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include "Math.hpp" | ||
|
||
#include "UClass.hpp" | ||
|
||
namespace sdk { | ||
class AActor : public UObject { | ||
public: | ||
static UClass* static_class(); | ||
|
||
// it takes a hit result as out param but we dont care. | ||
bool set_actor_location(const glm::vec3& location, bool sweep, bool teleport); | ||
glm::vec3 get_actor_location(); | ||
|
||
protected: | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "UObjectArray.hpp" | ||
|
||
#include "APawn.hpp" | ||
|
||
namespace sdk { | ||
UClass* APawn::static_class() { | ||
return sdk::find_uobject<UClass>(L"Class /Script/Engine.Pawn"); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include "AActor.hpp" | ||
|
||
namespace sdk { | ||
class APawn : public AActor { | ||
public: | ||
static UClass* static_class(); | ||
|
||
protected: | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters