mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
Order of operations cleanup, QSG2 alpha is now colormod[3] in entities.
This commit is contained in:
parent
90f4bf5fa7
commit
ceb73449bb
12 changed files with 75 additions and 79 deletions
|
@ -83,8 +83,7 @@ typedef struct entity_s
|
||||||
struct efrag_s *efrag; // linked list of efrags
|
struct efrag_s *efrag; // linked list of efrags
|
||||||
int visframe; // last frame this entity was
|
int visframe; // last frame this entity was
|
||||||
// found in an active leaf
|
// found in an active leaf
|
||||||
vec3_t colormod; // color tint for model
|
float colormod[4]; // color tint and alpha for model
|
||||||
float alpha; // opacity (alpha) of the model
|
|
||||||
float scale; // size scaler of the model
|
float scale; // size scaler of the model
|
||||||
float glow_size; // how big the glow is (can be negative)
|
float glow_size; // how big the glow is (can be negative)
|
||||||
byte glow_color; // color of glow (paletted)
|
byte glow_color; // color of glow (paletted)
|
||||||
|
|
|
@ -550,7 +550,7 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorScale (e->colormod, 2.0 * shadelight, shadecolor);
|
VectorScale (e->colormod, 2.0 * shadelight, shadecolor);
|
||||||
modelalpha = e->alpha;
|
modelalpha = e->colormod[3];
|
||||||
|
|
||||||
// locate the proper data
|
// locate the proper data
|
||||||
paliashdr = Cache_Get (&e->model->cache);
|
paliashdr = Cache_Get (&e->model->cache);
|
||||||
|
|
|
@ -115,7 +115,7 @@ R_DrawSpriteModel (entity_t *e)
|
||||||
VectorScale (right, e->scale, right);
|
VectorScale (right, e->scale, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
modelalpha = e->alpha;
|
modelalpha = e->colormod[3];
|
||||||
if (modelalpha < 1.0)
|
if (modelalpha < 1.0)
|
||||||
qfglDepthMask (GL_FALSE);
|
qfglDepthMask (GL_FALSE);
|
||||||
|
|
||||||
|
|
|
@ -65,11 +65,11 @@ R_Init_Entity (entity_t *ent)
|
||||||
memset (ent, 0, sizeof (*ent));
|
memset (ent, 0, sizeof (*ent));
|
||||||
|
|
||||||
ent->colormap = vid.colormap8;
|
ent->colormap = vid.colormap8;
|
||||||
ent->glow_size = 0;
|
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
|
||||||
|
ent->colormod[3] = 1.0;
|
||||||
|
ent->scale = 1.0;
|
||||||
|
ent->glow_size = 0.0;
|
||||||
ent->glow_color = 254;
|
ent->glow_color = 254;
|
||||||
ent->alpha = 1;
|
|
||||||
ent->scale = 1;
|
|
||||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1;
|
|
||||||
ent->pose1 = ent->pose2 = -1;
|
ent->pose1 = ent->pose2 = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -192,12 +192,11 @@ CL_ClearState (void)
|
||||||
|
|
||||||
for (i = 0; i < MAX_EDICTS; i++) {
|
for (i = 0; i < MAX_EDICTS; i++) {
|
||||||
cl_baselines[i].ent = &cl_entities[i];
|
cl_baselines[i].ent = &cl_entities[i];
|
||||||
cl_entities[i].alpha = 255;
|
cl_entities[i].colormod[0] = cl_entities[i].colormod[1] =
|
||||||
cl_entities[i].scale = 16;
|
cl_entities[i].colormod[2] = cl_entities[i].colormod[3] = 1.0;
|
||||||
|
cl_entities[i].scale = 16.0;
|
||||||
|
cl_entities[i].glow_size = 0.0;
|
||||||
cl_entities[i].glow_color = 254;
|
cl_entities[i].glow_color = 254;
|
||||||
cl_entities[i].glow_size = 0;
|
|
||||||
cl_entities[i].colormod[0] = cl_entities[i].colormod[1]
|
|
||||||
= cl_entities[i].colormod[2] = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -367,11 +367,11 @@ CL_ParseUpdate (int bits)
|
||||||
|
|
||||||
if (forcelink) {
|
if (forcelink) {
|
||||||
// FIXME: do this right (ie, protocol support)
|
// FIXME: do this right (ie, protocol support)
|
||||||
ent->alpha = 1;
|
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
|
||||||
ent->scale = 1;
|
ent->colormod[3] = 1.0;
|
||||||
|
ent->scale = 1.0;
|
||||||
|
ent->glow_size = 0.0;
|
||||||
ent->glow_color = 254;
|
ent->glow_color = 254;
|
||||||
ent->glow_size = 0;
|
|
||||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state->msgtime = cl.mtime[0];
|
state->msgtime = cl.mtime[0];
|
||||||
|
@ -496,8 +496,8 @@ CL_ParseBaseline (cl_entity_state_t *state)
|
||||||
// LordHavoc: set up baseline for new effects (alpha, colormod, etc)
|
// LordHavoc: set up baseline for new effects (alpha, colormod, etc)
|
||||||
state->baseline.alpha = 255;
|
state->baseline.alpha = 255;
|
||||||
state->baseline.scale = 16;
|
state->baseline.scale = 16;
|
||||||
state->baseline.glow_color = 254;
|
|
||||||
state->baseline.glow_size = 0;
|
state->baseline.glow_size = 0;
|
||||||
|
state->baseline.glow_color = 254;
|
||||||
state->baseline.colormod = 255;
|
state->baseline.colormod = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,21 +620,20 @@ CL_ParseStatic (void)
|
||||||
CL_ParseBaseline (&state);
|
CL_ParseBaseline (&state);
|
||||||
|
|
||||||
// copy it to the current state
|
// copy it to the current state
|
||||||
|
VectorCopy (state.baseline.origin, ent->origin);
|
||||||
|
VectorCopy (state.baseline.angles, ent->angles);
|
||||||
ent->model = cl.model_precache[state.baseline.modelindex];
|
ent->model = cl.model_precache[state.baseline.modelindex];
|
||||||
ent->frame = state.baseline.frame;
|
ent->frame = state.baseline.frame;
|
||||||
ent->colormap = vid.colormap8;
|
ent->colormap = vid.colormap8;
|
||||||
ent->skinnum = state.baseline.skin;
|
ent->skinnum = state.baseline.skin;
|
||||||
//FIXME ent->effects = state.baseline.effects;
|
//FIXME ent->effects = state.baseline.effects;
|
||||||
|
//FIXME need to get colormod from baseline
|
||||||
ent->alpha = state.baseline.alpha / 255.0;
|
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1.0;
|
||||||
|
ent->colormod[3] = state.baseline.alpha / 255.0;
|
||||||
ent->scale = state.baseline.scale / 16.0;
|
ent->scale = state.baseline.scale / 16.0;
|
||||||
ent->glow_color = state.baseline.glow_color;
|
|
||||||
ent->glow_size = state.baseline.glow_size;
|
ent->glow_size = state.baseline.glow_size;
|
||||||
//FIXME need to get this from baseline
|
ent->glow_color = state.baseline.glow_color;
|
||||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1;
|
|
||||||
|
|
||||||
VectorCopy (state.baseline.origin, ent->origin);
|
|
||||||
VectorCopy (state.baseline.angles, ent->angles);
|
|
||||||
R_AddEfrags (ent);
|
R_AddEfrags (ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,8 +130,8 @@ CL_Init_Entity (entity_t *ent)
|
||||||
memset (ent, 0, sizeof (*ent));
|
memset (ent, 0, sizeof (*ent));
|
||||||
|
|
||||||
ent->colormap = vid.colormap8;
|
ent->colormap = vid.colormap8;
|
||||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1.0;
|
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
|
||||||
ent->alpha = 1.0;
|
ent->colormod[3] = 1.0;
|
||||||
ent->scale = 1.0;
|
ent->scale = 1.0;
|
||||||
ent->glow_size = 0.0;
|
ent->glow_size = 0.0;
|
||||||
ent->glow_color = 254;
|
ent->glow_color = 254;
|
||||||
|
|
|
@ -673,8 +673,8 @@ V_CalcRefdef (void)
|
||||||
view->frame = cl.stats[STAT_WEAPONFRAME];
|
view->frame = cl.stats[STAT_WEAPONFRAME];
|
||||||
view->colormap = vid.colormap8;
|
view->colormap = vid.colormap8;
|
||||||
// LordHavoc: make gun visible
|
// LordHavoc: make gun visible
|
||||||
view->alpha = 1;
|
view->colormod[0] = view->colormod[1] = view->colormod[2] =
|
||||||
view->colormod[0] = view->colormod[1] = view->colormod[2] = 1;
|
view->colormod[3] = 1.0;
|
||||||
|
|
||||||
// set up the refresh position
|
// set up the refresh position
|
||||||
VectorAdd (r_refdef.viewangles, cl.punchangle, r_refdef.viewangles);
|
VectorAdd (r_refdef.viewangles, cl.punchangle, r_refdef.viewangles);
|
||||||
|
|
|
@ -465,15 +465,9 @@ CL_LinkPacketEntities (void)
|
||||||
// Ender: Extend (Colormod) [QSG - Begin]
|
// Ender: Extend (Colormod) [QSG - Begin]
|
||||||
// N.B: All messy code below is the sole fault of LordHavoc and
|
// N.B: All messy code below is the sole fault of LordHavoc and
|
||||||
// his futile attempts to save bandwidth. :)
|
// his futile attempts to save bandwidth. :)
|
||||||
(*ent)->glow_size = s1->glow_size < 128 ? s1->glow_size * 8.0 :
|
|
||||||
(s1->glow_size - 256) * 8.0;
|
|
||||||
(*ent)->glow_color = s1->glow_color;
|
|
||||||
(*ent)->alpha = s1->alpha / 255.0;
|
|
||||||
(*ent)->scale = s1->scale / 16.0;
|
|
||||||
|
|
||||||
if (s1->colormod == 255) {
|
if (s1->colormod == 255) {
|
||||||
(*ent)->colormod[0] = (*ent)->colormod[1] =
|
(*ent)->colormod[0] = (*ent)->colormod[1] =
|
||||||
(*ent)->colormod[2] = 1;
|
(*ent)->colormod[2] = 1.0;
|
||||||
} else {
|
} else {
|
||||||
(*ent)->colormod[0] = (float) ((s1->colormod >> 5) & 7) * (1.0 /
|
(*ent)->colormod[0] = (float) ((s1->colormod >> 5) & 7) * (1.0 /
|
||||||
7.0);
|
7.0);
|
||||||
|
@ -481,6 +475,11 @@ CL_LinkPacketEntities (void)
|
||||||
7.0);
|
7.0);
|
||||||
(*ent)->colormod[2] = (float) (s1->colormod & 3) * (1.0 / 3.0);
|
(*ent)->colormod[2] = (float) (s1->colormod & 3) * (1.0 / 3.0);
|
||||||
}
|
}
|
||||||
|
(*ent)->colormod[3] = s1->alpha / 255.0;
|
||||||
|
(*ent)->scale = s1->scale / 16.0;
|
||||||
|
(*ent)->glow_size = s1->glow_size < 128 ? s1->glow_size * 8.0 :
|
||||||
|
(s1->glow_size - 256) * 8.0;
|
||||||
|
(*ent)->glow_color = s1->glow_color;
|
||||||
// Ender: Extend (Colormod) [QSG - End]
|
// Ender: Extend (Colormod) [QSG - End]
|
||||||
|
|
||||||
// set skin
|
// set skin
|
||||||
|
@ -803,10 +802,38 @@ CL_LinkPlayers (void)
|
||||||
// stuff entity in map
|
// stuff entity in map
|
||||||
R_AddEfrags (ent);
|
R_AddEfrags (ent);
|
||||||
|
|
||||||
ent->frame = state->frame;
|
// only predict half the move to minimize overruns
|
||||||
|
msec = 500 * (playertime - state->state_time);
|
||||||
|
if (msec <= 0 || (!cl_predict_players->int_val)) {
|
||||||
|
VectorCopy (state->origin, ent->origin);
|
||||||
|
} else { // predict players movement
|
||||||
|
state->command.msec = msec = min (msec, 255);
|
||||||
|
|
||||||
|
oldphysent = pmove.numphysent;
|
||||||
|
CL_SetSolidPlayers (j);
|
||||||
|
CL_PredictUsercmd (state, &exact, &state->command, false);
|
||||||
|
pmove.numphysent = oldphysent;
|
||||||
|
VectorCopy (exact.origin, ent->origin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// angles
|
||||||
|
if (j == cl.playernum)
|
||||||
|
{
|
||||||
|
ent->angles[PITCH] = -cl.viewangles[PITCH] / 3;
|
||||||
|
ent->angles[YAW] = cl.viewangles[YAW];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ent->angles[PITCH] = -state->viewangles[PITCH] / 3;
|
||||||
|
ent->angles[YAW] = state->viewangles[YAW];
|
||||||
|
}
|
||||||
|
ent->angles[ROLL] = 0;
|
||||||
|
ent->angles[ROLL] = V_CalcRoll (ent->angles, state->velocity) * 4;
|
||||||
|
|
||||||
ent->model = cl.model_precache[state->modelindex];
|
ent->model = cl.model_precache[state->modelindex];
|
||||||
ent->skinnum = state->skinnum;
|
ent->frame = state->frame;
|
||||||
ent->colormap = info->translations;
|
ent->colormap = info->translations;
|
||||||
|
ent->skinnum = state->skinnum;
|
||||||
if (state->modelindex == cl_playerindex) { //XXX
|
if (state->modelindex == cl_playerindex) { //XXX
|
||||||
// use custom skin
|
// use custom skin
|
||||||
if (!info->skin)
|
if (!info->skin)
|
||||||
|
@ -825,39 +852,11 @@ CL_LinkPlayers (void)
|
||||||
|
|
||||||
// LordHavoc: more QSG VERSION 2 stuff, FIXME: players don't have
|
// LordHavoc: more QSG VERSION 2 stuff, FIXME: players don't have
|
||||||
// extend stuff
|
// extend stuff
|
||||||
ent->glow_size = 0;
|
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
|
||||||
|
ent->colormod[3] = 1.0;
|
||||||
|
ent->scale = 1.0;
|
||||||
|
ent->glow_size = 0.0;
|
||||||
ent->glow_color = 254;
|
ent->glow_color = 254;
|
||||||
ent->alpha = 1;
|
|
||||||
ent->scale = 1;
|
|
||||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1;
|
|
||||||
|
|
||||||
// angles
|
|
||||||
if (j == cl.playernum)
|
|
||||||
{
|
|
||||||
ent->angles[PITCH] = -cl.viewangles[PITCH] / 3;
|
|
||||||
ent->angles[YAW] = cl.viewangles[YAW];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ent->angles[PITCH] = -state->viewangles[PITCH] / 3;
|
|
||||||
ent->angles[YAW] = state->viewangles[YAW];
|
|
||||||
}
|
|
||||||
ent->angles[ROLL] = 0;
|
|
||||||
ent->angles[ROLL] = V_CalcRoll (ent->angles, state->velocity) * 4;
|
|
||||||
|
|
||||||
// only predict half the move to minimize overruns
|
|
||||||
msec = 500 * (playertime - state->state_time);
|
|
||||||
if (msec <= 0 || (!cl_predict_players->int_val)) {
|
|
||||||
VectorCopy (state->origin, ent->origin);
|
|
||||||
} else { // predict players movement
|
|
||||||
state->command.msec = msec = min (msec, 255);
|
|
||||||
|
|
||||||
oldphysent = pmove.numphysent;
|
|
||||||
CL_SetSolidPlayers (j);
|
|
||||||
CL_PredictUsercmd (state, &exact, &state->command, false);
|
|
||||||
pmove.numphysent = oldphysent;
|
|
||||||
VectorCopy (exact.origin, ent->origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state->effects & EF_FLAG1)
|
if (state->effects & EF_FLAG1)
|
||||||
CL_AddFlagModels (ent, 0, j);
|
CL_AddFlagModels (ent, 0, j);
|
||||||
|
|
|
@ -713,11 +713,11 @@ CL_ClearBaselines (void)
|
||||||
|
|
||||||
memset (cl_baselines, 0, sizeof (cl_baselines));
|
memset (cl_baselines, 0, sizeof (cl_baselines));
|
||||||
for (i = 0; i < MAX_EDICTS; i++) {
|
for (i = 0; i < MAX_EDICTS; i++) {
|
||||||
|
cl_baselines[i].colormod = 255;
|
||||||
cl_baselines[i].alpha = 255;
|
cl_baselines[i].alpha = 255;
|
||||||
cl_baselines[i].scale = 16;
|
cl_baselines[i].scale = 16;
|
||||||
cl_baselines[i].glow_color = 254;
|
|
||||||
cl_baselines[i].glow_size = 0;
|
cl_baselines[i].glow_size = 0;
|
||||||
cl_baselines[i].colormod = 255;
|
cl_baselines[i].glow_color = 254;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -816,11 +816,11 @@ CL_ParseBaseline (entity_state_t *es)
|
||||||
MSG_ReadCoordAngleV (net_message, es->origin, es->angles);
|
MSG_ReadCoordAngleV (net_message, es->origin, es->angles);
|
||||||
|
|
||||||
// LordHavoc: set up baseline to for new effects (alpha, colormod, etc)
|
// LordHavoc: set up baseline to for new effects (alpha, colormod, etc)
|
||||||
|
es->colormod = 255;
|
||||||
es->alpha = 255;
|
es->alpha = 255;
|
||||||
es->scale = 16;
|
es->scale = 16;
|
||||||
es->glow_color = 254;
|
|
||||||
es->glow_size = 0;
|
es->glow_size = 0;
|
||||||
es->colormod = 255;
|
es->glow_color = 254;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -135,8 +135,8 @@ CL_Init_Entity (entity_t *ent)
|
||||||
memset (ent, 0, sizeof (*ent));
|
memset (ent, 0, sizeof (*ent));
|
||||||
|
|
||||||
ent->colormap = vid.colormap8;
|
ent->colormap = vid.colormap8;
|
||||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1.0;
|
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
|
||||||
ent->alpha = 1.0;
|
ent->colormod[3] = 1.0;
|
||||||
ent->scale = 1.0;
|
ent->scale = 1.0;
|
||||||
ent->glow_size = 0.0;
|
ent->glow_size = 0.0;
|
||||||
ent->glow_color = 254;
|
ent->glow_color = 254;
|
||||||
|
|
|
@ -697,8 +697,8 @@ V_CalcRefdef (void)
|
||||||
view->frame = view_message->weaponframe;
|
view->frame = view_message->weaponframe;
|
||||||
view->colormap = vid.colormap8;
|
view->colormap = vid.colormap8;
|
||||||
// LordHavoc: make gun visible
|
// LordHavoc: make gun visible
|
||||||
view->alpha = 1;
|
view->colormod[0] = view->colormod[1] = view->colormod[2] =
|
||||||
view->colormod[0] = view->colormod[1] = view->colormod[2] = 1;
|
view->colormod[3] = 1.0;
|
||||||
|
|
||||||
// set up the refresh position
|
// set up the refresh position
|
||||||
r_refdef.viewangles[PITCH] += cl.punchangle;
|
r_refdef.viewangles[PITCH] += cl.punchangle;
|
||||||
|
|
Loading…
Reference in a new issue