| 8 |
|
|
| 9 |
|
//Long winded? |
| 10 |
|
|
| 11 |
+ |
|
| 12 |
+ |
|
| 13 |
|
void FLcPacketBufferToPlayerData( PlayerData* PD) |
| 14 |
|
{ |
| 15 |
|
player_info* PI = PlayerList[PD->ID]; |
| 16 |
|
uint8_t * DataPointer = PD->data; |
| 17 |
|
|
| 18 |
+ |
static player_info BufferData[MAX_PLAYERS] = {0}; |
| 19 |
+ |
static bool IsBuffered[32]; |
| 20 |
+ |
|
| 21 |
+ |
|
| 22 |
|
if(!PI) |
| 23 |
|
{ |
| 24 |
|
//TODO: Store this data and then apply it once we have a character that matches! |
| 25 |
< |
return; |
| 25 |
> |
flatline_packet pk; |
| 26 |
> |
pk.id = PK_MISSING_PLAYER; |
| 27 |
> |
pk.integer = PD->ID; |
| 28 |
> |
NetUDPSocket_Send(client_sock, (sockaddr*)&address, (char*)&pk, FLATLINE_HEADER + 4 ); |
| 29 |
> |
|
| 30 |
> |
IsBuffered[PD->ID] = 1; |
| 31 |
> |
PI = &BufferData[PD->ID]; |
| 32 |
> |
|
| 33 |
> |
//return; |
| 34 |
> |
} |
| 35 |
> |
else if(IsBuffered[PD->ID]) |
| 36 |
> |
{ |
| 37 |
> |
player_info* Buffer = BufferData + PD->ID; |
| 38 |
> |
if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Input) ) PI->Input = Buffer->Input; |
| 39 |
> |
if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Facing) ) PI->Facings = Buffer->Facings; |
| 40 |
> |
if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Health) ) PI->Health = Buffer->Health; |
| 41 |
> |
if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_FramePing) ) { |
| 42 |
> |
PI->Frame = Buffer->Frame; |
| 43 |
> |
PI->Ping = Buffer->Ping; |
| 44 |
> |
} |
| 45 |
> |
//if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Inventory) ) PI->invi= Buffer->Input; |
| 46 |
> |
if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Class) ) |
| 47 |
> |
{ |
| 48 |
> |
PI->Class = Buffer->Class; |
| 49 |
> |
sprintf_s( PI->ClassString, 32, "%s", Buffer->ClassString ); |
| 50 |
> |
} |
| 51 |
> |
|
| 52 |
> |
if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Position) ) PI->Position = Buffer->Position; |
| 53 |
> |
if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Animation) ) |
| 54 |
> |
{ |
| 55 |
> |
PI->Animation = Buffer->Animation; |
| 56 |
> |
sprintf_s( PI->AnimationString, 32, "%s", Buffer->AnimationString); |
| 57 |
> |
} |
| 58 |
> |
if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Throws) ) PI->ThrowData = Buffer->ThrowData; |
| 59 |
> |
|
| 60 |
> |
PI->UpdateFlags |= Buffer->UpdateFlags; |
| 61 |
> |
IsBuffered[PD->ID] = 0; |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
if( DoWeUpdateThis( PD->UpdateFlags, PFlag_Input) ) |
| 111 |
|
|
| 112 |
|
if( DoWeUpdateThis( PD->UpdateFlags, PFlag_Class ) ) |
| 113 |
|
{ |
| 114 |
< |
TMrInstance_GetDataPtr( 'ONCC', (char*)DataPointer, &PI->Class ); |
| 114 |
> |
sprintf_s( PI->ClassString, 32, "%s", DataPointer ); |
| 115 |
> |
TMrInstance_GetDataPtr( 'ONCC', (char*)DataPointer, &PI->Class ); |
| 116 |
|
DataPointer += FLpData_PartSize( PFlag_Class ); |
| 117 |
|
} |
| 118 |
|
|
| 124 |
|
|
| 125 |
|
if( DoWeUpdateThis( PD->UpdateFlags, PFlag_Animation ) ) |
| 126 |
|
{ |
| 127 |
< |
TMrInstance_GetDataPtr( 'TRAM', (char*)DataPointer, &PI->Animation ); |
| 127 |
> |
sprintf_s( PI->AnimationString, 32, "%s", DataPointer ); |
| 128 |
> |
TMrInstance_GetDataPtr( 'TRAM', PI->AnimationString, &PI->Animation ); |
| 129 |
|
DataPointer += FLpData_PartSize( PFlag_Animation ); |
| 130 |
|
} |
| 131 |
|
|