vec3_t vert[3];
vec3_t normal;
vec3_t center;
+ mplane_t plane;
r_waterstate_waterplane_t *p;
// just use the first triangle with a valid normal for any decisions
VectorClear(normal);
break;
}
+ VectorCopy(normal, plane.normal);
+ VectorNormalize(plane.normal);
+ plane.dist = DotProduct(vert[0], plane.normal);
+ PlaneClassify(&plane);
+ if (PlaneDiff(r_refdef.view.origin, &plane) < 0)
+ {
+ // skip backfaces (except if nocullface is set)
+ if (!(surface->texture->currentframe->currentmaterialflags & MATERIALFLAG_NOCULLFACE))
+ return;
+ VectorNegate(plane.normal, plane.normal);
+ plane.dist *= -1;
+ PlaneClassify(&plane);
+ }
+
+
// find a matching plane if there is one
for (planeindex = 0, p = r_waterstate.waterplanes;planeindex < r_waterstate.numwaterplanes;planeindex++, p++)
if (fabs(PlaneDiff(vert[0], &p->plane)) < 1 && fabs(PlaneDiff(vert[1], &p->plane)) < 1 && fabs(PlaneDiff(vert[2], &p->plane)) < 1)
{
// store the new plane
r_waterstate.numwaterplanes++;
- VectorCopy(normal, p->plane.normal);
- VectorNormalize(p->plane.normal);
- p->plane.dist = DotProduct(vert[0], p->plane.normal);
- PlaneClassify(&p->plane);
- // flip the plane if it does not face the viewer
- if (PlaneDiff(r_refdef.view.origin, &p->plane) < 0)
- {
- VectorNegate(p->plane.normal, p->plane.normal);
- p->plane.dist *= -1;
- PlaneClassify(&p->plane);
- }
+ p->plane = plane;
// clear materialflags and pvs
p->materialflags = 0;
p->pvsvalid = false;
{"override/%s.png", PNG_LoadImage_BGRA},
{"override/%s.jpg", JPEG_LoadImage_BGRA},
{"override/%s.pcx", LoadPCX_BGRA},
+ {"%s.tga", LoadTGA_BGRA},
+ {"%s.png", PNG_LoadImage_BGRA},
+ {"%s.jpg", JPEG_LoadImage_BGRA},
+ {"%s.pcx", LoadPCX_BGRA},
{NULL, NULL}
};
unsigned char *data, *mtdata;
const char *s;
char mapname[MAX_QPATH], name[MAX_QPATH];
+ unsigned char zero[4];
+
+ memset(zero, 0, sizeof(zero));
loadmodel->data_textures = NULL;
if (tx->name[0] == '*')
{
// LordHavoc: some turbulent textures should not be affected by wateralpha
- if (strncmp(tx->name,"*lava",5)
- && strncmp(tx->name,"*teleport",9)
- && strncmp(tx->name,"*rift",5)) // Scourge of Armagon texture
- tx->basematerialflags |= MATERIALFLAG_WATERALPHA | MATERIALFLAG_NOSHADOW | MATERIALFLAG_WATERSHADER;
- tx->basematerialflags |= MATERIALFLAG_WATER | MATERIALFLAG_LIGHTBOTHSIDES | MATERIALFLAG_NOSHADOW;
+ if (!strncmp(tx->name, "*glassmirror", 12)) // Tenebrae
+ {
+ // replace the texture with transparent black
+ tx->skinframes[0] = R_SkinFrame_LoadInternalBGRA(tx->name, TEXF_MIPMAP | TEXF_PRECACHE, zero, 1, 1);
+ tx->basematerialflags |= MATERIALFLAG_WATER | MATERIALFLAG_NOSHADOW | MATERIALFLAG_ADD | MATERIALFLAG_BLENDED | MATERIALFLAG_REFLECTION;
+ }
+ else if (!strncmp(tx->name,"*lava",5)
+ || !strncmp(tx->name,"*teleport",9)
+ || !strncmp(tx->name,"*rift",5)) // Scourge of Armagon texture
+ tx->basematerialflags |= MATERIALFLAG_WATER | MATERIALFLAG_LIGHTBOTHSIDES | MATERIALFLAG_NOSHADOW;
+ else
+ tx->basematerialflags |= MATERIALFLAG_WATER | MATERIALFLAG_LIGHTBOTHSIDES | MATERIALFLAG_NOSHADOW | MATERIALFLAG_WATERALPHA | MATERIALFLAG_WATERSHADER;
+ }
+ else if (!strncmp(tx->name, "mirror", 6)) // Tenebrae
+ {
+ // replace the texture with transparent black
+ tx->skinframes[0] = R_SkinFrame_LoadInternalBGRA(tx->name, TEXF_PRECACHE, zero, 1, 1);
+ tx->basematerialflags |= MATERIALFLAG_WALL | MATERIALFLAG_REFLECTION;
}
else if (!strncmp(tx->name, "sky", 3))
tx->basematerialflags |= MATERIALFLAG_SKY | MATERIALFLAG_NOSHADOW;
+ else if (!strcmp(tx->name, "caulk"))
+ tx->basematerialflags = MATERIALFLAG_NODRAW;
else
tx->basematerialflags |= MATERIALFLAG_WALL;
if (tx->skinframes[0] && tx->skinframes[0]->fog)
} entvars_t;
#define PROGHEADER_CRC 5927
+#define PROGHEADER_CRC_TENEBRAE 32401
#endif
int localstack_used;
unsigned short headercrc; // [INIT]
+ unsigned short headercrc2; // [INIT] alternate CRC for tenebrae progs.dat
unsigned short filecrc;
if (prog->progs->version != PROG_VERSION)
PRVM_ERROR ("%s: %s has wrong version number (%i should be %i)", PRVM_NAME, filename, prog->progs->version, PROG_VERSION);
- if (prog->progs->crc != prog->headercrc)
- PRVM_ERROR ("%s: %s system vars have been modified, progdefs.h is out of date", PRVM_NAME, filename);
+ if (prog->progs->crc != prog->headercrc && prog->progs->crc != prog->headercrc2)
+ PRVM_ERROR ("%s: %s system vars have been modified (CRC of progs.dat systemvars %i != engine %i), progdefs.h is out of date", PRVM_NAME, filename, prog->progs->crc, prog->headercrc);
//prog->functions = (dfunction_t *)((unsigned char *)progs + progs->ofs_functions);
dfunctions = (dfunction_t *)((unsigned char *)prog->progs + prog->progs->ofs_functions);
prog->builtins = vm_sv_builtins;
prog->numbuiltins = vm_sv_numbuiltins;
prog->headercrc = PROGHEADER_CRC;
+ prog->headercrc2 = PROGHEADER_CRC_TENEBRAE;
prog->max_edicts = 512;
if (sv.protocol == PROTOCOL_QUAKE)
prog->limit_edicts = 640; // before quake mission pack 1 this was 512