general fix flashlight for other players in multiplayer mode

This commit is contained in:
NightFox 2021-12-28 15:09:29 +03:00
parent 13914830b7
commit 9420fc3e39
3 changed files with 10 additions and 11 deletions

View File

@ -2709,10 +2709,6 @@ void CL_AddEntityEffects( cl_entity_t *ent )
dl->die = cl.time + 0.001;
}
}
else if (ent->player && ent->index != ( cl.playernum + 1 ))
{
CL_UpdateFlashlight( ent );
}
}
else if ( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
{

View File

@ -896,8 +896,7 @@ void VK_AddFlashlight( cl_entity_t *ent ) {
}
else // non-local player case
{
// TODO: need to test!
AngleVectors( ent->angles, angles, NULL, NULL ); // TODO: maybe improve turning sensitivity
AngleVectors( ent->angles, angles, NULL, NULL ); // FIXME: UP-DOWN logic
view_ofs[0] = view_ofs[1] = 0.0f;
if( ent->curstate.usehull == 1 ) {
view_ofs[2] = 12.0f; // VEC_DUCK_VIEW;
@ -908,15 +907,15 @@ void VK_AddFlashlight( cl_entity_t *ent ) {
VectorMA( vecSrc, thirdperson_offset, angles, vecEnd );
trace = gEngine.EV_VisTraceLine( vecSrc, vecEnd, PM_STUDIO_BOX );
VectorCopy( trace->endpos, origin );
angles[ROLL] = -angles[ROLL];
angles[ROLL] = -angles[ROLL]; // FIXME: UP-DOWN logic
VectorCopy( angles, le.dir );
}
/*
gEngine.Con_Printf("flashlight: origin=(%f %f %f) color=(%f %f %f) dir=(%f %f %f)\n",
plight->origin[0], plight->origin[1], plight->origin[2],
plight->color[0], plight->color[1], plight->color[2],
plight->dir[0], plight->dir[1], plight->dir[2]);
le.origin[0], le.origin[1], le.origin[2],
le.color[0], le.color[1], le.color[2],
le.dir[0], le.dir[1], le.dir[2]);
*/
VectorCopy(origin, le.origin);
@ -1102,7 +1101,7 @@ void VK_LightsFrameFinalize( void ) {
continue;
addDlight(dlight);
}
// Draw flashlight
// Draw flashlight for local player
entPlayer = gEngine.GetLocalPlayer();
if( FBitSet( entPlayer->curstate.effects, EF_DIMLIGHT )) {
VK_AddFlashlight(entPlayer);

View File

@ -634,6 +634,10 @@ void VK_SceneRender( const ref_viewpass_t *rvp ) {
{
cl_entity_t *ent = g_lists.draw_list->solid_entities[i];
drawEntity(ent, kRenderNormal);
// Draw flashlight for other players
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT )) {
VK_AddFlashlight(ent);
}
}
// Draw opaque beams