"?", // 47
"?", // 48
"?", // 49
- "svc_skyboxsize", // [coord] size
+ "svc_farclip", // [coord] size
"svc_fog" // [byte] enable <optional past this point, only included if enable is true> [short * 4096] density [byte] red [byte] green [byte] blue
};
extern float fog_blue;
extern void R_SetSkyBox (char *sky);
extern void FOG_clear();
+extern cvar_t r_farclip;
void CL_ParseEntityLump(char *entdata)
{
int i, j, k;
FOG_clear(); // LordHavoc: no fog until set
skyname[0] = 0; // LordHavoc: no enviroment mapped sky until set
-// r_skyboxsize.value = 4096; // LordHavoc: default skyboxsize
+ r_farclip.value = 6144; // LordHavoc: default farclip distance
data = entdata;
if (!data)
return;
R_SetSkyBox(value);
else if (!strcmp("qlsky", key)) // non-standard, introduced by QuakeLives (EEK)
R_SetSkyBox(value);
-// else if (!strcmp("skyboxsize", key))
-// {
-// r_skyboxsize.value = atof(value);
-// if (r_skyboxsize.value < 64)
-// r_skyboxsize.value = 64;
-// }
+ else if (!strcmp("farclip", key))
+ {
+ r_farclip.value = atof(value);
+ if (r_farclip.value < 64)
+ r_farclip.value = 64;
+ }
else if (!strcmp("fog", key))
{
scanf(value, "%f %f %f %f", &fog_density, &fog_red, &fog_green, &fog_blue);
case svc_showlmp:
SHOWLMP_decodeshow();
break;
- // LordHavoc: extra worldspawn fields (fog, sky, skyboxsize)
+ // LordHavoc: extra worldspawn fields (fog, sky, farclip)
case svc_skybox:
R_SetSkyBox(MSG_ReadString());
break;
- case svc_skyboxsize:
- i = MSG_ReadCoord();
- // r_skyboxsize.value = MSG_ReadCoord();
+ case svc_farclip:
+ r_farclip.value = MSG_ReadCoord();
break;
case svc_fog:
if (MSG_ReadByte())
pos[2] = MSG_ReadCoord ();
colorStart = MSG_ReadByte ();
colorLength = MSG_ReadByte ();
-// R_ParticleExplosion2 (pos, colorStart, colorLength);
+ R_ParticleExplosion2 (pos, colorStart, colorLength);
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 350;
dl->die = cl.time + 0.5;
dl->decay = 700;
tempcolor = (byte *)&d_8to24table[(rand()%colorLength) + colorStart];
- dl->color[0] = tempcolor[0];dl->color[1] = tempcolor[1];dl->color[2] = tempcolor[2];
+ dl->color[0] = tempcolor[0] * (1.0f / 255.0f);dl->color[1] = tempcolor[1] * (1.0f / 255.0f);dl->color[2] = tempcolor[2] * (1.0f / 255.0f);
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
}
int transpolyindices;
+extern qboolean isG200;
+
+/*
void transpolyrenderminmax()
{
int i, j, k, lastvert;
if (max < 4) // free to check here, so skip polys behind the view
continue;
transpoly[i].distance = average;
+*/
/*
transpoly[i].mindistance = min;
transpoly[i].maxdistance = max;
;
}
*/
+/*
// sorted insert
for (j = 0;j < transpolyindices;j++)
if (transpoly[transpolyindex[j]].distance < average)
transpolyindex[j] = i;
}
}
-
-// LordHavoc: qsort compare function
+*/
/*
+// LordHavoc: qsort compare function
int transpolyqsort(const void *ia, const void *ib)
{
transpoly_t *a, *b;
return -1; // (-1) a is behind b
return j == b->verts; // (1) a is infront of b (0) a and b intersect
// return (transpoly[*((unsigned short *)ib)].mindistance + transpoly[*((unsigned short *)ib)].maxdistance) - (transpoly[*((unsigned short *)ia)].mindistance + transpoly[*((unsigned short *)ia)].maxdistance);
+ */
+/*
+ return ((transpoly_t*)ia)->distance - ((transpoly_t*)ib)->distance;
}
*/
-extern qboolean isG200;
+int transpolyqsort(const void *ia, const void *ib)
+{
+ return (transpoly[*((unsigned short *)ib)].distance - transpoly[*((unsigned short *)ia)].distance);
+}
-/*
-void transpolysort()
+void transpolyrenderminmax()
{
+ int i, j, lastvert;
+ vec_t d, max, viewdist, average;
+ transpolyindices = 0;
+ viewdist = DotProduct(r_refdef.vieworg, vpn);
+ for (i = 0;i < currenttranspoly;i++)
+ {
+ if (transpoly[i].verts < 3) // only process valid polygons
+ continue;
+ max = -1000000;
+ lastvert = transpoly[i].firstvert + transpoly[i].verts;
+ average = 0;
+ for (j = transpoly[i].firstvert;j < lastvert;j++)
+ {
+ d = DotProduct(transvert[j].v, vpn)-viewdist;
+ average += d;
+ if (d > max)
+ max = d;
+ }
+ if (max < 4) // free to check here, so skip polys behind the view
+ continue;
+ transpoly[i].distance = average / transpoly[i].verts;
+ transpolyindex[transpolyindices++] = i;
+ }
+ qsort(&transpolyindex[0], transpolyindices, sizeof(unsigned short), transpolyqsort);
+}
+/*
int i, j, a;
-// qsort(&transpolyindex[0], transpolyindices, sizeof(unsigned short), transpolyqsort);
a = true;
while(a)
{
wallvert_t *vert;
if (currentwallpoly < 1)
return;
+ c_brush_polys += currentwallpoly;
// testing
//Con_DPrintf("wallpolyrender: %i polys %i vertices\n", currentwallpoly, currentwallvert);
if (!gl_mtexable)
cvar_t gl_lightmode = {"gl_lightmode", "1", TRUE}; // LordHavoc: overbright lighting
//cvar_t r_dynamicwater = {"r_dynamicwater", "1"};
//cvar_t r_dynamicbothsides = {"r_dynamicbothsides", "1"}; // LordHavoc: can disable dynamic lighting of backfaces, but quake maps are weird so it doesn't always work right...
+cvar_t r_farclip = {"r_farclip", "6144"};
cvar_t gl_fogenable = {"gl_fogenable", "0"};
cvar_t gl_fogdensity = {"gl_fogdensity", "0.25"};
}
-void MYgluPerspective( GLdouble fovy, GLdouble aspect,
- GLdouble zNear, GLdouble zFar )
+void MYgluPerspective( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar )
{
GLdouble xmin, xmax, ymin, ymax;
// if (skyname[0]) // skybox enabled?
// MYgluPerspective (r_refdef.fov_y, screenaspect, 4, r_skyboxsize.value*1.732050807569 + 256); // this is size*sqrt(3) + 256
// else
- MYgluPerspective (r_refdef.fov_y, screenaspect, 4, 6144);
+ MYgluPerspective (r_refdef.fov_y, screenaspect, 4, r_farclip.value);
glCullFace(GL_FRONT);
{
cl.worldmodel->textures[j]->texturechain = NULL;
t = R_TextureAnimation (cl.worldmodel->textures[j]);
- c_brush_polys++;
for (;s;s = s->texturechain)
{
if (currentwallpoly < MAX_WALLPOLYS && currentwallvert < MAX_WALLVERTS && (currentwallvert + s->polys->numverts) <= MAX_WALLVERTS)
}
continue;
}
- c_brush_polys++;
t = R_TextureAnimation (s->texinfo->texture);
v = s->polys->verts[0];
if (vertexlit || s->texinfo->texture->transparent)
}
}
-extern cvar_t r_skyboxsize;
+extern cvar_t r_farclip;
#define R_SkyBoxPolyVec(s,t,x,y,z) \
glTexCoord2f((s) * (254.0f/256.0f) + (1.0f/256.0f), (t) * (254.0f/256.0f) + (1.0f/256.0f));\
if (!def)
{
// LordHavoc: don't warn about worldspawn sky/fog fields because they don't require mod support
- if (strcmp(s, "sky") && strncmp(s, "fog_", 4) && strcmp(s, "skyboxsize"))
+ if (strcmp(s, "sky") && strcmp(s, "fog") && strncmp(s, "fog_", 4) && strcmp(s, "farclip"))
Con_DPrintf ("Can't find field %s\n", s);
return false;
}
case OP_DIV_FI:
OPC->_float = OPA->_float / (float) OPB->_int;
break;
+ case OP_CONV_IF:
+ OPC->_float = OPA->_int;
+ break;
+ case OP_CONV_FI:
+ OPC->_int = OPA->_float;
+ break;
case OP_BITAND_I:
OPC->_int = OPA->_int & OPB->_int;
break;
#define svc_hidelmp 36 // [string] slotname
#define svc_skybox 37 // [string] skyname
-#define svc_skyboxsize 50 // [coord] size (default is 4096)
+#define svc_farclip 50 // [coord] size (default is 6144)
#define svc_fog 51 // [byte] enable <optional past this point, only included if enable is true> [float] density [byte] red [byte] green [byte] blue
//
}
}
+void R_CompleteLightPoint (vec3_t color, vec3_t p)
+{
+ R_LightPoint(color, p);
+ R_DynamicLightPointNoMask(color, p);
+}
+
extern float *aliasvert;
extern float *aliasvertnorm;
extern byte *aliasvertcolor;
vec3_t r_pright, r_pup, r_ppn;
-cvar_t r_particles = {"r_particles", "1", true};
+cvar_t r_particles = {"r_particles", "1"};
+cvar_t r_dynamicparticles = {"r_dynamicparticles", "1"};
void fractalnoise(char *noise, int size);
void fractalnoise_zeroedge(char *noise, int size);
vec3_t normal, light;
particletexture = texture_extension_number++;
- glBindTexture(GL_TEXTURE_2D, particletexture);
+ glBindTexture(GL_TEXTURE_2D, particletexture);
for (x=0 ; x<32 ; x++)
{
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
flareparticletexture = texture_extension_number++;
- glBindTexture(GL_TEXTURE_2D, flareparticletexture);
+ glBindTexture(GL_TEXTURE_2D, flareparticletexture);
for (x=0 ; x<32 ; x++)
{
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
rainparticletexture = texture_extension_number++;
- glBindTexture(GL_TEXTURE_2D, rainparticletexture);
+ glBindTexture(GL_TEXTURE_2D, rainparticletexture);
for (x=0 ; x<32 ; x++)
{
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
bubbleparticletexture = texture_extension_number++;
- glBindTexture(GL_TEXTURE_2D, bubbleparticletexture);
+ glBindTexture(GL_TEXTURE_2D, bubbleparticletexture);
light[0] = 1;light[1] = 1;light[2] = 1;
VectorNormalize(light);
particles = (particle_t *) Hunk_AllocName (r_numparticles * sizeof(particle_t), "particles");
Cvar_RegisterVariable (&r_particles);
+ Cvar_RegisterVariable (&r_dynamicparticles);
R_InitParticleTexture ();
}
p->next = active_particles;
active_particles = p;
- p->texnum = smokeparticletexture[rand()&7];
+ p->texnum = particletexture;
p->scale = lhrandom(1,3);
p->alpha = rand()&255;
p->die = cl.time + 5;
for (j=0 ; j<3 ; j++)
{
p->org[j] = org[j] + ((rand()&15)-8);
- p->vel[j] = lhrandom(-128, 128);
+ p->vel[j] = lhrandom(-192, 192);
}
}
}
free_particles = p->next;
p->next = active_particles;
active_particles = p;
- if (count & 3)
+ if (count & 7)
{
- p->alpha = (count & 3) * 16 + (rand()&15);
- count &= ~3;
+ p->alpha = (count & 7) * 16 + (rand()&15);
+ count &= ~7;
}
else
{
- p->alpha = 64;
- count -= 4;
+ p->alpha = 128;
+ count -= 8;
}
p->texnum = particletexture;
===============
*/
extern cvar_t sv_gravity;
+void R_CompleteLightPoint (vec3_t color, vec3_t p);
void R_DrawParticles (void)
{
int i, r,g,b,a;
float grav, grav1, time1, time2, time3, dvel, frametime, scale, scale2;
byte *color24;
- vec3_t up, right, uprightangles, forward2, up2, right2, v;
+ vec3_t up, right, uprightangles, forward2, up2, right2, v, tempcolor;
// LordHavoc: early out condition
if (!active_particles)
g >>= 1;
b >>= 1;
}
+ if (r_dynamicparticles.value)
+ {
+ R_CompleteLightPoint(tempcolor, p->org);
+ r = (r * (int) tempcolor[0]) >> 7;
+ g = (g * (int) tempcolor[1]) >> 7;
+ b = (b * (int) tempcolor[2]) >> 7;
+ }
transpolybegin(p->texnum, 0, p->texnum, TPOLYTYPE_ALPHA);
if (p->texnum == rainparticletexture) // rain streak
{