Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.92 KB | None | 0 0
  1. void Wrath::EngineStudio::StudioDrawPoints(void)
  2. {
  3.     cl_entity_t *pEnt = g_OrigStudio.GetCurrentEntity();
  4.  
  5.     // Check if its our ineye weapon
  6.     if (strstr(pEnt->model->name, "v_"))
  7.     {
  8.         // Get studio header
  9.         studiohdr_t *pStudioHdr = (studiohdr_t*)g_OrigStudio.Mod_Extradata(pEnt->model);
  10.  
  11.         for (int i = 0; i < pStudioHdr->numbodyparts; ++i)
  12.         {
  13.             // Get bodypart and submodel of it
  14.             mstudiobodyparts_t *pBodyPart = (mstudiobodyparts_t*)((byte*)pStudioHdr + pStudioHdr->bodypartindex) + i;
  15.             mstudiomodel_t *pSubModel = (mstudiomodel_t*)((byte*)pStudioHdr + pBodyPart->modelindex);
  16.  
  17.             // Knife and famas only has studio as bodypart, while rest has rhand and lhand bodyparts. So get them with models.
  18.             bool bKnife = strstr(pEnt->model->name, "knife") != NULL;
  19.             bool bFamas = strstr(pEnt->model->name, "famas") != NULL;
  20.             bool bStudio = strstr(pBodyPart->name, "studio") != NULL;
  21.  
  22.             // If its our hands, dont draw.
  23.             if (strstr(pBodyPart->name, "rhand") || strstr(pBodyPart->name, "lhand")) continue;
  24.  
  25.             // Famas and knife, doesnt have rhand & lhand bodyparts, so remove vertices (ty shad0w & b2k5)
  26.             if (bStudio && (bKnife || bFamas))
  27.             {
  28.                 for (int x = 0; x < pBodyPart->nummodels; x++)
  29.                 {
  30.                     byte* pVertBone = (byte*)((byte*)pStudioHdr + pSubModel[x].vertinfoindex); // Get sub model vertice info
  31.  
  32.                     for (int j = 0; j < pSubModel[x].numverts; j++) // Loop through vertices and remove hands
  33.                         if ((bKnife && pVertBone[j] != 38) || (bFamas && pVertBone[j] != 45 && pVertBone[j] != 47 && pVertBone[j] != 49 && pVertBone[j] != 51))
  34.                             ((Vector*)((byte*)pStudioHdr + pSubModel[x].vertindex))[j][2] -= 100000;
  35.                 }
  36.             }
  37.  
  38.             // Setup model and call drawing pts (draw weapon)
  39.             g_OrigStudio.StudioSetupModel(i, (void**)&pBodyPart, (void**)&pSubModel);
  40.             g_OrigStudio.StudioDrawPoints();
  41.         }
  42.  
  43.         return; // Dont call original if its our ineye weapon
  44.     }
  45.  
  46.     g_OrigStudio.StudioDrawPoints();
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement