//==================================================================================
#pragma comment(lib,"OpenGL32.lib")
#pragma warning(disable: 4311)
#pragma warning(disable: 4731)
//=============================headers=============================================
#include <windows.h>
#include <gl\gl.h>
#include "engine/wrect.h"
#include "engine/cl_dll.h"
#include "engine/r_efx.h"
#include "engine/studio.h"
#include "engine/triangleapi.h"
#include "misc/r_studioint.h"
//==============================vars==============================================
cl_enginefuncs_s *pEngfuncs = (cl_enginefuncs_s *)0x01EA0A08;
engine_studio_api_s *pEngstudio = (engine_studio_api_s *)0x01EBC978;
DWORD * pStudioRenderModel = (DWORD*)0x019CC8F8;
cl_entity_s* pCurrentEnt = NULL;
DWORD dwSP = 0;
void * pStudioRenderFinal = (void*)0x01969A00;
void xStudioRenderModel(void);
//======================================DllMain=======================================
BOOL APIENTRY DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved )
{
if( fdwReason == DLL_PROCESS_ATTACH )
{
*pStudioRenderModel = (DWORD)&xStudioRenderModel;
}
return TRUE;
}
//=====================================Cheat stuff=====================================
bool bIsEntPlayer(cl_entity_s *ent) // a player ?
{
if(ent != NULL && ent != pEngfuncs->GetLocalPlayer() && !(ent->curstate.effects & EF_NODRAW) && ent->player && !ent->curstate.spectator && ent->curstate.solid && !(ent->curstate.messagenum < pEngfuncs->GetLocalPlayer()->curstate.messagenum) /*&& ent->curstate.movetype !=0*/)
return true;
else
return false;
}
bool bIsEntGood(cl_entity_s * pLocalEnt,cl_entity_s* pEnt) // same Team ?
{
__asm
{
MOV EDX,DWORD PTR DS:[pEnt]
MOV EAX,DWORD PTR DS:[EDX]
IMUL EAX,EAX,0x68
MOV CX,WORD PTR DS:[EAX+0x01A2999A] // g_PlayerExtraInfo[index].Teamnumber
// cs uses it for the scoreboard
MOV EDX,DWORD PTR DS:[pLocalEnt]
MOV EAX,DWORD PTR DS:[EDX]
IMUL EAX,EAX,0x68
CMP CX,WORD PTR DS:[EAX+0x01A2999A] // g_PlayerExtraInfo[index].Teamnumber
JE __SameTeam
MOV AL,0
POP ESI
POP EBP
RET
__SameTeam:
MOV AL,1
}
}
bool bIsEntValid(cl_entity_s* pEnt) // valid ent?
{
if(bIsEntPlayer(pEnt))
{
if(bIsEntGood(pEngfuncs->GetLocalPlayer(),pEnt))
return false;
else
return true;
}
else
return false;
}
void xStudioRenderModel(void) // hooked studiorendermodel
{
_asm MOV dwSP,ECX
cl_entity_s* pCurrentEnt = pEngstudio->GetCurrentEntity();
if(bIsEntValid(pCurrentEnt))
{
//==============================================================
// Draw the non visible part of the Model
glDepthFunc(GL_GREATER);
pEngstudio->SetChromeOrigin();
pEngstudio->SetForceFaceFlags(STUDIO_NF_CHROME);
model_s * pChromeSprite = pEngstudio->GetChromeSprite();
pEngfuncs->pTriAPI->SpriteTexture(pChromeSprite,0);
pCurrentEnt->curstate.renderfx = kRenderFxGlowShell;
pCurrentEnt->curstate.renderamt = 1;
pCurrentEnt->curstate.rendercolor.r = 255;
pCurrentEnt->curstate.rendercolor.g = 0;
pCurrentEnt->curstate.rendercolor.b = 0;
_asm MOV ECX,dwSP
_asm CALL DWORD PTR DS:[pStudioRenderFinal] // StudioRenderFinal
//==============================================================
// Draw the visible part of the Model
glDepthFunc(GL_LESS);
pCurrentEnt->curstate.renderfx = kRenderFxNone;
pEngstudio->SetForceFaceFlags(0);
_asm MOV ECX,dwSP
_asm CALL DWORD PTR DS:[pStudioRenderFinal] // StudioRenderFinal
//==============================================================
}
else
{
pEngstudio->SetForceFaceFlags(0);
_asm MOV ECX,dwSP
_asm CALL DWORD PTR DS:[pStudioRenderFinal] // StudioRenderFinal
}
}
//==================================================================================