diff --git a/common/cl_ents.c b/common/cl_ents.c index dfc6e80..21e0692 100644 --- a/common/cl_ents.c +++ b/common/cl_ents.c @@ -100,39 +100,46 @@ dlight_t *CL_AllocDlight (int key) /* =============== CL_NewDlight + +Note, this is just a quick short cut for a few colors, if you need other +colors please just create your own dlight, instead of extending this.. =============== */ -void CL_NewDlight (int key, float x, float y, float z, float radius, float time, - int type) +void CL_NewDlight (int key, vec3_t origin, float radius, float time, int type) { dlight_t *dl; dl = CL_AllocDlight (key); - dl->origin[0] = x; - dl->origin[1] = y; - dl->origin[2] = z; + dl->origin[0] = origin[0]; + dl->origin[1] = origin[1]; + dl->origin[2] = origin[2]; dl->radius = radius; dl->die = cl.time + time; - if (type == 0) { - dl->color[0] = 0.2; - dl->color[1] = 0.1; - dl->color[2] = 0.05; - dl->color[3] = 0.7; - } else if (type == 1) { - dl->color[0] = 0.05; - dl->color[1] = 0.05; - dl->color[2] = 0.3; - dl->color[3] = 0.7; - } else if (type == 2) { - dl->color[0] = 0.5; - dl->color[1] = 0.05; - dl->color[2] = 0.05; - dl->color[3] = 0.7; - } else if (type == 3) { - dl->color[0]=0.5; - dl->color[1] = 0.05; - dl->color[2] = 0.4; - dl->color[3] = 0.7; + switch (type) { + case 0: + dl->color[0] = 0.2; + dl->color[1] = 0.1; + dl->color[2] = 0.05; + dl->color[3] = 0.7; + break; + case 1: // Blue + dl->color[0] = 0.05; + dl->color[1] = 0.05; + dl->color[2] = 0.5; + dl->color[3] = 0.7; + break; + case 2: // Red + dl->color[0] = 0.5; + dl->color[1] = 0.05; + dl->color[2] = 0.05; + dl->color[3] = 0.7; + break; + case 3: // Blue and Red + dl->color[0] = 0.5; + dl->color[1] = 0.05; + dl->color[2] = 0.5; + dl->color[3] = 0.7; + break; } } @@ -455,16 +462,19 @@ void CL_LinkPacketEntities (void) s2 = s1; // FIXME: no interpolation right now // spawn light flashes, even ones coming from invisible objects - if ((s1->effects & (EF_BLUE | EF_RED)) == (EF_BLUE | EF_RED)) - CL_NewDlight (s1->number, s1->origin[0], s1->origin[1], s1->origin[2], 200 + (rand()&31), 0.1, 3); - else if (s1->effects & EF_BLUE) - CL_NewDlight (s1->number, s1->origin[0], s1->origin[1], s1->origin[2], 200 + (rand()&31), 0.1, 1); - else if (s1->effects & EF_RED) - CL_NewDlight (s1->number, s1->origin[0], s1->origin[1], s1->origin[2], 200 + (rand()&31), 0.1, 2); - else if (s1->effects & EF_BRIGHTLIGHT) - CL_NewDlight (s1->number, s1->origin[0], s1->origin[1], s1->origin[2] + 16, 400 + (rand()&31), 0.1, 0); - else if (s1->effects & EF_DIMLIGHT) - CL_NewDlight (s1->number, s1->origin[0], s1->origin[1], s1->origin[2], 200 + (rand()&31), 0.1, 0); + if ((s1->effects & (EF_BLUE | EF_RED)) == (EF_BLUE | EF_RED)) { + CL_NewDlight (s1->number, s1->origin, 200 + (rand()&31), 0.1, 3); + } else if (s1->effects & EF_BLUE) { + CL_NewDlight (s1->number, s1->origin, 200 + (rand()&31), 0.1, 1); + } else if (s1->effects & EF_RED) { + CL_NewDlight (s1->number, s1->origin, 200 + (rand()&31), 0.1, 2); + } else if (s1->effects & EF_BRIGHTLIGHT) { + s1->origin[2] += 16; + CL_NewDlight (s1->number, s1->origin, 400 + (rand()&31), 0.1, 0); + s1->origin[2] -= 16; + } else if (s1->effects & EF_DIMLIGHT) { + CL_NewDlight (s1->number, s1->origin, 200 + (rand()&31), 0.1, 0); + } // if set to invisible, skip if (!s1->modelindex) @@ -839,16 +849,19 @@ void CL_LinkPlayers (void) // spawn light flashes, even ones coming from invisible objects if (!gl_flashblend->value || j != cl.playernum) { - if ((state->effects & (EF_BLUE | EF_RED)) == (EF_BLUE | EF_RED)) - CL_NewDlight (j, state->origin[0], state->origin[1], state->origin[2], 200 + (rand()&31), 0.1, 3); - else if (state->effects & EF_BLUE) - CL_NewDlight (j, state->origin[0], state->origin[1], state->origin[2], 200 + (rand()&31), 0.1, 1); - else if (state->effects & EF_RED) - CL_NewDlight (j, state->origin[0], state->origin[1], state->origin[2], 200 + (rand()&31), 0.1, 2); - else if (state->effects & EF_BRIGHTLIGHT) - CL_NewDlight (j, state->origin[0], state->origin[1], state->origin[2] + 16, 400 + (rand()&31), 0.1, 0); - else if (state->effects & EF_DIMLIGHT) - CL_NewDlight (j, state->origin[0], state->origin[1], state->origin[2], 200 + (rand()&31), 0.1, 0); + if ((state->effects & (EF_BLUE | EF_RED)) == (EF_BLUE | EF_RED)) { + CL_NewDlight (j, state->origin, 200 + (rand()&31), 0.1, 3); + } else if (state->effects & EF_BLUE) { + CL_NewDlight (j, state->origin, 200 + (rand()&31), 0.1, 1); + } else if (state->effects & EF_RED) { + CL_NewDlight (j, state->origin, 200 + (rand()&31), 0.1, 2); + } else if (state->effects & EF_BRIGHTLIGHT) { + state->origin[2] += 16; + CL_NewDlight (j, state->origin, 400 + (rand()&31), 0.1, 0); + state->origin[2] -= 16; + } else if (state->effects & EF_DIMLIGHT) { + CL_NewDlight (j, state->origin, 200 + (rand()&31), 0.1, 0); + } } // the player object never gets added diff --git a/common/cl_main.c b/common/cl_main.c index 91d88aa..00c82b1 100644 --- a/common/cl_main.c +++ b/common/cl_main.c @@ -754,7 +754,9 @@ void CL_FullServerinfo_f (void) return; } + Con_DPrintf("Cmd_Argv(1): '%s'\n", Cmd_Argv(1)); strcpy (cl.serverinfo, Cmd_Argv(1)); + Con_DPrintf("cl.serverinfo: '%s'\n", cl.serverinfo); if ((p = Info_ValueForKey(cl.serverinfo, "*qf_version")) && *p) { if (!server_version) diff --git a/common/gl_rlight.c b/common/gl_rlight.c index 0b73f01..cde1c67 100644 --- a/common/gl_rlight.c +++ b/common/gl_rlight.c @@ -108,13 +108,13 @@ void R_InitBubble() { void R_RenderDlight (dlight_t *light) { int i, j; -// float a; + float a; vec3_t v; float rad; - float *bub_sin, *bub_cos; +// float *bub_sin, *bub_cos; - bub_sin = bubble_sintable; - bub_cos = bubble_costable; + //bub_sin = bubble_sintable; + //bub_cos = bubble_costable; rad = light->radius * 0.35; VectorSubtract (light->origin, r_origin, v); @@ -137,12 +137,17 @@ void R_RenderDlight (dlight_t *light) glColor3f (0,0,0); for (i=16 ; i>=0 ; i--) { -// a = i/16.0 * M_PI*2; + a = i/16.0 * M_PI*2; + for (j=0 ; j<3 ; j++) + v[j] = light->origin[j] + vright[j]*cos(a)*rad + vup[j]*sin(a)*rad; + + /* for (j=0 ; j<3 ; j++) v[j] = light->origin[j] + (vright[j]*(*bub_cos) + + vup[j]*(*bub_sin)) * rad; bub_sin++; bub_cos++; + */ glVertex3fv (v); } glEnd (); diff --git a/common/gl_rmain.c b/common/gl_rmain.c index a990446..efe83f0 100644 --- a/common/gl_rmain.c +++ b/common/gl_rmain.c @@ -328,11 +328,11 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum) // normals and vertexes come from the frame list - l = shadedots[verts->lightnormalindex] - * shadelight[3]; + l = shadedots[verts->lightnormalindex] * shadelight[3]; if (shadelight[0] || shadelight[1] || shadelight[2]) - glColor3f (l*shadelight[0], l*shadelight[1], - l*shadelight[2]); + //glColor3f (l*shadelight[0], l*shadelight[1], l*shadelight[2]); + glColor3f (min(l+shadelight[0], 1), min(l+shadelight[1], 1), + min(l+shadelight[2], 1)); else glColor3f (l, l, l); @@ -481,12 +481,9 @@ R_DrawAliasModel (entity_t *e) { // ZOID: models should be affected by // dlights as well if (r_dynamic->value) { - shadelight[0] += - cl_dlights[lnum].color[0]; - shadelight[1] += - cl_dlights[lnum].color[1]; - shadelight[2] += - cl_dlights[lnum].color[2]; + shadelight[0] += cl_dlights[lnum].color[0]; + shadelight[1] += cl_dlights[lnum].color[1]; + shadelight[2] += cl_dlights[lnum].color[2]; shadelight[3] += add; } } diff --git a/common/gl_rsurf.c b/common/gl_rsurf.c index 7e2656c..aa7ed2b 100644 --- a/common/gl_rsurf.c +++ b/common/gl_rsurf.c @@ -1184,8 +1184,7 @@ void R_DrawBrushModel (entity_t *e) { for (k=0 ; k