Prevent player position from updating when flying

Only chunk is updated instead to maintain visibility
This commit is contained in:
Gent 2020-09-24 18:43:58 -04:00
parent c33f218e56
commit db33ca2bbb
3 changed files with 9 additions and 4 deletions

View File

@ -183,7 +183,11 @@ void PlayerManager::updatePlayerPosition(CNSocket* sock, int X, int Y, int Z) {
view.plr->x = X; view.plr->x = X;
view.plr->y = Y; view.plr->y = Y;
view.plr->z = Z; view.plr->z = Z;
updatePlayerChunk(sock, X, Y);
}
void PlayerManager::updatePlayerChunk(CNSocket* sock, int X, int Y) {
PlayerView& view = players[sock];
std::pair<int, int> newPos = ChunkManager::grabChunk(X, Y); std::pair<int, int> newPos = ChunkManager::grabChunk(X, Y);
// nothing to be done // nothing to be done

View File

@ -32,6 +32,7 @@ namespace PlayerManager {
void updatePlayerPosition(CNSocket* sock, int X, int Y, int Z); void updatePlayerPosition(CNSocket* sock, int X, int Y, int Z);
void updatePlayerPosition(CNSocket* sock, int X, int Y, int Z, int angle); void updatePlayerPosition(CNSocket* sock, int X, int Y, int Z, int angle);
void updatePlayerChunk(CNSocket* sock, int X, int Y);
void sendToViewable(CNSocket* sock, void* buf, uint32_t type, size_t size); void sendToViewable(CNSocket* sock, void* buf, uint32_t type, size_t size);

View File

@ -238,7 +238,7 @@ void TransportManager::stepSkywaySystem() {
bmstk.iToZ = point.z; bmstk.iToZ = point.z;
it->first->sendPacket((void*)&bmstk, P_FE2CL_PC_BROOMSTICK_MOVE, sizeof(sP_FE2CL_PC_BROOMSTICK_MOVE)); it->first->sendPacket((void*)&bmstk, P_FE2CL_PC_BROOMSTICK_MOVE, sizeof(sP_FE2CL_PC_BROOMSTICK_MOVE));
// set player location to point to update viewables // set player location to point to update viewables
PlayerManager::updatePlayerPosition(it->first, point.x, point.y, point.z); PlayerManager::updatePlayerChunk(it->first, point.x, point.y);
// send packet to players in view // send packet to players in view
PlayerManager::sendToViewable(it->first, (void*)&bmstk, P_FE2CL_PC_BROOMSTICK_MOVE, sizeof(sP_FE2CL_PC_BROOMSTICK_MOVE)); PlayerManager::sendToViewable(it->first, (void*)&bmstk, P_FE2CL_PC_BROOMSTICK_MOVE, sizeof(sP_FE2CL_PC_BROOMSTICK_MOVE));