diff --git a/source/cl_ents.c b/source/cl_ents.c index fe11665..e2673eb 100644 --- a/source/cl_ents.c +++ b/source/cl_ents.c @@ -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<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] diff --git a/source/gl_rmain.c b/source/gl_rmain.c index 8ea393c..3fbdbc3 100644 --- a/source/gl_rmain.c +++ b/source/gl_rmain.c @@ -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); diff --git a/source/pr_offs.c b/source/pr_offs.c index 8b5f0a6..ad96271 100644 --- a/source/pr_offs.c +++ b/source/pr_offs.c @@ -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"); }; diff --git a/source/sv_ents.c b/source/sv_ents.c index 84db238..bbe5733 100644 --- a/source/sv_ents.c +++ b/source/sv_ents.c @@ -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; } }