Newbie HvHer
- User ID
- 10107
- Messages
- 4
- Reactions
- 3
- Level
- 4
menu.h:
MultiDropdown dlight;
Colorpicker dlight_enemy;
Colorpicker dlight_friendly;
Colorpicker dlight_local;
dlight.setup(XOR("dlight"), XOR("dlight"), { XOR("enemy"), XOR("friendly"), XOR("local") });
RegisterElement(&dlight);
dlight_enemy.setup(XOR("enemy color"), XOR("dlight_enemy"), { 255, 255, 255, 255 }, nullptr);
RegisterElement(&dlight_enemy);
dlight_friendly.setup(XOR("friendly color"), XOR("dlight_friendly"), { 255, 255, 255, 255 }, nullptr);
RegisterElement(&dlight_friendly);
dlight_local.setup(XOR("local color"), XOR("dlight_local"), { 255, 255, 255, 255 }, nullptr);
RegisterElement(&dlight_local);
ivefx.h:
#pragma once
#define MAX_DLIGHTS 32
enum
{
DLIGHT_NO_WORLD_ILLUMINATION = 0x1,
DLIGHT_NO_MODEL_ILLUMINATION = 0x2,
DLIGHT_ADD_DISPLACEMENT_ALPHA = 0x4,
DLIGHT_SUBTRACT_DISPLACEMENT_ALPHA = 0x8,
DLIGHT_DISPLACEMENT_MASK = (DLIGHT_ADD_DISPLACEMENT_ALPHA | DLIGHT_SUBTRACT_DISPLACEMENT_ALPHA),
};
struct ColorRGBExp32
{
unsigned char r, g, b;
signed char exponent;
};
struct dlight_t
{
int flags;
vec3_t origin;
float radius;
ColorRGBExp32 color;
float die;
float decay;
float minlight;
int key;
int style;
vec3_t m_Direction;
float m_InnerAngle;
float m_OuterAngle;
float GetRadius() const
{
// return FastSqrt( radius * radius * ( HL2_BROKEN_MIN_LIGHTING_VALUE / MIN_LIGHTING_VALUE ) );
return radius;
}
// see comments above about HL2_BROKEN_MIN_LIGHTING_VALUE and MIN_LIGHTING_VALUE
// THIS SHOULD ONLY GET CALLED FROM THE ENGINE
float GetRadiusSquared() const
{
// return radius * radius * ( HL2_BROKEN_MIN_LIGHTING_VALUE / MIN_LIGHTING_VALUE );
return radius * radius;
}
// THIS SHOULD ONLY GET CALLED FROM THE ENGINE
float IsRadiusGreaterThanZero() const
{
// don't bother calculating the new radius if you just want to know if it is greater than zero.
return radius > 0.0f;
}
};
class IVEfx
{
public:
enum indices : size_t {
ALLOCDLIGHT = 4,
ALLOCELIGHT = 5,
GETACTIVEDLIGHTS = 6,
GETELIGHTBYKEY = 8,
};
__forceinline dlight_t* CL_AllocDlight(int key) {
return util::get_method<dlight_t* (__thiscall*)(void*, int)>(this, ALLOCDLIGHT)(this, key);
}
__forceinline dlight_t* CL_AllocElight(int key) {
return util::get_method<dlight_t* (__thiscall*)(void*, int)>(this, ALLOCELIGHT)(this, key);
}
__forceinline int CL_GetActiveDLights(dlight_t* pList[MAX_DLIGHTS]) {
return util::get_method<int(__thiscall*)(void*, dlight_t*)>(this, GETACTIVEDLIGHTS)(this, pList[MAX_DLIGHTS]);
}
__forceinline dlight_t* GetElightByKey(int key) {
return util::get_method<dlight_t* (__thiscall*)(void*,int)>(this, GETELIGHTBYKEY)(this, key);
}
};
csgo.cpp:
m_ivefx = interfaces.get< IVEfx* >(HASH("VEngineEffects"));
csgo.cpp:
IVEfx *m_ivefx;
visuals.cpp (DrawPlayer):
if ((enemy && g_menu.main.players.dlight.get(0)) || (!enemy && !local && g_menu.main.players.dlight.get(1)) || (local && g_menu.main.players.dlight.get(2))) {// draw dlights.
Color clr = Color(255, 255, 255, 255);
if (enemy && g_menu.main.players.dlight.get(0))
clr = g_menu.main.players.dlight_enemy.get();
else if (!enemy && !local && g_menu.main.players.dlight.get(1))
clr = g_menu.main.players.dlight_friendly.get();
else if (local && g_menu.main.players.dlight.get(2))
clr = g_menu.main.players.dlight_local.get();
CreateDlight(clr, 10.f, 50.0f, player->index(), player->m_vecOrigin(), player->m_vecOrigin());
}
visuals.cpp:
void Visuals::CreateDlight(Color col, float exponent, float radius, int key, vec3_t direction, vec3_t origin, float die) {
dlight_t* dlight = g_csgo.m_ivefx->CL_AllocDlight(key + 69);
dlight->flags = DLIGHT_NO_MODEL_ILLUMINATION;
dlight->color.r = col.r();
dlight->color.g = col.g();
dlight->color.b = col.b();
dlight->color.exponent = exponent;
dlight->radius = radius;
dlight->decay = radius / 5.0f;;
dlight->m_Direction = direction;
dlight->origin = origin;
dlight->die = die < 0.1f ? g_csgo.m_globals->m_curtime + 0.2f : die;
}
visuals.h:
void CreateDlight(Color col, float exponent, float radius, int key, vec3_t direction, vec3_t origin, float die = 0.f);
Last edited: