Again, patched for colormod and other extend bits.

This commit is contained in:
James Brown 2000-06-25 20:53:26 +00:00
parent 089a0a35d0
commit 3a43cea3b7
4 changed files with 36 additions and 22 deletions

View File

@ -205,12 +205,12 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits)
}
// count the bits for net profiling
for (i=0 ; i<16 ; i++)
if (bits&(1<<i))
bitcounts[i]++;
// for (i=0 ; i<16 ; i++)
// if (bits&(1<<i))
// bitcounts[i]++;
if (bits & U_EXTEND1)
{
{
bits |= MSG_ReadByte() << 16;
if (bits & U_EXTEND2)
bits |= MSG_ReadByte() << 24;
@ -258,8 +258,10 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits)
if (bits & U_GLOWCOLOR)
to->glowcolor = MSG_ReadByte();
if (bits & U_GLOWCOLOR)
if (bits & U_COLORMOD) {
to->colormod = MSG_ReadByte();
Con_Printf("CM: %d\n)", (float) to->colormod);
}
if (bits & U_SOLID)
{
@ -522,9 +524,14 @@ void CL_LinkPacketEntities (void)
//
ent->glowsize = s1->glowsize < 128 ? s1->glowsize * 8.0 : (s1->glowsize - 256) * 8.0;
ent->glowcolor = s1->glowcolor;
ent->colormod[0] = (float) ((s1->colormod >> 5) & 7) * (1.0 / 7.0);
ent->colormod[1] = (float) ((s1->colormod >> 2) & 7) * (1.0 / 7.0);
ent->colormod[2] = (float) (s1->colormod & 3) * (1.0 / 3.0);
if (s1->colormod) {
ent->colormod[0] = (float) ((s1->colormod >> 5) & 7) * (1.0 / 7.0);
ent->colormod[1] = (float) ((s1->colormod >> 2) & 7) * (1.0 / 7.0);
ent->colormod[2] = (float) (s1->colormod & 3) * (1.0 / 3.0);
Con_Printf("Colormod: %d %d %d\n", ent->colormod[0], ent->colormod[1], ent->colormod[2]);
} else {
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 0;
}
//
// Ender: Extend (Colormod) [QSG - End]

View File

@ -392,12 +392,15 @@ void GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum)
// normals and vertexes come from the frame list
l = shadedots[verts->lightnormalindex] * shadelight;
// Ender: Test (Colormod)
// if (shadecolor[0] || shadecolor[1] || shadecolor[2]) {
// glColor3f(shadecolor[0] * l, shadecolor[1] * l, shadecolor[2] * l);
// } else {
glColor3f (l, l, l);
// }
// Ender: Test (Colormod) [QSG Begin]
if (shadecolor[0] || shadecolor[1] || shadecolor[2]) {
glColor3f(shadecolor[0] * l, shadecolor[1] * l, shadecolor[2] * l);
} else {
glColor3f (l, l, l);
}
// Ender: Test (Colormod) [QSG End]
glVertex3f (verts->v[0], verts->v[1], verts->v[2]);
verts++;
} while (--count);

View File

@ -50,24 +50,26 @@ int FindFieldOffset(char *field)
{
ddef_t *d;
d = ED_FindField(field);
if (!d)
if (!d)
return 0;
return d->ofs*4;
}
eval_t *GETEDICTFIELDVALUE(edict_t *ed, int fieldoffset)
{
if (!fieldoffset)
return NULL;
if (!fieldoffset)
return NULL;
return (eval_t*)((char*)&ed->v + fieldoffset);
}
void FindEdictFieldOffsets()
{
eval_alpha = FindFieldOffset("alpha");
eval_fullbright = FindFieldOffset("fullbright");
eval_colormod = FindFieldOffset("colormod");
eval_fullbright = FindFieldOffset("fullbright");
eval_colormod = FindFieldOffset("colormod");
eval_glowsize = FindFieldOffset("glow_size");
eval_glowcolor = FindFieldOffset("glow_color");
};

View File

@ -223,7 +223,8 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
if (stdver > 1) {
if (to->glowsize != from->glowsize) bits |= U_GLOWSIZE;
if (to->glowcolor != from->glowcolor) bits |= U_GLOWCOLOR;
if (to->colormod != from->colormod) bits |= U_COLORMOD;
// LordHavocFIX
// if (to->colormod != from->colormod) bits |= U_COLORMOD;
}
if (bits >= 16777216)
@ -568,7 +569,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
eval_t *val;
state->glowsize = 0;
state->glowcolor = 254;
state->colormod = 255;
state->colormod = 0;
if (val = GETEDICTFIELDVALUE(ent, eval_glowsize)) {
state->glowsize = (int) val->_float >> 3;
@ -586,7 +587,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
if (val = GETEDICTFIELDVALUE(ent, eval_colormod)) {
if (val->vector[0] != 0 || val->vector[1] != 0 || val->vector[2] != 0) {
int modred, modgreen, modblue;
Con_Printf("Setting colormod! :)\n");
modred = val->vector[0] * 8.0;
if (modred < 0) modred = 0;
if (modred > 7) modred = 7;
@ -599,6 +600,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
if (modblue < 0) modblue = 0;
if (modblue > 3) modblue = 3;
// Con_Printf("Colormod: %d %d %d\n", modred, modgreen, modblue);
state->colormod = (modred << 5) | (modgreen << 2) | modblue;
}
}