MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / HandlePlayerPush

Method HandlePlayerPush

Sources/Jazz2/Multiplayer/MpLevelHandler.cpp:1255–1271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1253 }
1254
1255 bool MpLevelHandler::HandlePlayerPush(Actors::Player* player, float pushSpeedX)
1256 {
1257 // TODO: Only called by RemotePlayerOnServer
1258 if (_isServer) {
1259 auto* mpPlayer = static_cast<MpPlayer*>(player);
1260 auto peerDesc = mpPlayer->GetPeerDescriptor();
1261
1262 if (peerDesc->RemotePeer) {
1263 MemoryStream packet(8);
1264 packet.WriteVariableUint32(mpPlayer->_playerIndex);
1265 packet.WriteValue<std::int32_t>((std::int32_t)(pushSpeedX * 512.0f));
1266 _networkManager->SendTo(peerDesc->RemotePeer, NetworkChannel::Main, (std::uint8_t)ServerPacketType::PlayerPush, packet);
1267 }
1268 }
1269
1270 return true;
1271 }
1272
1273 bool MpLevelHandler::HandlePlayerSpring(Actors::Player* player, Vector2f pos, Vector2f force, bool keepSpeedX, bool keepSpeedY)
1274 {

Callers 1

OnPushSolidObjectMethod · 0.80

Calls 3

WriteVariableUint32Method · 0.80
SendToMethod · 0.80
GetPeerDescriptorMethod · 0.45

Tested by

no test coverage detected