Advertisement
dcomicboy

weapon change

Mar 7th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. void CPlayerMgr::HandleWeaponChanged(uint8 nWeaponId, uint8 nAmmoId, bool bImmediateSwitch)
  2. {
  3. // Turn off zooming...
  4. HandleZoomChange( LTTRUE );
  5.  
  6. // Tell the server to change weapons...
  7. LTRESULT ltResult;
  8. CAutoMessage cMsg;
  9. cMsg.Writeuint8( MID_WEAPON_CHANGE );
  10.  
  11. cMsg.Writeuint8( nWeaponId );
  12. cMsg.Writeuint8( nAmmoId );
  13.  
  14. ltResult = g_pLTClient->SendToServer( cMsg.Read(), MESSAGE_GUARANTEED );
  15. ASSERT( LT_OK == ltResult );
  16.  
  17. // this isn't strictly necessary, the hide should have been
  18. // called when we entered the chase view
  19. if ( m_pPlayerCamera->IsChaseView() )
  20. {
  21. m_pClientWeaponMgr->HideWeapons();
  22. }
  23.  
  24. //shutdown the weapon or ammo choosers...
  25. g_pInterfaceMgr->CloseChoosers();
  26.  
  27. //when the swicth is complete...
  28. if (bImmediateSwitch)
  29. {
  30. //if we are changing to a gadget, we're done switching
  31. if (m_bChangingToGadget)
  32. {
  33. m_bChangingToGadget = false;
  34. }
  35. else
  36. {
  37. //we are not changing to a gadget, so forget about any gadget related stuff...
  38. if (m_nPreGadgetWeapon != WMGR_INVALID_ID )
  39. {
  40. m_nPreGadgetWeapon = WMGR_INVALID_ID;
  41. }
  42. }
  43. }
  44.  
  45. m_bSwitchingWeapons = !bImmediateSwitch;
  46. }
  47.  
  48. oid CPlayerObj::ChangeWeapon(uint8 nCommandId, LTBOOL bAuto, int32 nAmmoId)
  49. {
  50. if (!GetClient( )) return;
  51.  
  52. CAutoMessage cMsg;
  53. cMsg.Writeuint8(MID_WEAPON_CHANGE);
  54. cMsg.Writeuint8(nCommandId);
  55. cMsg.Writeuint8(bAuto);
  56. cMsg.Writefloat((LTFLOAT)nAmmoId);
  57. g_pLTServer->SendToClient(cMsg.Read( ), GetClient( ), MESSAGE_GUARANTEED);
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement