client: support of EF_FLASHLIGHT effect

Based on:
 * https://github.com/Paril/q2pro.git
This commit is contained in:
Denis Pauk 2024-11-24 23:25:26 +02:00
parent 5d21429c36
commit 3314fc941e
2 changed files with 15 additions and 0 deletions

View file

@ -166,6 +166,7 @@ Goals:
* [ ] Rearange surfaces in vulkan render before render,
* [ ] Fully implement `target_camera`,
* [ ] Fully implement `misc_flare`,
* [ ] Fix player height with enabled flashlight,
* [ ] Single player ReRelease support,
* [ ] Support effects and additional flags for ReRelease when possible.
* [ ] Use shared model cache in client code insted reimplemnet in each render,

View file

@ -254,6 +254,20 @@ CL_AddPacketEntities(frame_t *frame)
}
}
if (effects & EF_FLASHLIGHT) {
vec3_t forward, start, end;
trace_t trace;
int mask = CONTENTS_SOLID | CONTENTS_MONSTER;
AngleVectors(ent.angles, forward, NULL, NULL);
VectorMA(ent.origin, 1024, forward, end);
VectorCopy(ent.origin, start);
trace = CM_BoxTrace(start, end, vec3_origin, vec3_origin, 0, mask);
V_AddLight(trace.endpos, 256, 1, 1, 1);
}
if (s1->number == cl.playernum + 1)
{
ent.flags |= RF_VIEWERMODEL;