mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-09 01:01:07 +00:00
Allow loading textures not aligned to 16 pixels
This fixes the mg1/horde2 loading error (taken from quakespasm-gl4 fork.)
This commit is contained in:
parent
a4dcdda3d9
commit
eeda766f12
3 changed files with 3 additions and 6 deletions
|
@ -489,18 +489,16 @@ void Mod_LoadTextures (lump_t *l)
|
|||
if ( (mt->width & 15) || (mt->height & 15) )
|
||||
{
|
||||
if (loadmodel->bspversion != BSPVERSION_QUAKE64)
|
||||
Sys_Error ("Texture %s is not 16 aligned", mt->name);
|
||||
Con_Warning ("Texture %s (%d x %d) is not 16 aligned\n", mt->name, mt->width, mt->height);
|
||||
}
|
||||
|
||||
pixels = mt->width*mt->height/64*85;
|
||||
pixels = mt->width*mt->height; // only copy the first mip, the rest are auto-generated
|
||||
tx = (texture_t *) Hunk_AllocName (sizeof(texture_t) +pixels, loadname );
|
||||
loadmodel->textures[i] = tx;
|
||||
|
||||
memcpy (tx->name, mt->name, sizeof(tx->name));
|
||||
tx->width = mt->width;
|
||||
tx->height = mt->height;
|
||||
for (j=0 ; j<MIPLEVELS ; j++)
|
||||
tx->offsets[j] = mt->offsets[j] + sizeof(texture_t) - sizeof(miptex_t);
|
||||
// the pixels immediately follow the structures
|
||||
|
||||
// ericw -- check for pixels extending past the end of the lump.
|
||||
|
|
|
@ -96,7 +96,6 @@ typedef struct texture_s
|
|||
int anim_min, anim_max; // time for this frame min <=time< max
|
||||
struct texture_s *anim_next; // in the animation sequence
|
||||
struct texture_s *alternate_anims; // bmodels in frmae 1 use these
|
||||
unsigned offsets[MIPLEVELS]; // four mip maps stored
|
||||
} texture_t;
|
||||
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ void Sky_LoadTexture (texture_t *mt)
|
|||
static byte back_data[128*128]; //FIXME: Hunk_Alloc
|
||||
unsigned *rgba;
|
||||
|
||||
src = (byte *)mt + mt->offsets[0];
|
||||
src = (byte *)(mt + 1);
|
||||
|
||||
// extract back layer and upload
|
||||
for (i=0 ; i<128 ; i++)
|
||||
|
|
Loading…
Reference in a new issue