memset (mod_novis, 0xff, sizeof(mod_novis));
}
-/*
-===============
-Mod_PointInLeaf
-===============
-*/
-mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model)
-{
- mnode_t *node;
- float d;
- mplane_t *plane;
-
- if (!model || !model->nodes)
- Sys_Error ("Mod_PointInLeaf: bad model");
-
- node = model->nodes;
- while (1)
- {
- if (node->contents < 0)
- return (mleaf_t *)node;
- plane = node->plane;
- d = DotProduct (p,plane->normal) - plane->dist;
- if (d > 0)
- node = node->children[0];
- else
- node = node->children[1];
- }
-
- return NULL; // never reached
-}
-
+// Mod_PointInLeaf moved to cpu_noasm.c
/*
===================
return Mod_DecompressVis (leaf->compressed_vis, model);
}
-byte *mod_base;
+extern byte *mod_base;
extern cvar_t r_fullbrights;
mt->offsets[j] = LittleLong (mt->offsets[j]);
if ( (mt->width & 15) || (mt->height & 15) )
- Sys_Error ("Texture %s is not 16 aligned", mt->name);
+ Host_Error ("Texture %s is not 16 aligned", mt->name);
// LordHavoc: rewriting the map texture loader for GLQuake
tx = Hunk_AllocName (sizeof(texture_t), loadname );
loadmodel->textures[i] = tx;
freeimage = TRUE;
bytesperpixel = 4;
fullbrights = FALSE;
- transparent = FALSE;
- data = loadimagepixels(mt->name, FALSE, tx->width, tx->height);
+ transparent = TRUE;
+ data = loadimagepixels(mt->name, FALSE, 0, 0); //tx->width, tx->height);
if (!data) // no external texture found
{
freeimage = FALSE;
+ transparent = FALSE;
bytesperpixel = 1;
if (!hlbsp && mt->offsets[0]) // texture included
{
}
else
{
- for (j = 0;j < image_width*image_height;j++)
- if (data[j*4+3] < 255)
- {
- transparent = TRUE;
- break;
- }
+ tx->width = image_width;
+ tx->height = image_height;
}
- if (!hlbsp && !strncmp(mt->name,"sky",3)) // LordHavoc: HL sky textures are entirely unrelated
+ if (!hlbsp && !strncmp(mt->name,"sky",3) && tx->width == 256 && tx->height == 128) // LordHavoc: HL sky textures are entirely unrelated
{
tx->transparent = FALSE;
R_InitSky (data, bytesperpixel);
altmax = num+1;
}
else
- Sys_Error ("Bad animating texture %s", tx->name);
+ Host_Error ("Bad animating texture %s", tx->name);
}
#define ANIM_CYCLE 2
{
tx2 = anims[j];
if (!tx2)
- Sys_Error ("Missing frame %i of %s",j, tx->name);
+ Host_Error ("Missing frame %i of %s",j, tx->name);
tx2->anim_total = max * ANIM_CYCLE;
tx2->anim_min = j * ANIM_CYCLE;
tx2->anim_max = (j+1) * ANIM_CYCLE;
{
tx2 = altanims[j];
if (!tx2)
- Sys_Error ("Missing frame %i of %s",j, tx->name);
+ Host_Error ("Missing frame %i of %s",j, tx->name);
tx2->anim_total = altmax * ANIM_CYCLE;
tx2->anim_min = j * ANIM_CYCLE;
tx2->anim_max = (j+1) * ANIM_CYCLE;
byte d;
char litfilename[1024];
loadmodel->lightdata = NULL;
- if (!l->filelen)
- return;
if (hlbsp) // LordHavoc: load the colored lighting data straight
{
loadmodel->lightdata = Hunk_AllocName ( l->filelen, loadname);
i = LittleLong(((int *)data)[1]);
if (i == 1)
{
+ Con_DPrintf("%s loaded", litfilename);
loadmodel->lightdata = data + 8;
return;
}
Con_Printf("Corrupt .lit file (old version?), ignoring\n");
}
// LordHavoc: oh well, expand the white lighting data
+ if (!l->filelen)
+ return;
loadmodel->lightdata = Hunk_AllocName ( l->filelen*3, litfilename);
in = loadmodel->lightdata + l->filelen*2; // place the file at the end, so it will not be overwritten until the very last write
out = loadmodel->lightdata;
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
- Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
+ Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
- Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
+ Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
- Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
+ Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( (count + 1) * sizeof(*out), loadname);
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
- Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
+ Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
{
out->texture = r_notexture_mip; // checkerboard texture
out->flags = 0;
+ out->texture->transparent = FALSE;
}
else
{
if (miptex >= loadmodel->numtextures)
- Sys_Error ("miptex >= loadmodel->numtextures");
+ Host_Error ("miptex >= loadmodel->numtextures");
out->texture = loadmodel->textures[miptex];
if (!out->texture)
{
out->texture = r_notexture_mip; // texture not found
out->flags = 0;
- }
- else
out->texture->transparent = FALSE;
+ }
}
}
}
s->texturemins[i] = bmins[i] * 16;
s->extents[i] = (bmaxs[i] - bmins[i]) * 16;
if ( !(tex->flags & TEX_SPECIAL) && s->extents[i] > 512 /* 256 */ )
- Sys_Error ("Bad surface extents");
+ Host_Error ("Bad surface extents");
}
}
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
- Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
+ Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
- Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
+ Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
- Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
+ Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
- Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
+ Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
out->planenum = LittleLong(in->planenum);
out->children[0] = LittleShort(in->children[0]);
out->children[1] = LittleShort(in->children[1]);
+ if (out->children[0] >= count || out->children[1] >= count)
+ Host_Error("Corrupt clipping hull (out of range child)\n");
}
}
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
- Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
+ Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
{
j = LittleShort(in[i]);
if (j >= loadmodel->numsurfaces)
- Sys_Error ("Mod_ParseMarksurfaces: bad surface number");
+ Host_Error ("Mod_ParseMarksurfaces: bad surface number");
out[i] = loadmodel->surfaces + j;
}
}
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
- Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
+ Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
- Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
+ Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*2*sizeof(*out), loadname);
header = (dheader_t *)buffer;
i = LittleLong (header->version);
- if (i != BSPVERSION & i != 30)
- Sys_Error ("Mod_LoadBrushModel: %s has wrong version number (%i should be %i or 30 (HalfLife))", mod->name, i, BSPVERSION);
+ if (i != BSPVERSION && i != 30)
+ Host_Error ("Mod_LoadBrushModel: %s has wrong version number (%i should be %i or 30 (HalfLife))", mod->name, i, BSPVERSION);
hlbsp = i == 30;
halflifebsp.value = hlbsp;