diff --git a/src/gl_image.c b/src/gl_image.c index 69ac8ca..692c693 100644 --- a/src/gl_image.c +++ b/src/gl_image.c @@ -1354,6 +1354,35 @@ image_t *GL_LoadWal (char *name) 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 @@ -1406,8 +1435,9 @@ image_t *GL_FindImage (char *name, imagetype_t type) if (!pic) return NULL; // ri.Sys_Error (ERR_DROP, "GL_FindImage: can't load %s", name); image = GL_LoadPic (name, pic, width, height, type, 32); - } - else + } else if (!strcmp(name+len-4, ".m32")) { + image = GL_LoadWal32 (name); + } else return NULL; // ri.Sys_Error (ERR_DROP, "GL_FindImage: bad extension on: %s", name); diff --git a/src/gl_model.c b/src/gl_model.c index af69d57..da45f57 100644 --- a/src/gl_model.c +++ b/src/gl_model.c @@ -1,23 +1,25 @@ -/* -Copyright (C) 1997-2001 Id Software, Inc. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -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 +/* $Id$ + * + * model loading and caching + * + * Copyright (C) 1997-2001 Id Software, Inc. + * Copyright (c) 2003 The Quakeforge Project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * 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. + */ #include "gl_local.h" @@ -470,10 +472,13 @@ void Mod_LoadTexinfo (lump_t *l) Com_sprintf (name, sizeof(name), "textures/%s.wal", in->texture); 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); out->image = r_notexture; + } } } diff --git a/src/qfiles.h b/src/qfiles.h index 7584a0b..3acffab 100644 --- a/src/qfiles.h +++ b/src/qfiles.h @@ -232,7 +232,35 @@ typedef struct miptex_s int value; } 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; /* ==============================================================================