mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-31 00:30:57 +00:00
[client] Merge nq/qw entity effects code
This commit is contained in:
parent
51e8694195
commit
b8267f2edd
6 changed files with 231 additions and 238 deletions
43
include/client/effects.h
Normal file
43
include/client/effects.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
effects.h
|
||||||
|
|
||||||
|
Effect management
|
||||||
|
|
||||||
|
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
|
||||||
|
|
||||||
|
Author: Bill Currie <bill@taniwha.org>
|
||||||
|
Date: 2021/3/11
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to:
|
||||||
|
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
59 Temple Place - Suite 330
|
||||||
|
Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
#ifndef __client_effects_h
|
||||||
|
#define __client_effects_h
|
||||||
|
|
||||||
|
struct entity_s;
|
||||||
|
struct entity_state_s;
|
||||||
|
|
||||||
|
void CL_NewDlight (int key, vec3_t org, int effects, byte glow_size,
|
||||||
|
byte glow_color, double time);
|
||||||
|
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);
|
||||||
|
|
||||||
|
#endif//__client_effects_h
|
|
@ -3,6 +3,7 @@ noinst_LTLIBRARIES += libs/client/libQFclient.la
|
||||||
libs_client_libQFclient_la_LDFLAGS= @STATIC@
|
libs_client_libQFclient_la_LDFLAGS= @STATIC@
|
||||||
libs_client_libQFclient_la_LIBADD= libs/gamecode/libQFgamecode.la libs/util/libQFutil.la
|
libs_client_libQFclient_la_LIBADD= libs/gamecode/libQFgamecode.la libs/util/libQFutil.la
|
||||||
libs_client_libQFclient_la_SOURCES= \
|
libs_client_libQFclient_la_SOURCES= \
|
||||||
libs/client/cl_temp_entities.c \
|
libs/client/cl_effects.c \
|
||||||
libs/client/cl_entities.c \
|
libs/client/cl_entities.c \
|
||||||
|
libs/client/cl_temp_entities.c \
|
||||||
$e
|
$e
|
||||||
|
|
175
libs/client/cl_effects.c
Normal file
175
libs/client/cl_effects.c
Normal file
|
@ -0,0 +1,175 @@
|
||||||
|
/*
|
||||||
|
cl_effect.c
|
||||||
|
|
||||||
|
Client side effect management
|
||||||
|
|
||||||
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
|
||||||
|
|
||||||
|
Author: Bill Currie <bill@taniwha.org>
|
||||||
|
Date: 2021/3/11
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to:
|
||||||
|
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
59 Temple Place - Suite 330
|
||||||
|
Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STRINGS_H
|
||||||
|
# include <strings.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "QF/entity.h"
|
||||||
|
#include "QF/render.h"
|
||||||
|
|
||||||
|
#include "QF/plugin/vid_render.h" //FIXME
|
||||||
|
|
||||||
|
#include "client/entities.h"
|
||||||
|
#include "client/effects.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
CL_NewDlight (int key, vec3_t org, int effects, byte glow_size,
|
||||||
|
byte glow_color, double time)
|
||||||
|
{
|
||||||
|
float radius;
|
||||||
|
dlight_t *dl;
|
||||||
|
static quat_t normal = {0.4, 0.2, 0.05, 0.7};
|
||||||
|
static quat_t red = {0.5, 0.05, 0.05, 0.7};
|
||||||
|
static quat_t blue = {0.05, 0.05, 0.5, 0.7};
|
||||||
|
static quat_t purple = {0.5, 0.05, 0.5, 0.7};
|
||||||
|
|
||||||
|
effects &= EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT;
|
||||||
|
if (!effects) {
|
||||||
|
if (!glow_size)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl = r_funcs->R_AllocDlight (key);
|
||||||
|
if (!dl)
|
||||||
|
return;
|
||||||
|
VectorCopy (org, dl->origin);
|
||||||
|
|
||||||
|
if (effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT)) {
|
||||||
|
radius = 200 + (rand () & 31);
|
||||||
|
if (effects & EF_BRIGHTLIGHT) {
|
||||||
|
radius += 200;
|
||||||
|
dl->origin[2] += 16;
|
||||||
|
}
|
||||||
|
if (effects & EF_DIMLIGHT)
|
||||||
|
if (effects & ~EF_DIMLIGHT)
|
||||||
|
radius -= 100;
|
||||||
|
dl->radius = radius;
|
||||||
|
dl->die = time + 0.1;
|
||||||
|
|
||||||
|
switch (effects & (EF_RED | EF_BLUE)) {
|
||||||
|
case EF_RED | EF_BLUE:
|
||||||
|
QuatCopy (purple, dl->color);
|
||||||
|
break;
|
||||||
|
case EF_RED:
|
||||||
|
QuatCopy (red, dl->color);
|
||||||
|
break;
|
||||||
|
case EF_BLUE:
|
||||||
|
QuatCopy (blue, dl->color);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
QuatCopy (normal, dl->color);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (glow_size) {
|
||||||
|
dl->radius += glow_size < 128 ? glow_size * 8.0 :
|
||||||
|
(glow_size - 256) * 8.0;
|
||||||
|
dl->die = time + 0.1;
|
||||||
|
if (glow_color) {
|
||||||
|
if (glow_color == 255) {
|
||||||
|
dl->color[0] = dl->color[1] = dl->color[2] = 1.0;
|
||||||
|
} else {
|
||||||
|
byte *tempcolor;
|
||||||
|
|
||||||
|
tempcolor = (byte *) &d_8to24table[glow_color];
|
||||||
|
VectorScale (tempcolor, 1 / 255.0, dl->color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CL_ModelEffects (entity_t *ent, int num, int glow_color, double time)
|
||||||
|
{
|
||||||
|
dlight_t *dl;
|
||||||
|
model_t *model = ent->renderer.model;
|
||||||
|
|
||||||
|
// add automatic particle trails
|
||||||
|
if (model->flags & EF_ROCKET) {
|
||||||
|
dl = r_funcs->R_AllocDlight (num);
|
||||||
|
if (dl) {
|
||||||
|
VectorCopy (ent->origin, dl->origin);
|
||||||
|
dl->radius = 200.0;
|
||||||
|
dl->die = time + 0.1;
|
||||||
|
//FIXME VectorCopy (r_firecolor->vec, dl->color);
|
||||||
|
VectorSet (0.9, 0.7, 0.0, dl->color);
|
||||||
|
dl->color[3] = 0.7;
|
||||||
|
}
|
||||||
|
r_funcs->particles->R_RocketTrail (ent);
|
||||||
|
} else if (model->flags & EF_GRENADE)
|
||||||
|
r_funcs->particles->R_GrenadeTrail (ent);
|
||||||
|
else if (model->flags & EF_GIB)
|
||||||
|
r_funcs->particles->R_BloodTrail (ent);
|
||||||
|
else if (model->flags & EF_ZOMGIB)
|
||||||
|
r_funcs->particles->R_SlightBloodTrail (ent);
|
||||||
|
else if (model->flags & EF_TRACER)
|
||||||
|
r_funcs->particles->R_WizTrail (ent);
|
||||||
|
else if (model->flags & EF_TRACER2)
|
||||||
|
r_funcs->particles->R_FlameTrail (ent);
|
||||||
|
else if (model->flags & EF_TRACER3)
|
||||||
|
r_funcs->particles->R_VoorTrail (ent);
|
||||||
|
else if (model->flags & EF_GLOWTRAIL)
|
||||||
|
if (r_funcs->particles->R_GlowTrail)
|
||||||
|
r_funcs->particles->R_GlowTrail (ent, glow_color);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
Client side temporary entity management
|
Client side temporary entity management
|
||||||
|
|
||||||
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
|
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
|
||||||
|
|
||||||
Author: Bill Currie <bill@taniwha.org>
|
Author: Bill Currie <bill@taniwha.org>
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|
||||||
|
#include "client/effects.h"
|
||||||
#include "client/temp_entities.h"
|
#include "client/temp_entities.h"
|
||||||
|
|
||||||
#include "nq/include/chase.h"
|
#include "nq/include/chase.h"
|
||||||
|
@ -75,73 +76,6 @@ CL_ClearEnts (void)
|
||||||
CL_Init_Entity (cl_entities + i);
|
CL_Init_Entity (cl_entities + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
CL_NewDlight (int key, vec3_t org, int effects, byte glow_size,
|
|
||||||
byte glow_color)
|
|
||||||
{
|
|
||||||
float radius;
|
|
||||||
dlight_t *dl;
|
|
||||||
static quat_t normal = {0.4, 0.2, 0.05, 0.7};
|
|
||||||
static quat_t red = {0.5, 0.05, 0.05, 0.7};
|
|
||||||
static quat_t blue = {0.05, 0.05, 0.5, 0.7};
|
|
||||||
static quat_t purple = {0.5, 0.05, 0.5, 0.7};
|
|
||||||
|
|
||||||
effects &= EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT;
|
|
||||||
if (!effects) {
|
|
||||||
if (!glow_size)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl = r_funcs->R_AllocDlight (key);
|
|
||||||
if (!dl)
|
|
||||||
return;
|
|
||||||
VectorCopy (org, dl->origin);
|
|
||||||
|
|
||||||
if (effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT)) {
|
|
||||||
radius = 200 + (rand () & 31);
|
|
||||||
if (effects & EF_BRIGHTLIGHT) {
|
|
||||||
radius += 200;
|
|
||||||
dl->origin[2] += 16;
|
|
||||||
}
|
|
||||||
if (effects & EF_DIMLIGHT)
|
|
||||||
if (effects & ~EF_DIMLIGHT)
|
|
||||||
radius -= 100;
|
|
||||||
dl->radius = radius;
|
|
||||||
dl->die = cl.time + 0.1;
|
|
||||||
|
|
||||||
switch (effects & (EF_RED | EF_BLUE)) {
|
|
||||||
case EF_RED | EF_BLUE:
|
|
||||||
QuatCopy (purple, dl->color);
|
|
||||||
break;
|
|
||||||
case EF_RED:
|
|
||||||
QuatCopy (red, dl->color);
|
|
||||||
break;
|
|
||||||
case EF_BLUE:
|
|
||||||
QuatCopy (blue, dl->color);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
QuatCopy (normal, dl->color);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (glow_size) {
|
|
||||||
dl->radius += glow_size < 128 ? glow_size * 8.0 :
|
|
||||||
(glow_size - 256) * 8.0;
|
|
||||||
dl->die = cl.time + 0.1;
|
|
||||||
if (glow_color) {
|
|
||||||
if (glow_color == 255) {
|
|
||||||
dl->color[0] = dl->color[1] = dl->color[2] = 1.0;
|
|
||||||
} else {
|
|
||||||
byte *tempcolor;
|
|
||||||
|
|
||||||
tempcolor = (byte *) &d_8to24table[glow_color];
|
|
||||||
VectorScale (tempcolor, 1 / 255.0, dl->color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CL_LerpPoint
|
CL_LerpPoint
|
||||||
|
|
||||||
|
@ -179,67 +113,6 @@ CL_LerpPoint (void)
|
||||||
return frac;
|
return frac;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
CL_ModelEffects (entity_t *ent, int num, int glow_color)
|
|
||||||
{
|
|
||||||
dlight_t *dl;
|
|
||||||
model_t *model = ent->renderer.model;
|
|
||||||
|
|
||||||
// add automatic particle trails
|
|
||||||
if (model->flags & EF_ROCKET) {
|
|
||||||
dl = r_funcs->R_AllocDlight (num);
|
|
||||||
if (dl) {
|
|
||||||
VectorCopy (ent->origin, dl->origin);
|
|
||||||
dl->radius = 200.0;
|
|
||||||
dl->die = cl.time + 0.1;
|
|
||||||
//FIXME VectorCopy (r_firecolor->vec, dl->color);
|
|
||||||
VectorSet (0.9, 0.7, 0.0, dl->color);
|
|
||||||
dl->color[3] = 0.7;
|
|
||||||
}
|
|
||||||
r_funcs->particles->R_RocketTrail (ent);
|
|
||||||
} else if (model->flags & EF_GRENADE)
|
|
||||||
r_funcs->particles->R_GrenadeTrail (ent);
|
|
||||||
else if (model->flags & EF_GIB)
|
|
||||||
r_funcs->particles->R_BloodTrail (ent);
|
|
||||||
else if (model->flags & EF_ZOMGIB)
|
|
||||||
r_funcs->particles->R_SlightBloodTrail (ent);
|
|
||||||
else if (model->flags & EF_TRACER)
|
|
||||||
r_funcs->particles->R_WizTrail (ent);
|
|
||||||
else if (model->flags & EF_TRACER2)
|
|
||||||
r_funcs->particles->R_FlameTrail (ent);
|
|
||||||
else if (model->flags & EF_TRACER3)
|
|
||||||
r_funcs->particles->R_VoorTrail (ent);
|
|
||||||
else if (model->flags & EF_GLOWTRAIL)
|
|
||||||
if (r_funcs->particles->R_GlowTrail)
|
|
||||||
r_funcs->particles->R_GlowTrail (ent, glow_color);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
CL_EntityEffects (int num, entity_t *ent, entity_state_t *state)
|
|
||||||
{
|
|
||||||
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 = 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_entity_model (entity_t *ent, int modelindex)
|
set_entity_model (entity_t *ent, int modelindex)
|
||||||
{
|
{
|
||||||
|
@ -419,13 +292,13 @@ CL_RelinkEntities (void)
|
||||||
angles[YAW] = bobjrotate;
|
angles[YAW] = bobjrotate;
|
||||||
CL_TransformEntity (ent, angles);
|
CL_TransformEntity (ent, angles);
|
||||||
}
|
}
|
||||||
CL_EntityEffects (i, ent, new);
|
CL_EntityEffects (i, ent, new, cl.time);
|
||||||
CL_NewDlight (i, ent->origin, new->effects, new->glow_size,
|
CL_NewDlight (i, ent->origin, new->effects, new->glow_size,
|
||||||
new->glow_color);
|
new->glow_color, cl.time);
|
||||||
if (VectorDistance_fast (old->origin, ent->origin) > (256 * 256))
|
if (VectorDistance_fast (old->origin, ent->origin) > (256 * 256))
|
||||||
VectorCopy (ent->origin, old->origin);
|
VectorCopy (ent->origin, old->origin);
|
||||||
if (model_flags & ~EF_ROTATE)
|
if (model_flags & ~EF_ROTATE)
|
||||||
CL_ModelEffects (ent, i, new->glow_color);
|
CL_ModelEffects (ent, i, new->glow_color, cl.time);
|
||||||
|
|
||||||
cl_forcelink[i] = false;
|
cl_forcelink[i] = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "clview.h"
|
#include "clview.h"
|
||||||
#include "d_iface.h"
|
#include "d_iface.h"
|
||||||
|
|
||||||
|
#include "client/effects.h"
|
||||||
#include "client/temp_entities.h"
|
#include "client/temp_entities.h"
|
||||||
|
|
||||||
#include "qw/bothdefs.h"
|
#include "qw/bothdefs.h"
|
||||||
|
@ -82,73 +83,6 @@ CL_ClearEnts (void)
|
||||||
CL_Init_Entity (&cl_player_ents[i]);
|
CL_Init_Entity (&cl_player_ents[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
CL_NewDlight (int key, vec3_t org, int effects, byte glow_size,
|
|
||||||
byte glow_color)
|
|
||||||
{
|
|
||||||
float radius;
|
|
||||||
dlight_t *dl;
|
|
||||||
static quat_t normal = {0.4, 0.2, 0.05, 0.7};
|
|
||||||
static quat_t red = {0.5, 0.05, 0.05, 0.7};
|
|
||||||
static quat_t blue = {0.05, 0.05, 0.5, 0.7};
|
|
||||||
static quat_t purple = {0.5, 0.05, 0.5, 0.7};
|
|
||||||
|
|
||||||
effects &= EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT;
|
|
||||||
if (!effects) {
|
|
||||||
if (!glow_size)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl = r_funcs->R_AllocDlight (key);
|
|
||||||
if (!dl)
|
|
||||||
return;
|
|
||||||
VectorCopy (org, dl->origin);
|
|
||||||
|
|
||||||
if (effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT)) {
|
|
||||||
radius = 200 + (rand () & 31);
|
|
||||||
if (effects & EF_BRIGHTLIGHT) {
|
|
||||||
radius += 200;
|
|
||||||
dl->origin[2] += 16;
|
|
||||||
}
|
|
||||||
if (effects & EF_DIMLIGHT)
|
|
||||||
if (effects & ~EF_DIMLIGHT)
|
|
||||||
radius -= 100;
|
|
||||||
dl->radius = radius;
|
|
||||||
dl->die = cl.time + 0.1;
|
|
||||||
|
|
||||||
switch (effects & (EF_RED | EF_BLUE)) {
|
|
||||||
case EF_RED | EF_BLUE:
|
|
||||||
QuatCopy (purple, dl->color);
|
|
||||||
break;
|
|
||||||
case EF_RED:
|
|
||||||
QuatCopy (red, dl->color);
|
|
||||||
break;
|
|
||||||
case EF_BLUE:
|
|
||||||
QuatCopy (blue, dl->color);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
QuatCopy (normal, dl->color);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (glow_size) {
|
|
||||||
dl->radius += glow_size < 128 ? glow_size * 8.0 :
|
|
||||||
(glow_size - 256) * 8.0;
|
|
||||||
dl->die = cl.time + 0.1;
|
|
||||||
if (glow_color) {
|
|
||||||
if (glow_color == 255) {
|
|
||||||
dl->color[0] = dl->color[1] = dl->color[2] = 1.0;
|
|
||||||
} else {
|
|
||||||
byte *tempcolor;
|
|
||||||
|
|
||||||
tempcolor = (byte *) &d_8to24table[glow_color];
|
|
||||||
VectorScale (tempcolor, 1 / 255.0, dl->color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hack hack hack
|
// Hack hack hack
|
||||||
static inline int
|
static inline int
|
||||||
is_dead_body (entity_state_t *s1)
|
is_dead_body (entity_state_t *s1)
|
||||||
|
@ -171,41 +105,6 @@ is_gib (entity_state_t *s1)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
CL_ModelEffects (entity_t *ent, int num, int glow_color)
|
|
||||||
{
|
|
||||||
dlight_t *dl;
|
|
||||||
model_t *model = ent->renderer.model;
|
|
||||||
|
|
||||||
// add automatic particle trails
|
|
||||||
if (model->flags & EF_ROCKET) {
|
|
||||||
dl = r_funcs->R_AllocDlight (num);
|
|
||||||
if (dl) {
|
|
||||||
VectorCopy (ent->origin, dl->origin);
|
|
||||||
dl->radius = 200.0;
|
|
||||||
dl->die = cl.time + 0.1;
|
|
||||||
//FIXME VectorCopy (r_firecolor->vec, dl->color);
|
|
||||||
VectorSet (0.9, 0.7, 0.0, dl->color);
|
|
||||||
dl->color[3] = 0.7;
|
|
||||||
}
|
|
||||||
r_funcs->particles->R_RocketTrail (ent);
|
|
||||||
} else if (model->flags & EF_GRENADE)
|
|
||||||
r_funcs->particles->R_GrenadeTrail (ent);
|
|
||||||
else if (model->flags & EF_GIB)
|
|
||||||
r_funcs->particles->R_BloodTrail (ent);
|
|
||||||
else if (model->flags & EF_ZOMGIB)
|
|
||||||
r_funcs->particles->R_SlightBloodTrail (ent);
|
|
||||||
else if (model->flags & EF_TRACER)
|
|
||||||
r_funcs->particles->R_WizTrail (ent);
|
|
||||||
else if (model->flags & EF_TRACER2)
|
|
||||||
r_funcs->particles->R_FlameTrail (ent);
|
|
||||||
else if (model->flags & EF_TRACER3)
|
|
||||||
r_funcs->particles->R_VoorTrail (ent);
|
|
||||||
else if (model->flags & EF_GLOWTRAIL)
|
|
||||||
if (r_funcs->particles->R_GlowTrail)
|
|
||||||
r_funcs->particles->R_GlowTrail (ent, glow_color);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_entity_model (entity_t *ent, int modelindex)
|
set_entity_model (entity_t *ent, int modelindex)
|
||||||
{
|
{
|
||||||
|
@ -221,6 +120,7 @@ set_entity_model (entity_t *ent, int modelindex)
|
||||||
animation->syncbase = 0.0;
|
animation->syncbase = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
animation->nolerp = 1; // don't try to lerp when the model has changed
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -255,7 +155,7 @@ CL_LinkPacketEntities (void)
|
||||||
|
|
||||||
// spawn light flashes, even ones coming from invisible objects
|
// spawn light flashes, even ones coming from invisible objects
|
||||||
CL_NewDlight (i, new->origin, new->effects, new->glow_size,
|
CL_NewDlight (i, new->origin, new->effects, new->glow_size,
|
||||||
new->glow_color);
|
new->glow_color, cl.time);
|
||||||
|
|
||||||
// if set to invisible, skip
|
// if set to invisible, skip
|
||||||
if (!new->modelindex
|
if (!new->modelindex
|
||||||
|
@ -374,11 +274,11 @@ CL_LinkPacketEntities (void)
|
||||||
CL_TransformEntity (ent, angles);
|
CL_TransformEntity (ent, angles);
|
||||||
}
|
}
|
||||||
//CL_EntityEffects (i, ent, new);
|
//CL_EntityEffects (i, ent, new);
|
||||||
//CL_NewDlight (i, ent->origin, new->effects, 0, 0);
|
//CL_NewDlight (i, ent->origin, new->effects, 0, 0, cl.time);
|
||||||
if (VectorDistance_fast (old->origin, ent->origin) > (256 * 256))
|
if (VectorDistance_fast (old->origin, ent->origin) > (256 * 256))
|
||||||
VectorCopy (ent->origin, old->origin);
|
VectorCopy (ent->origin, old->origin);
|
||||||
if (renderer->model->flags & ~EF_ROTATE) {
|
if (renderer->model->flags & ~EF_ROTATE) {
|
||||||
CL_ModelEffects (ent, -new->number, new->glow_color);
|
CL_ModelEffects (ent, -new->number, new->glow_color, cl.time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -492,7 +392,7 @@ CL_LinkPlayers (void)
|
||||||
QuatSet (0.0, 1.0, 0.0, 1.0, dl->color);
|
QuatSet (0.0, 1.0, 0.0, 1.0, dl->color);
|
||||||
} else {
|
} else {
|
||||||
CL_NewDlight (j + 1, org, state->pls.effects, state->pls.glow_size,
|
CL_NewDlight (j + 1, org, state->pls.effects, state->pls.glow_size,
|
||||||
state->pls.glow_color);
|
state->pls.glow_color, cl.time);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw player?
|
// Draw player?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue