Advertisement
tm512

Untitled

Aug 18th, 2011
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. // Tell our clients to spawn a mobj
  2. // Currently only used for the item respawn queue in -altdeath and -newdeath
  3. void SV_SpawnMobj (mobj_t *mo)
  4. {
  5. ENetPacket *pk = enet_packet_create (NULL, 19, ENET_PACKET_FLAG_RELIABLE);
  6. void *p = pk->data;
  7.  
  8. WriteUInt8((uint8_t**)&p, MSG_SMOBJ);
  9. WriteInt32((int32_t**)&p, mo->x);
  10. WriteInt32((int32_t**)&p, mo->y);
  11. WriteInt32((int32_t**)&p, mo->z);
  12. WriteUInt16((uint16_t**)&p, (uint16_t)mo->type);
  13. WriteUInt16((uint16_t**)&p, (uint16_t)mo->state);
  14. WriteUInt16((uint16_t**)&p, mo->netid);
  15.  
  16. printf ("%i, %i, %i, %i, %i, %i\n",
  17. mo->x, mo->y, mo->z, mo->type, mo->state, mo->netid);
  18.  
  19. SV_BroadcastPacket(pk, -1);
  20. return;
  21. }
  22.  
  23. CLIENTSIDE:
  24.  
  25.  
  26. case MSG_SMOBJ:
  27. {
  28. mobj_t *mo;
  29. statenum_t st;
  30. mo = P_SpawnMobj (
  31. (fixed_t)ReadInt32((int32_t**)&p),
  32. (fixed_t)ReadInt32((int32_t**)&p),
  33. (fixed_t)ReadInt32((int32_t**)&p),
  34. (mobjtype_t)ReadUInt16((uint16_t**)&p));
  35.  
  36. if ((st = ReadUInt16((uint16_t**)&p)) < NUMSTATES)
  37. P_SetMobjState(mo, (statenum_t)st);
  38.  
  39. mo->netid = ReadUInt16((uint16_t**)&p);
  40. printf ("%i, %i, %i, %i, %i, %i\n",
  41. mo->x, mo->y, mo->z, mo->type, mo->state, mo->netid);
  42.  
  43. break;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement