- Applied patch from Steven Winston for m32 format texture
support.
This commit is contained in:
parent
53a863747f
commit
4884d09e9a
|
@ -1354,6 +1354,35 @@ image_t *GL_LoadWal (char *name)
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* .M32 Support */
|
||||||
|
/*
|
||||||
|
* ==============
|
||||||
|
* GL_LoadWal32
|
||||||
|
* ==============
|
||||||
|
*/
|
||||||
|
image_t *GL_LoadWal32 (char *name)
|
||||||
|
{
|
||||||
|
miptex32_t *mt;
|
||||||
|
int width, height, ofs;
|
||||||
|
image_t *image;
|
||||||
|
|
||||||
|
ri.FS_LoadFile (name, (void **)&mt);
|
||||||
|
if (!mt)
|
||||||
|
{
|
||||||
|
ri.Con_Printf (PRINT_ALL, "GL_FindImage: Can't Load %s\n", name);
|
||||||
|
return r_notexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
width = LittleLong (mt->width[0]);
|
||||||
|
height = LittleLong (mt->height[0]);
|
||||||
|
ofs = LittleLong (mt->offsets[0]);
|
||||||
|
|
||||||
|
image = GL_LoadPic (name, (byte *)mt + ofs, width, height, it_wall, 32);
|
||||||
|
ri.FS_FreeFile ((void *)mt);
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
GL_FindImage
|
GL_FindImage
|
||||||
|
@ -1406,8 +1435,9 @@ image_t *GL_FindImage (char *name, imagetype_t type)
|
||||||
if (!pic)
|
if (!pic)
|
||||||
return NULL; // ri.Sys_Error (ERR_DROP, "GL_FindImage: can't load %s", name);
|
return NULL; // ri.Sys_Error (ERR_DROP, "GL_FindImage: can't load %s", name);
|
||||||
image = GL_LoadPic (name, pic, width, height, type, 32);
|
image = GL_LoadPic (name, pic, width, height, type, 32);
|
||||||
}
|
} else if (!strcmp(name+len-4, ".m32")) {
|
||||||
else
|
image = GL_LoadWal32 (name);
|
||||||
|
} else
|
||||||
return NULL; // ri.Sys_Error (ERR_DROP, "GL_FindImage: bad extension on: %s", name);
|
return NULL; // ri.Sys_Error (ERR_DROP, "GL_FindImage: bad extension on: %s", name);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,25 @@
|
||||||
/*
|
/* $Id$
|
||||||
Copyright (C) 1997-2001 Id Software, Inc.
|
*
|
||||||
|
* model loading and caching
|
||||||
This program is free software; you can redistribute it and/or
|
*
|
||||||
modify it under the terms of the GNU General Public License
|
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||||
as published by the Free Software Foundation; either version 2
|
* Copyright (c) 2003 The Quakeforge Project.
|
||||||
of the License, or (at your option) any later version.
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
This program is distributed in the hope that it will be useful,
|
* modify it under the terms of the GNU General Public License
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* as published by the Free Software Foundation; either version 2
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
See the GNU General Public License for more details.
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
along with this program; if not, write to the Free Software
|
*
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
// models.c -- model loading and caching
|
|
||||||
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
|
|
||||||
|
@ -470,12 +472,15 @@ void Mod_LoadTexinfo (lump_t *l)
|
||||||
Com_sprintf (name, sizeof(name), "textures/%s.wal", in->texture);
|
Com_sprintf (name, sizeof(name), "textures/%s.wal", in->texture);
|
||||||
|
|
||||||
out->image = GL_FindImage (name, it_wall);
|
out->image = GL_FindImage (name, it_wall);
|
||||||
if (!out->image)
|
if (!out->image || out->image == r_notexture) {
|
||||||
{
|
Com_sprintf (name, sizeof(name), "textures/%s.m32", in->texture);
|
||||||
|
out->image = GL_FindImage (name, it_wall);
|
||||||
|
if (!out->image) {
|
||||||
ri.Con_Printf (PRINT_ALL, "Couldn't load %s\n", name);
|
ri.Con_Printf (PRINT_ALL, "Couldn't load %s\n", name);
|
||||||
out->image = r_notexture;
|
out->image = r_notexture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// count animation frames
|
// count animation frames
|
||||||
for (i=0 ; i<count ; i++)
|
for (i=0 ; i<count ; i++)
|
||||||
|
|
28
src/qfiles.h
28
src/qfiles.h
|
@ -232,7 +232,35 @@ typedef struct miptex_s
|
||||||
int value;
|
int value;
|
||||||
} miptex_t;
|
} miptex_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
==============================================================================
|
||||||
|
.M32 texture File Format
|
||||||
|
==============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct miptex32_s {
|
||||||
|
int version;
|
||||||
|
char name[128];
|
||||||
|
char altname[128]; /* texture substitution */
|
||||||
|
char animname[128]; /* next frame in animation chain */
|
||||||
|
char damagename[128]; /* image that should be shown when damaged */
|
||||||
|
unsigned width[16], height[16];
|
||||||
|
unsigned offsets[16];
|
||||||
|
int flags;
|
||||||
|
int contents;
|
||||||
|
int value;
|
||||||
|
float scale_x, scale_y;
|
||||||
|
int mip_scale;
|
||||||
|
/* detail texturing info */
|
||||||
|
char dt_name[128]; /* detailed texture name */
|
||||||
|
float dt_scale_x, dt_scale_y;
|
||||||
|
float dt_u, dt_v;
|
||||||
|
float dt_alpha;
|
||||||
|
int dt_src_blend_mode, dt_dst_blend_mode;
|
||||||
|
int flags2;
|
||||||
|
float damage_health;
|
||||||
|
int unused[18];
|
||||||
|
} miptex32_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
Loading…
Reference in New Issue