This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
Thanks Ken with m_pCurrentEntity->curstate.skin it'll works fine
Ok to change the skin of a w_ model I must check first for the models name
so it'll only change the w_ model skin but it works !!

Ok everybody who wants to know how it works here an example:

to change the p_ model skin search for the following in StudioModelRenderer.cpp

  if (pplayer->weaponmodel)
  {
   cl_entity_t saveent = *m_pCurrentEntity;

   model_t *pweaponmodel = IEngineStudio.GetModelByIndex( pplayer->weaponmodel );

   m_pStudioHeader = (studiohdr_t *)IEngineStudio.Mod_Extradata (pweaponmodel);
   IEngineStudio.StudioSetHeader( m_pStudioHeader );

   StudioMergeBones( pweaponmodel);

   IEngineStudio.StudioSetupLighting (&lighting);

   StudioRenderModel( );

   StudioCalcAttachments( );

   *m_pCurrentEntity = saveent;
  }

and change it to this :

  if (pplayer->weaponmodel)
  {
   cl_entity_t saveent = *m_pCurrentEntity;

   model_t *pweaponmodel = IEngineStudio.GetModelByIndex( pplayer->weaponmodel );

   if(cl_weaponskin == 0)
           m_pCurrentEntity->curstate.skin = 1; // this will change the p_ model skin 
immediately to skin no 1 after setting cl_weaponskin 0
   else
           m_pCurrentEntity->curstate.skin = 0; // this will change the p_ model skin 
immediately to skin no 0 after setting cl_weaponskin 1 (or anything else than 0 )

   m_pStudioHeader = (studiohdr_t *)IEngineStudio.Mod_Extradata (pweaponmodel);
   IEngineStudio.StudioSetHeader( m_pStudioHeader );

   StudioMergeBones( pweaponmodel);

   IEngineStudio.StudioSetupLighting (&lighting);

   StudioRenderModel( );

   StudioCalcAttachments( );

   *m_pCurrentEntity = saveent;
  }

ok for the w_ models go to int CStudioModelRenderer::StudioDrawModel( int flags )
and find this lines:

 if (flags & STUDIO_RENDER)
 {
  lighting.plightvec = dir;
  IEngineStudio.StudioDynamicLight(m_pCurrentEntity, &lighting );

  IEngineStudio.StudioEntityLight( &lighting );

  // model and frame independant
  IEngineStudio.StudioSetupLighting (&lighting);

  // get remap colors
  m_nTopColor = m_pCurrentEntity->curstate.colormap & 0xFF;
  m_nBottomColor = (m_pCurrentEntity->curstate.colormap & 0xFF00) >> 8;

  IEngineStudio.StudioSetRemapColors( m_nTopColor, m_nBottomColor );

  StudioRenderModel( );
 }


than change it for example to the following:

 if (flags & STUDIO_RENDER)
 {
  lighting.plightvec = dir;
  IEngineStudio.StudioDynamicLight(m_pCurrentEntity, &lighting );

  // check if m_pCurrentEntity Modelname w_glock.mdl is, if so change the skin of 
it....
  if ( strstr ( m_pCurrentEntity->model->name, "w_glock.mdl" ) )
   m_pCurrentEntity->curstate.skin = 1;

  IEngineStudio.StudioEntityLight( &lighting );

  // model and frame independant
  IEngineStudio.StudioSetupLighting (&lighting);

  // get remap colors
  m_nTopColor = m_pCurrentEntity->curstate.colormap & 0xFF;
  m_nBottomColor = (m_pCurrentEntity->curstate.colormap & 0xFF00) >> 8;

  IEngineStudio.StudioSetRemapColors( m_nTopColor, m_nBottomColor );

  StudioRenderModel( );
 }


Thats it

Cya and THX again
--

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to