Advertisement
Guest User

Untitled

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