本文整理汇总了C++中PlayerPtr::SetRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPtr::SetRotation方法的具体用法?C++ PlayerPtr::SetRotation怎么用?C++ PlayerPtr::SetRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPtr
的用法示例。
在下文中一共展示了PlayerPtr::SetRotation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DetectPlayers
void MemorySensor::DetectPlayers() {
uintptr_t addr = Memory::GetU32(m_ProcessHandle, m_ContBaseAddr + 0xC1AFC); // Starting address
addr += 0x127EC;
uintptr_t count_addr = addr + 0x1884;
uintptr_t players_addr = addr + 0x884;
unsigned short count = Memory::GetU32(m_ProcessHandle, count_addr) & 0xFFFF;
const unsigned char NameOffset = 0x6D;
const unsigned char FreqOffset = 0x58;
const unsigned char RotOffset = 0x3C;
const unsigned char PosOffset = 0x04;
const unsigned char SpeedOffset = 0x10;
const unsigned char IDOffset = 0x18;
const unsigned char ShipOffset = 0x5C;
for (auto kv : m_Players)
kv.second->SetInArena(false);
for (unsigned short i = 0; i < count; ++i) {
uintptr_t player_addr = Memory::GetU32(m_ProcessHandle, players_addr + (i * 4));
if (player_addr == 0) continue;
short x = Memory::GetU32(m_ProcessHandle, player_addr + PosOffset) / 1000;
short y = Memory::GetU32(m_ProcessHandle, player_addr + PosOffset + 4) / 1000;
int xspeed = static_cast<int>(Memory::GetU32(m_ProcessHandle, player_addr + SpeedOffset)) / 10;
int yspeed = static_cast<int>(Memory::GetU32(m_ProcessHandle, player_addr + SpeedOffset + 4)) / 10;
unsigned short rot = Memory::GetU32(m_ProcessHandle, player_addr + RotOffset) / 1000;
unsigned int freq = Memory::GetU32(m_ProcessHandle, player_addr + FreqOffset);
unsigned short pid = Memory::GetU32(m_ProcessHandle, player_addr + IDOffset);
unsigned short ship = Memory::GetU32(m_ProcessHandle, player_addr + ShipOffset);
std::string name = Memory::GetString(m_ProcessHandle, player_addr + NameOffset, 23);
name = name.substr(0, strlen(name.c_str())); // trim nulls
PlayerPtr player;
auto found = m_Players.find(pid);
if (found == m_Players.end()) {
player = std::make_shared<Player>();
m_Players[pid] = player;
} else {
player = found->second;
}
x = (short)std::max(std::min((int)x, 1023 * 16), 0);
y = (short)std::max(std::min((int)y, 1023 * 16), 0);
player->SetInArena(true);
player->SetName(name);
player->SetFreq(freq);
player->SetRotation(rot);
player->SetPosition(Vec2(x, y));
player->SetVelocity(Vec2(xspeed, yspeed));
player->SetPid(pid);
player->SetShip(static_cast<Ship>(ship));
}
for (auto iter = m_Players.begin(); iter != m_Players.end(); ) {
if (!iter->second->InArena()) {
//std::cout << "Erasing " << iter->second->GetName() << std::endl;
iter = m_Players.erase(iter);
} else {
++iter;
}
}
}