Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void __fastcall Hooked_DrawModelExecute(void* thisptr, int edx, void* ctx, void* state, const ModelRenderInfo_t &pInfo, matrix3x4 *pCustomBoneToWorld, IClientEntity* pEntity)
- {
- Color color;
- float flColor[3] = { 0.f };
- static IMaterial* CoveredLit = CreateMaterial(true);
- static IMaterial* OpenLit = CreateMaterial(false);
- static IMaterial* CoveredFlat = CreateMaterial(true, false);
- static IMaterial* OpenFlat = CreateMaterial(false, false);
- bool DontDraw = false;
- const char* ModelName = Interfaces::ModelInfo->GetModelName((model_t*)pInfo.pModel);
- IClientEntity* pModelEntity = (IClientEntity*)Interfaces::EntList->GetClientEntity(pInfo.entity_index);
- IClientEntity* pLocal = (IClientEntity*)Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
- //float h = (size.h);
- int HPEnemy = 100;
- //float offset = (h / 4.f) + 5;
- //float w = h / 64.f;
- float health = pEntity->GetHealth();
- //UINT hp = h - (UINT)((h * health) / 100);
- int Red = 255 - (health*2.55);
- int Green = health*2.55;
- {
- // Player Chams
- int ChamsStyle = Menu::Window.VisualsTab.OptionsChams.GetIndex();
- int HandsStyle = Menu::Window.VisualsTab.OtherNoHands.GetIndex();
- if (ChamsStyle != 0 && Menu::Window.VisualsTab.FiltersPlayers.GetState() && strstr(ModelName, "models/player"))
- {
- if (pLocal /* && (!Menu::Window.VisualsTab.FiltersEnemiesOnly.GetState() || pModelEntity->GetTeamNum() != pLocal->GetTeamNum())*/)
- {
- IMaterial *covered = ChamsStyle == 1 ? CoveredLit : CoveredFlat;
- IMaterial *open = ChamsStyle == 1 ? OpenLit : OpenFlat;
- IClientEntity* pModelEntity = (IClientEntity*)Interfaces::EntList->GetClientEntity(pInfo.entity_index);
- if (pModelEntity)
- {
- IClientEntity *local = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
- if (local)
- {
- if (pModelEntity->IsAlive() && pModelEntity->GetHealth() > 0 /*&& pModelEntity->GetTeamNum() != local->GetTeamNum()*/)
- {
- float alpha = 1.f;
- if (pModelEntity->HasGunGameImmunity())
- alpha = 0.5f;
- if (pModelEntity->GetTeamNum() == 2)
- {
- flColor[0] = 255.f / 255.f; 255.f / 255.f;
- flColor[2] = 35.f / 255.f;
- }
- else
- {
- flColor[0] = 255.f / 255.f;
- flColor[1] = 255.f / 255.f;
- flColor[2] = 205.f / 255.f;
- }
- Interfaces::RenderView->SetColorModulation(flColor);
- Interfaces::RenderView->SetBlend(alpha);
- Interfaces::ModelRender->ForcedMaterialOverride(covered);
- oDrawModelExecute(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
- if (pModelEntity->GetTeamNum() == 2)
- {
- flColor[0] = 255.f / 255.f;
- flColor[1] = 255.f / 255.f;
- flColor[2] = 0.f / 255.f;
- }
- else
- {
- flColor[0] = 0.f / 255.f;
- flColor[1] = 255.f / 255.f;
- flColor[2] = 100.f / 255.f;
- }
- Interfaces::RenderView->SetColorModulation(flColor);
- Interfaces::RenderView->SetBlend(alpha);
- Interfaces::ModelRender->ForcedMaterialOverride(open);
- }
- else
- {
- color.SetColor(255, 255, 255, 255);
- ForceMaterial(color, open);
- }
- }
- }
- }
- }
- else if (HandsStyle != 0 && strstr(ModelName, "arms"))
- {
- if (HandsStyle == 1)
- {
- DontDraw = true;
- }
- else if (HandsStyle == 2)
- {
- Interfaces::RenderView->SetBlend(0.3);
- }
- else if (HandsStyle == 3)
- {
- IMaterial *covered = ChamsStyle == 1 ? CoveredLit : CoveredFlat;
- IMaterial *open = ChamsStyle == 1 ? OpenLit : OpenFlat;
- if (pLocal)
- {
- if (pLocal->IsAlive())
- {
- int alpha = pLocal->HasGunGameImmunity() ? 150 : 255;
- if (pLocal->GetTeamNum() == 2)
- color.SetColor(240, 30, 35, alpha);
- else
- color.SetColor(63, 72, 205, alpha);
- ForceMaterial(color, covered);
- oDrawModelExecute(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
- if (pLocal->GetTeamNum() == 2)
- color.SetColor(247, 180, 20, alpha);
- else
- color.SetColor(32, 180, 57, alpha);
- }
- else
- {
- color.SetColor(255, 255, 255, 255);
- }
- ForceMaterial(color, open);
- }
- }
- else
- {
- static int counter = 0;
- static float colors[3] = { 1.f, 0.f, 0.f };
- if (colors[counter] >= 1.0f)
- {
- colors[counter] = 1.0f;
- counter += 1;
- if (counter > 2)
- counter = 0;
- }
- else
- {
- int prev = counter - 1;
- if (prev < 0) prev = 2;
- colors[prev] -= 0.05f;
- colors[counter] += 0.05f;
- }
- Interfaces::RenderView->SetColorModulation(colors);
- Interfaces::RenderView->SetBlend(0.3);
- Interfaces::ModelRender->ForcedMaterialOverride(OpenLit);
- }
- }
- else if (ChamsStyle != 0 && Menu::Window.VisualsTab.FiltersWeapons.GetState() && strstr(ModelName, "_dropped.mdl"))
- {
- IMaterial *covered = ChamsStyle == 1 ? CoveredLit : CoveredFlat;
- color.SetColor(255, 255, 255, 255);
- ForceMaterial(color, covered);
- }
- }
- if (!DontDraw)
- oDrawModelExecute(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
- Interfaces::ModelRender->ForcedMaterialOverride(NULL);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement