| 31 |
|
if(1) |
| 32 |
|
{ |
| 33 |
|
memcpy( DataPointer, &PI->InputFromClient, sizeof(PlayerInput)); |
| 34 |
< |
PI->InputFromClient = PI->Input; |
| 34 |
> |
PI->Input = PI->InputFromClient; |
| 35 |
|
|
| 36 |
|
FLAG_AND_INCREMENT( PFlag_Input ); |
| 37 |
|
} |
| 98 |
|
|
| 99 |
|
if(APlayer) |
| 100 |
|
{ |
| 101 |
< |
if( memcmp(&PI->Position, &APlayer->PhyContext->Position, sizeof(Vector3)) ) |
| 101 |
> |
if( (APlayer->PhyContext) && memcmp(&PI->Position, &APlayer->PhyContext->Position, sizeof(Vector3)) ) |
| 102 |
|
{ |
| 103 |
|
Vector3* ptr = (Vector3*)DataPointer; |
| 104 |
|
*ptr = PI->Position = APlayer->PhyContext->Position; |
| 108 |
|
|
| 109 |
|
if(APlayer->Animation != PI->Animation) |
| 110 |
|
{ |
| 111 |
< |
sprintf_s( DataPointer, 32, "%s", TMrInstance_GetInstanceName( PI->Animation ) ); |
| 111 |
> |
sprintf_s( DataPointer, 32, "%s", TMrInstance_GetInstanceName( APlayer->Animation ) ); |
| 112 |
|
PI->Animation = APlayer->Animation; |
| 113 |
|
|
| 114 |
|
FLAG_AND_INCREMENT( PFlag_Animation ); |
| 136 |
|
} |
| 137 |
|
} |
| 138 |
|
|
| 139 |
< |
PD->Size = (char)DataPointer - (char)PD; |
| 139 |
> |
PD->Size = (uint32_t)DataPointer - (uint32_t)PD; |
| 140 |
|
|
| 141 |
|
PI->UpdateFlags = PD->UpdateFlags; |
| 142 |
|
|
| 167 |
|
|
| 168 |
|
assert( BuildData[p].Size < 255 ); |
| 169 |
|
|
| 170 |
< |
//If we hit maximum size, send the packet and reset the buffer for a new one |
| 171 |
< |
if( BuildData[p].Size + PacketSize > max_packet_size ) |
| 170 |
> |
if( BuildData[p].Size > 0 ) |
| 171 |
|
{ |
| 172 |
< |
UDPServer_SendToAll(&OutputPacket, PacketSize + FLATLINE_HEADER); |
| 173 |
< |
|
| 174 |
< |
memset( OutputPacket.data, 0, PacketSize ); |
| 175 |
< |
OutputPointer = OutputPacket.data; |
| 176 |
< |
PacketSize = 0; |
| 172 |
> |
|
| 173 |
> |
//If we hit maximum size, send the packet and reset the buffer for a new one |
| 174 |
> |
if( BuildData[p].Size + PacketSize > max_packet_size ) |
| 175 |
> |
{ |
| 176 |
> |
UDPServer_SendToAll(&OutputPacket, PacketSize + FLATLINE_HEADER); |
| 177 |
> |
|
| 178 |
> |
memset( OutputPacket.data, 0, PacketSize ); |
| 179 |
> |
OutputPointer = OutputPacket.data; |
| 180 |
> |
PacketSize = 0; |
| 181 |
> |
} |
| 182 |
> |
|
| 183 |
> |
//add to the packet |
| 184 |
> |
memcpy( OutputPointer, &BuildData[p], BuildData[p].Size ); |
| 185 |
> |
|
| 186 |
> |
OutputPointer += BuildData[p].Size; |
| 187 |
> |
PacketSize += BuildData[p].Size; |
| 188 |
|
} |
| 179 |
– |
|
| 180 |
– |
//add to the packet |
| 181 |
– |
memcpy( OutputPointer, &BuildData[p], BuildData[p].Size ); |
| 182 |
– |
|
| 183 |
– |
OutputPointer += BuildData[p].Size; |
| 184 |
– |
PacketSize += BuildData[p].Size; |
| 189 |
|
} |
| 190 |
|
} |
| 191 |
|
//Send data |