#if 1
colbrushf_t cbox;
colplanef_t cbox_planes[6];
+ cbox.isaabb = true;
+ cbox.hasaabbplanes = true;
cbox.supercontents = boxsupercontents;
cbox.numplanes = 6;
cbox.numpoints = 0;
*/
void R_Q1BSP_LoadSplitSky (unsigned char *src, int width, int height, int bytesperpixel)
{
- int i, j;
- unsigned solidpixels[128*128], alphapixels[128*128];
+ int x, y;
+ int w = width/2;
+ int h = height;
+ unsigned *solidpixels = Mem_Alloc(tempmempool, w*h*sizeof(unsigned char[4]));
+ unsigned *alphapixels = Mem_Alloc(tempmempool, w*h*sizeof(unsigned char[4]));
// allocate a texture pool if we need it
if (loadmodel->texturepool == NULL && cls.state != ca_dedicated)
if (bytesperpixel == 4)
{
- for (i = 0;i < 128;i++)
+ for (y = 0;y < h;y++)
{
- for (j = 0;j < 128;j++)
+ for (x = 0;x < w;x++)
{
- solidpixels[(i*128) + j] = ((unsigned *)src)[i*256+j+128];
- alphapixels[(i*128) + j] = ((unsigned *)src)[i*256+j];
+ solidpixels[y*w+x] = ((unsigned *)src)[y*width+x+w];
+ alphapixels[y*w+x] = ((unsigned *)src)[y*width+x];
}
}
}
}
bgra;
r = g = b = 0;
- for (i = 0;i < 128;i++)
+ for (y = 0;y < h;y++)
{
- for (j = 0;j < 128;j++)
+ for (x = 0;x < w;x++)
{
- p = src[i*256 + j + 128];
+ p = src[x*width+y+w];
r += palette_rgb[p][0];
g += palette_rgb[p][1];
b += palette_rgb[p][2];
}
}
- bgra.b[2] = r/(128*128);
- bgra.b[1] = g/(128*128);
- bgra.b[0] = b/(128*128);
+ bgra.b[2] = r/(w*h);
+ bgra.b[1] = g/(w*h);
+ bgra.b[0] = b/(w*h);
bgra.b[3] = 0;
- for (i = 0;i < 128;i++)
+ for (y = 0;y < h;y++)
{
- for (j = 0;j < 128;j++)
+ for (x = 0;x < w;x++)
{
- solidpixels[(i*128) + j] = palette_bgra_complete[src[i*256 + j + 128]];
- p = src[i*256 + j];
- alphapixels[(i*128) + j] = p ? palette_bgra_complete[p] : bgra.i;
+ solidpixels[y*w+x] = palette_bgra_complete[src[y*width+x+w]];
+ p = src[y*width+x];
+ alphapixels[y*w+x] = p ? palette_bgra_complete[p] : bgra.i;
}
}
}
- loadmodel->brush.solidskytexture = R_LoadTexture2D(loadmodel->texturepool, "sky_solidtexture", 128, 128, (unsigned char *) solidpixels, TEXTYPE_BGRA, TEXF_PRECACHE, NULL);
- loadmodel->brush.alphaskytexture = R_LoadTexture2D(loadmodel->texturepool, "sky_alphatexture", 128, 128, (unsigned char *) alphapixels, TEXTYPE_BGRA, TEXF_ALPHA | TEXF_PRECACHE, NULL);
+ loadmodel->brush.solidskytexture = R_LoadTexture2D(loadmodel->texturepool, "sky_solidtexture", w, h, (unsigned char *) solidpixels, TEXTYPE_BGRA, TEXF_PRECACHE, NULL);
+ loadmodel->brush.alphaskytexture = R_LoadTexture2D(loadmodel->texturepool, "sky_alphatexture", w, h, (unsigned char *) alphapixels, TEXTYPE_BGRA, TEXF_ALPHA | TEXF_PRECACHE, NULL);
+ Mem_Free(solidpixels);
+ Mem_Free(alphapixels);
}
static void Mod_Q1BSP_LoadTextures(lump_t *l)
if (cls.state != ca_dedicated)
{
// LordHavoc: HL sky textures are entirely different than quake
- if (!loadmodel->brush.ishlbsp && !strncmp(tx->name, "sky", 3) && mtwidth == 256 && mtheight == 128)
+ if (!loadmodel->brush.ishlbsp && !strncmp(tx->name, "sky", 3) && mtwidth == mtheight * 2)
{
data = loadimagepixelsbgra(tx->name, false, false);
- if (data && image_width == 256 && image_height == 128)
+ if (data && image_width == image_height * 2)
{
R_Q1BSP_LoadSplitSky(data, image_width, image_height, 4);
Mem_Free(data);
q3surfaceflags |= planes[j].q3surfaceflags;
}
// make the colbrush from the planes
- out->colbrushf = Collision_NewBrushFromPlanes(loadmodel->mempool, out->numbrushsides, planes, out->texture->supercontents, q3surfaceflags, out->texture);
+ out->colbrushf = Collision_NewBrushFromPlanes(loadmodel->mempool, out->numbrushsides, planes, out->texture->supercontents, q3surfaceflags, out->texture, true);
// this whole loop can take a while (e.g. on redstarrepublic4)
CL_KeepaliveMessage(false);
float segmentmins[3], segmentmaxs[3];
msurface_t *surface;
q3mbrush_t *brush;
- colbrushf_t *thisbrush_start, *thisbrush_end;
+ colboxbrushf_t thisbrush_start, thisbrush_end;
vec3_t boxstartmins, boxstartmaxs, boxendmins, boxendmaxs;
if (mod_q3bsp_optimizedtraceline.integer && VectorCompare(boxmins, boxmaxs))
VectorAdd(start, boxmaxs, boxstartmaxs);
VectorAdd(end, boxmins, boxendmins);
VectorAdd(end, boxmaxs, boxendmaxs);
- thisbrush_start = Collision_BrushForBox(&identitymatrix, boxstartmins, boxstartmaxs, 0, 0, NULL);
- thisbrush_end = Collision_BrushForBox(&identitymatrix, boxendmins, boxendmaxs, 0, 0, NULL);
+ Collision_BrushForBox(&thisbrush_start, boxstartmins, boxstartmaxs, 0, 0, NULL);
+ Collision_BrushForBox(&thisbrush_end, boxendmins, boxendmaxs, 0, 0, NULL);
if (model->brush.submodel)
{
for (i = 0, brush = model->brush.data_brushes + model->firstmodelbrush;i < model->nummodelbrushes;i++, brush++)
if (brush->colbrushf)
- Collision_TraceBrushBrushFloat(trace, thisbrush_start, thisbrush_end, brush->colbrushf, brush->colbrushf);
+ Collision_TraceBrushBrushFloat(trace, &thisbrush_start.brush, &thisbrush_end.brush, brush->colbrushf, brush->colbrushf);
if (mod_q3bsp_curves_collisions.integer)
for (i = 0, surface = model->data_surfaces + model->firstmodelsurface;i < model->nummodelsurfaces;i++, surface++)
if (surface->num_collisiontriangles)
- Collision_TraceBrushTriangleMeshFloat(trace, thisbrush_start, thisbrush_end, surface->num_collisiontriangles, surface->data_collisionelement3i, surface->data_collisionvertex3f, surface->num_collisionbboxstride, surface->data_collisionbbox6f, surface->texture->supercontents, surface->texture->surfaceflags, surface->texture, segmentmins, segmentmaxs);
+ Collision_TraceBrushTriangleMeshFloat(trace, &thisbrush_start.brush, &thisbrush_end.brush, surface->num_collisiontriangles, surface->data_collisionelement3i, surface->data_collisionvertex3f, surface->num_collisionbboxstride, surface->data_collisionbbox6f, surface->texture->supercontents, surface->texture->surfaceflags, surface->texture, segmentmins, segmentmaxs);
}
else
- Mod_Q3BSP_TraceBrush_RecursiveBSPNode(trace, model, model->brush.data_nodes, thisbrush_start, thisbrush_end, ++markframe, segmentmins, segmentmaxs);
+ Mod_Q3BSP_TraceBrush_RecursiveBSPNode(trace, model, model->brush.data_nodes, &thisbrush_start.brush, &thisbrush_end.brush, ++markframe, segmentmins, segmentmaxs);
}
static int Mod_Q3BSP_PointSuperContents(struct model_s *model, int frame, const vec3_t point)