Advertisement
dcomicboy

hitbox

Mar 19th, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1.  
  2. //Hit Box modifications
  3. void CCharacter::UpdateHitBox()
  4. {
  5. if (!m_hHitBox) return;
  6.  
  7. CCharacterHitBox* pHitBox = (CCharacterHitBox*) g_pLTServer->HandleToObject(m_hHitBox);
  8. if (pHitBox)
  9. {
  10. pHitBox->Update();
  11. }
  12. }
  13.  
  14.  
  15. void CCharacter::UpdateClientHitBox()
  16. {
  17. if (m_hHitBox == INVALID_HOBJECT)
  18. return;
  19.  
  20. LTVector vHitDims, vHitOffset(0.0f, 0.0f, 0.0f);
  21. g_pPhysicsLT->GetObjectDims(m_hHitBox, &vHitDims);
  22.  
  23. bool bCanBeSearched = false;
  24.  
  25. CCharacterHitBox* pHitBox = dynamic_cast<CCharacterHitBox*>(g_pLTServer->HandleToObject(m_hHitBox));
  26. if (pHitBox)
  27. {
  28. vHitOffset = pHitBox->GetOffset();
  29. bCanBeSearched = pHitBox->CanBeSearched();
  30. }
  31.  
  32. // Send the hitbox message
  33. CAutoMessage cMsg;
  34. cMsg.Writeuint8(MID_SFX_MESSAGE);
  35. cMsg.Writeuint8(SFX_CHARACTER_ID);
  36. cMsg.WriteObject(m_hObject);
  37. cMsg.Writeuint8(CFX_HITBOX_MSG);
  38. cMsg.WriteCompLTVector( vHitDims );
  39. cMsg.WriteCompLTVector( vHitOffset );
  40. cMsg.Writebool( bCanBeSearched );
  41. g_pLTServer->SendToClient(cMsg.Read(), LTNULL, MESSAGE_GUARANTEED);
  42.  
  43. // Update the SFX
  44. CreateSpecialFX();
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement