void CL_RelinkEntities (void)
{
entity_t *ent;
- int i, j;
- float frac, f, d, bobjrotate/*, bobjoffset*/, dlightradius;
+ int i, j, glowcolor, effects;
+ float frac, f, d, bobjrotate/*, bobjoffset*/, dlightradius, glowsize;
vec3_t oldorg, delta, dlightcolor;
// determine partial update time
}
ent->render.flags = ent->state_current.flags;
- ent->render.effects = ent->state_current.effects;
+ ent->render.effects = effects = ent->state_current.effects;
ent->render.model = cl.model_precache[ent->state_current.modelindex];
ent->render.frame = ent->state_current.frame;
if (cl.scores == NULL || !ent->state_current.colormap)
ent->render.skinnum = ent->state_current.skin;
ent->render.alpha = ent->state_current.alpha * (1.0f / 255.0f); // FIXME: interpolate?
ent->render.scale = ent->state_current.scale * (1.0f / 16.0f); // FIXME: interpolate?
- ent->render.glowsize = ent->state_current.glowsize * 4.0f; // FIXME: interpolate?
- ent->render.glowcolor = ent->state_current.glowcolor;
+ glowsize = ent->state_current.glowsize * 4.0f; // FIXME: interpolate?
+ glowcolor = ent->state_current.glowcolor;
ent->render.colormod[0] = (float) ((ent->state_current.colormod >> 5) & 7) * (1.0f / 7.0f);
ent->render.colormod[1] = (float) ((ent->state_current.colormod >> 2) & 7) * (1.0f / 7.0f);
ent->render.colormod[2] = (float) (ent->state_current.colormod & 3) * (1.0f / 3.0f);
dlightcolor[2] = 0;
// LordHavoc: if the entity has no effects, don't check each
- if (ent->render.effects)
+ if (effects)
{
- if (ent->render.effects & EF_BRIGHTFIELD)
+ if (effects & EF_BRIGHTFIELD)
R_EntityParticles (ent);
- if (ent->render.effects & EF_MUZZLEFLASH)
+ if (effects & EF_MUZZLEFLASH)
{
vec3_t v;
CL_AllocDlight (NULL, v, 100, 1, 1, 1, 0, 0.1);
}
- if (ent->render.effects & EF_DIMLIGHT)
+ if (effects & EF_DIMLIGHT)
{
dlightcolor[0] += 200.0f;
dlightcolor[1] += 200.0f;
dlightcolor[2] += 200.0f;
}
- if (ent->render.effects & EF_BRIGHTLIGHT)
+ if (effects & EF_BRIGHTLIGHT)
{
dlightcolor[0] += 400.0f;
dlightcolor[1] += 400.0f;
dlightcolor[2] += 400.0f;
}
// LordHavoc: added EF_RED and EF_BLUE
- if (ent->render.effects & EF_RED) // red
+ if (effects & EF_RED) // red
{
dlightcolor[0] += 200.0f;
dlightcolor[1] += 20.0f;
dlightcolor[2] += 20.0f;
}
- if (ent->render.effects & EF_BLUE) // blue
+ if (effects & EF_BLUE) // blue
{
dlightcolor[0] += 20.0f;
dlightcolor[1] += 20.0f;
dlightcolor[2] += 200.0f;
}
- else if (ent->render.effects & EF_FLAME)
+ else if (effects & EF_FLAME)
{
if (ent->render.model)
{
}
}
// LordHavoc: customizable glow
- if (ent->render.glowsize)
+ if (glowsize)
{
- byte *tempcolor = (byte *)&d_8to24table[ent->render.glowcolor];
- dlightcolor[0] += ent->render.glowsize * tempcolor[0] * (1.0f / 255.0f);
- dlightcolor[1] += ent->render.glowsize * tempcolor[1] * (1.0f / 255.0f);
- dlightcolor[2] += ent->render.glowsize * tempcolor[2] * (1.0f / 255.0f);
+ byte *tempcolor = (byte *)&d_8to24table[glowcolor];
+ dlightcolor[0] += glowsize * tempcolor[0] * (1.0f / 255.0f);
+ dlightcolor[1] += glowsize * tempcolor[1] * (1.0f / 255.0f);
+ dlightcolor[2] += glowsize * tempcolor[2] * (1.0f / 255.0f);
}
// LordHavoc: customizable trail
if (ent->render.flags & RENDER_GLOWTRAIL)
- R_RocketTrail2 (oldorg, ent->render.origin, ent->render.glowcolor, ent);
+ R_RocketTrail2 (oldorg, ent->render.origin, glowcolor, ent);
if (dlightcolor[0] || dlightcolor[1] || dlightcolor[2])
{
if (ent->render.model == NULL)
continue;
- if (ent->render.effects & EF_NODRAW)
+ if (effects & EF_NODRAW)
continue;
if (cl_numvisedicts < MAX_VISEDICTS)
cl_visedicts[cl_numvisedicts++] = ent;
ent->render.alpha = 1;
ent->render.scale = 1;
ent->render.alpha = 1;
- ent->render.glowsize = 0;
- ent->render.glowcolor = 254;
ent->render.colormod[0] = ent->render.colormod[1] = ent->render.colormod[2] = 1;
VectorCopy (ent->state_baseline.origin, ent->render.origin);
qboolean mouseactive;
qboolean mouseinitialized;
static qboolean mouseparmsvalid, mouseactivatetoggle;
-//static qboolean mouseshowtoggle = 1;
+static qboolean mouseshowtoggle = 1;
static qboolean dinput_acquired;
static unsigned int mstate_di;
*/
void IN_ShowMouse (void)
{
-// if (!mouseshowtoggle)
-// {
+ if (!mouseshowtoggle)
+ {
ShowCursor (true);
-// mouseshowtoggle = 1;
-// }
+ mouseshowtoggle = 1;
+ }
}
*/
void IN_HideMouse (void)
{
-// if (mouseshowtoggle)
-// {
+ if (mouseshowtoggle)
+ {
ShowCursor (false);
-// mouseshowtoggle = 0;
-// }
+ mouseshowtoggle = 0;
+ }
}
typedef struct
{
double time; // time this state was updated
- vec3_t origin;
- vec3_t angles;
- int effects;
+ unsigned short active;
unsigned short modelindex;
unsigned short frame;
+ unsigned short effects;
+ vec3_t origin;
+ vec3_t angles;
byte colormap;
byte skin;
byte alpha;
byte glowcolor;
byte colormod;
byte flags;
- byte active;
} entity_state_t;
void ClearStateToDefault(entity_state_t *s);
#include "cmd.h"
#include "sbar.h"
#include "sound.h"
+#include "model_shared.h"
#include "render.h"
#include "client.h"
#include "progs.h"
#include "server.h"
-#include "model_shared.h"
-
#include "input.h"
#include "world.h"
#include "keys.h"
//=============================================================================
+typedef struct entity_render_s
+{
+ vec3_t origin;
+ vec3_t angles;
+
+ int visframe; // last frame this entity was found in an active leaf
+
+ model_t *model; // NULL = no model
+ int frame; // current desired frame (usually identical to frame2, but frame2 is not always used)
+ int colormap; // entity shirt and pants colors
+ int effects; // light, particles, etc
+ int skinnum; // for Alias models
+ int flags; // render flags
+
+ float alpha; // opacity (alpha) of the model
+ float scale; // size the model is shown
+ float trail_time; // last time for trail rendering
+ float colormod[3]; // color tint for model
+
+ model_t *lerp_model; // lerp resets when model changes
+ int frame1; // frame that the model is interpolating from
+ int frame2; // frame that the model is interpolating to
+ double lerp_starttime; // start of this transition
+ double framelerp; // interpolation factor, usually computed from lerp_starttime
+ double frame1start; // time frame1 began playing (for framegroup animations)
+ double frame2start; // time frame2 began playing (for framegroup animations)
+}
+entity_render_t;
+
typedef struct entity_s
{
- entity_state_t state_baseline; // baseline for entity
- entity_state_t state_previous; // previous state (interpolating from this)
- entity_state_t state_current; // current state (interpolating to this)
-
- struct
- {
- vec3_t origin;
- vec3_t angles;
-
- // LordHavoc: added support for alpha transprency and other effects
- float alpha; // opacity (alpha) of the model
- float colormod[3]; // color tint for model
- float scale; // size the model is shown
- float glowsize; // how big the glow is
- byte glowcolor; // color of glow and particle trail (paletted)
- byte flags; // render flags
-
- struct model_s *model; // NULL = no model
- int frame; // current desired frame (usually identical to frame2, but frame2 is not always used)
- int colormap;
- int effects; // light, particles, etc
- int skinnum; // for Alias models
-
- int visframe; // last frame this entity was found in an active leaf
-
- struct model_s *lerp_model; // lerp resets when model changes
- double lerp_starttime; // start of this transition
- int frame1; // frame that the model is interpolating from
- int frame2; // frame that the model is interpolating to
- double framelerp; // interpolation factor, usually computed from lerp_starttime
- double frame1start; // time frame1 began playing (for framegroup animations)
- double frame2start; // time frame2 began playing (for framegroup animations)
-
- int dlightframe; // dynamic lighting
- int dlightbits[8];
-
- float trail_time;
- }
- render;
+ entity_state_t state_baseline; // baseline for entity
+ entity_state_t state_previous; // previous state (interpolating from this)
+ entity_state_t state_current; // current state (interpolating to this)
+
+ entity_render_t render;
} entity_t;
typedef struct
{
vrect_t vrect; // subwindow in video for refresh
- // FIXME: not need vrect next field here?
- /*
- vrect_t aliasvrect; // scaled Alias version
- int vrectright, vrectbottom; // right & bottom screen coords
- int aliasvrectright, aliasvrectbottom; // scaled Alias versions
- float vrectrightedge; // rightmost right edge we care about,
- // for use in edge list
- float fvrectx, fvrecty; // for floating-point compares
- float fvrectx_adj, fvrecty_adj; // left and top edges, for clamping
- int vrect_x_adj_shift20; // (vrect.x + 0.5 - epsilon) << 20
- int vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20
- float fvrectright_adj, fvrectbottom_adj;
- // right and bottom edges, for clamping
- float fvrectright; // rightmost edge, for Alias clamping
- float fvrectbottom; // bottommost edge, for Alias clamping
- float horizontalFieldOfView; // at Z = 1.0, this many X is visible
- // 2.0 = 90 degrees
- float xOrigin; // should probably always be 0.5
- float yOrigin; // between be around 0.3 to 0.5
- */
vec3_t vieworg;
vec3_t viewangles;
-
- float fov_x, fov_y;
-// int ambientlight;
+ float fov_x, fov_y;
} refdef_t;