mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 13:10:34 +00:00
[qw] Partially clean up muzzle flash handling
It needs some more work (see FIXME in the code).
This commit is contained in:
parent
ca38f9b616
commit
36761192a6
3 changed files with 38 additions and 35 deletions
|
@ -30,6 +30,8 @@
|
|||
#ifndef __client_effects_h
|
||||
#define __client_effects_h
|
||||
|
||||
#include "QF/simd/types.h"
|
||||
|
||||
struct entity_s;
|
||||
struct entity_state_s;
|
||||
|
||||
|
@ -39,5 +41,7 @@ void CL_ModelEffects (struct entity_s *ent, int num, int glow_color,
|
|||
double time);
|
||||
void CL_EntityEffects (int num, struct entity_s *ent,
|
||||
struct entity_state_s *state, double time);
|
||||
void CL_MuzzleFlash (vec4f_t position, vec4f_t fv, float zoffset, int num,
|
||||
double time);
|
||||
|
||||
#endif//__client_effects_h
|
||||
|
|
|
@ -148,28 +148,33 @@ CL_ModelEffects (entity_t *ent, int num, int glow_color, double time)
|
|||
r_funcs->particles->R_GlowTrail (ent, glow_color);
|
||||
}
|
||||
|
||||
void
|
||||
CL_MuzzleFlash (vec4f_t position, vec4f_t fv, float zoffset, int num,
|
||||
double time)
|
||||
{
|
||||
dlight_t *dl = r_funcs->R_AllocDlight (num);
|
||||
if (dl) {
|
||||
position += 18 * fv;
|
||||
VectorCopy (position, dl->origin);
|
||||
dl->origin[2] += zoffset;
|
||||
dl->radius = 200 + (rand () & 31);
|
||||
dl->die = time + 0.1;
|
||||
dl->minlight = 32;
|
||||
dl->color[0] = 0.2;
|
||||
dl->color[1] = 0.1;
|
||||
dl->color[2] = 0.05;
|
||||
dl->color[3] = 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CL_EntityEffects (int num, entity_t *ent, entity_state_t *state, double time)
|
||||
{
|
||||
dlight_t *dl;
|
||||
|
||||
if (state->effects & EF_BRIGHTFIELD)
|
||||
r_funcs->particles->R_EntityParticles (ent);
|
||||
if (state->effects & EF_MUZZLEFLASH) {
|
||||
dl = r_funcs->R_AllocDlight (num);
|
||||
if (dl) {
|
||||
vec4f_t position = Transform_GetWorldPosition (ent->transform);
|
||||
vec4f_t fv = Transform_Forward (ent->transform);
|
||||
position += 18 * fv;
|
||||
VectorCopy (position, dl->origin);
|
||||
dl->origin[2] += 16;
|
||||
dl->radius = 200 + (rand () & 31);
|
||||
dl->die = time + 0.1;
|
||||
dl->minlight = 32;
|
||||
dl->color[0] = 0.2;
|
||||
dl->color[1] = 0.1;
|
||||
dl->color[2] = 0.05;
|
||||
dl->color[3] = 0.7;
|
||||
}
|
||||
vec4f_t position = Transform_GetWorldPosition (ent->transform);
|
||||
vec4f_t fv = Transform_Forward (ent->transform);
|
||||
CL_MuzzleFlash (position, fv, 16, num, time);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include "clview.h"
|
||||
#include "sbar.h"
|
||||
|
||||
#include "client/effects.h"
|
||||
#include "client/temp_entities.h"
|
||||
|
||||
#include "qw/bothdefs.h"
|
||||
|
@ -1255,12 +1256,14 @@ CL_SetStat (int stat, int value)
|
|||
}
|
||||
|
||||
static void
|
||||
CL_MuzzleFlash (void)
|
||||
CL_ParseMuzzleFlash (void)
|
||||
{
|
||||
dlight_t *dl;
|
||||
//FIXME this should just enable the effect on the relevant entity and
|
||||
//then automatic entity updates take care of the rest
|
||||
int i;
|
||||
player_state_t *pl;
|
||||
vec3_t fv, rv, uv;
|
||||
vec3_t f, r, u;
|
||||
vec4f_t position = { 0, 0, 0, 1}, fv = {};
|
||||
|
||||
i = MSG_ReadShort (net_message);
|
||||
|
||||
|
@ -1269,23 +1272,14 @@ CL_MuzzleFlash (void)
|
|||
|
||||
pl = &cl.frames[parsecountmod].playerstate[i - 1];
|
||||
|
||||
dl = r_funcs->R_AllocDlight (i);
|
||||
if (!dl)
|
||||
return;
|
||||
|
||||
if (i - 1 == cl.playernum)
|
||||
AngleVectors (cl.viewangles, fv, rv, uv);
|
||||
AngleVectors (cl.viewangles, f, r, u);
|
||||
else
|
||||
AngleVectors (pl->viewangles, fv, rv, uv);
|
||||
AngleVectors (pl->viewangles, f, r, u);
|
||||
|
||||
VectorMultAdd (pl->pls.origin, 18, fv, dl->origin);
|
||||
dl->radius = 200 + (rand () & 31);
|
||||
dl->die = cl.time + 0.1;
|
||||
dl->minlight = 32;
|
||||
dl->color[0] = 0.2;
|
||||
dl->color[1] = 0.1;
|
||||
dl->color[2] = 0.05;
|
||||
dl->color[3] = 0.7;
|
||||
VectorCopy (f, fv);
|
||||
VectorCopy (pl->pls.es.origin, position);
|
||||
CL_MuzzleFlash (position, fv, 0, i, cl.time);
|
||||
}
|
||||
|
||||
#define SHOWNET(x) \
|
||||
|
@ -1621,7 +1615,7 @@ CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_muzzleflash:
|
||||
CL_MuzzleFlash ();
|
||||
CL_ParseMuzzleFlash ();
|
||||
break;
|
||||
|
||||
case svc_updateuserinfo:
|
||||
|
|
Loading…
Reference in a new issue