dLights problem.

Posts 1–7 of 7 · Page 1 of 1
dLights problem.
Hi, i am trying to do dlights right now but it seems to not work.

Code:
void DynamicLights(CPlayer* pEntity)
{
	dlight_t* dLight = Interfaces.gEffects->CL_AllocDlight(pEntity->GetIndex());
	dLight->color = Color(255, 0, 0, 255);
	dLight->radius = 400.f;
	dLight->key = pEntity->GetIndex();
	dLight->m_Direction = pEntity->GetAbsOrigin();
	dLight->origin = pEntity->GetAbsOrigin();
	dLight->die = Interfaces.Globals->curtime + 1.f;
	dLight->decay = 20;
}
I am calling it in PaintTraverse. i tried dlight_debug and it work fine but when i call the dlights it doesnt work and the dlight_debug will break (doesnt work). Ideas?
I am using this struct, when i will use the AllocDlight it doesnt do anything and if i try to use dlight_debug in console it will just flash.

Code:
class CEffects
{
public:
	dlight_t* CL_AllocDlight(int key)
	{
		typedef dlight_t*(__thiscall* OriginalFn)(void*, int);
		return CallVirtualFunction<OriginalFn>(this, 4)(this, key);
	}

	dlight_t* CL_AllocElight(int key)
	{
		typedef dlight_t*(__thiscall* OriginalFn)(void*, int);
		return CallVirtualFunction<OriginalFn>(this, 5)(this, key);
	}
};
This should be fine.

This is how i am getting the interface
Code:
Interfaces.gEffects = static_cast<CEffects*>(EngineFactory("VEngineEffects001", nullptr));
That's good to know, but you are using Color instead of ColorRGBExp32.
Oww i forgot lol my bad. Got it working thanks
iirc setting dlight_t::key is unnecessary since it is set when you pass the index to IVEfx::CL_AllocDlight.
There is no reason to set dlight_t::m_Direction or dlight_t::decay either.
Been over a week since last update/bump, assuming solved.

/Closed.
Posts 1–7 of 7 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us