Small performance tweaks

- Tweaked reader to only read head part of bones when using only head tracker
This commit is contained in:
ifBars
2023-11-13 21:08:00 -07:00
parent af903ff33c
commit 90f6b16616
2 changed files with 21 additions and 4 deletions
+19 -3
View File
@@ -156,6 +156,12 @@ void CGame::loop() {
player.ReadBones();
}
if (config::show_head_tracker && !config::show_skeleton_esp) {
player.gameSceneNode = process->read<uint64_t>(player.pCSPlayerPawn + 0x310);
player.boneArray = process->read<uint64_t>(player.gameSceneNode + 0x160 + 0x80);
player.ReadHead();
}
if (config::show_extra_flags) {
/*
* Reading values for extra flags is now seperated from the other reads
@@ -187,12 +193,22 @@ void CGame::loop() {
players.assign(list.begin(), list.end());
}
uintptr_t boneAddress;
Vector3 bonePosition;
int boneIndex;
void CPlayer::ReadHead() {
boneAddress = boneArray + 6 * 32;
bonePosition = g_game.process->read<Vector3>(boneAddress);
bones.bonePositions["head"] = g_game.world_to_screen(&bonePosition);
}
void CPlayer::ReadBones() {
for (const auto& entry : boneMap) {
const std::string& boneName = entry.first;
int boneIndex = entry.second;
uintptr_t boneAddress = boneArray + boneIndex * 32;
Vector3 bonePosition = g_game.process->read<Vector3>(boneAddress);
boneIndex = entry.second;
boneAddress = boneArray + boneIndex * 32;
bonePosition = g_game.process->read<Vector3>(boneAddress);
bones.bonePositions[boneName] = g_game.world_to_screen(&bonePosition);
}
}
+1
View File
@@ -44,6 +44,7 @@ public:
float flashAlpha;
std::string weapon;
void ReadBones();
void ReadHead();
};
class CGame