Advertisement
dcomicboy

populatecreate struct

Jul 5th, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. void CClientWeapon::PopulateCreateStruct( ObjectCreateStruct *pOCS ) const
  2. {
  3. // sanity check parameters
  4. ASSERT( 0 != pOCS );
  5.  
  6. // sanity check globals
  7. ASSERT( 0 != g_pModelButeMgr );
  8. ASSERT( 0 != g_pCommonLT );
  9. ASSERT( 0 != g_pLTClient );
  10. ASSERT( 0 != g_pPlayerMgr );
  11.  
  12. // sanity check this object
  13. ASSERT( 0 != m_pWeapon );
  14.  
  15. // get the model filename
  16. SAFE_STRCPY( pOCS->m_Filename, m_pWeapon->szPVModel );
  17.  
  18. // add the skins
  19. m_pWeapon->blrPVSkins.CopyList( 0, pOCS->m_SkinNames[0], ( MAX_CS_FILENAME_LEN + 1 ) );
  20.  
  21. // add the render styles
  22. m_pWeapon->blrPVRenderStyles.CopyList( 0, pOCS->m_RenderStyleNames[ 0 ], ( MAX_CS_FILENAME_LEN + 1 ) );
  23.  
  24. // Figure out what hand skin to use...
  25. ASSERT( g_pPlayerMgr->GetMoveMgr() );
  26. CCharacterFX* pCharFX = g_pPlayerMgr->GetMoveMgr()->GetCharacterFX();
  27.  
  28. if ( ( m_pWeapon->blrPVSkins.GetNumItems() ) &&
  29. ( 0 == strcmp( m_pWeapon->blrPVSkins.GetItem( 0 ), "Hands" ) ) )
  30. {
  31. // This looks for the special case where "Hands" is specified as the first
  32. // player view skin. If it is, then we take the skin from the model bute
  33. // instead of the weapon bute.
  34. ModelId nModelID = ( pCharFX ) ? pCharFX->GetModelId() : static_cast< ModelId >( 0 );
  35. SAFE_STRCPY( pOCS->m_SkinNames[ 0 ], g_pModelButeMgr->GetHandsSkinFilename( nModelID ) );
  36. }
  37.  
  38. // Create the weapon at it's actual position...
  39.  
  40. LTVector vWeaponOffset = GetWeaponOffset();
  41.  
  42. pOCS->m_Pos.x = vWeaponOffset.x + m_fBobWidth;
  43. pOCS->m_Pos.y = vWeaponOffset.y + m_fBobHeight;
  44. pOCS->m_Pos.z = vWeaponOffset.z;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement