diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkprotocol.h | 2 | ||||
-rw-r--r-- | src/network/serverpackethandler.cpp | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/network/networkprotocol.h b/src/network/networkprotocol.h index e3fcae0c6..c9919e1c4 100644 --- a/src/network/networkprotocol.h +++ b/src/network/networkprotocol.h @@ -651,6 +651,8 @@ enum ToServerCommand [2+12+12] s32 pitch*100 [2+12+12+4] s32 yaw*100 [2+12+12+4+4] u32 keyPressed + [2+12+12+4+4+1] u8 fov*80 + [2+12+12+4+4+4+1] u8 wanted_range / MAP_BLOCKSIZE */ TOSERVER_GOTBLOCKS = 0x24, diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index 70eb0a828..5e50bb865 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -782,6 +782,7 @@ void Server::process_PlayerPos(RemotePlayer *player, PlayerSAO *playersao, v3s32 ps, ss; s32 f32pitch, f32yaw; + u8 f32fov; *pkt >> ps; *pkt >> ss; @@ -792,8 +793,18 @@ void Server::process_PlayerPos(RemotePlayer *player, PlayerSAO *playersao, f32 yaw = (f32)f32yaw / 100.0; u32 keyPressed = 0; + // default behavior (in case an old client doesn't send these) + f32 fov = (72.0*M_PI/180) * 4./3.; + u8 wanted_range = 0; + if (pkt->getRemainingBytes() >= 4) *pkt >> keyPressed; + if (pkt->getRemainingBytes() >= 1) { + *pkt >> f32fov; + fov = (f32)f32fov / 80.0; + } + if (pkt->getRemainingBytes() >= 1) + *pkt >> wanted_range; v3f position((f32)ps.X / 100.0, (f32)ps.Y / 100.0, (f32)ps.Z / 100.0); v3f speed((f32)ss.X / 100.0, (f32)ss.Y / 100.0, (f32)ss.Z / 100.0); @@ -805,6 +816,8 @@ void Server::process_PlayerPos(RemotePlayer *player, PlayerSAO *playersao, player->setSpeed(speed); playersao->setPitch(pitch); playersao->setYaw(yaw); + playersao->setFov(fov); + playersao->setWantedRange(wanted_range); player->keyPressed = keyPressed; player->control.up = (keyPressed & 1); player->control.down = (keyPressed & 2); |