mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Moved LoadWal() to r_image.c/gl3_image.c
It returns the renderer-specific image_t*; wal.c is now renderer-agnostic and only contains GetWalInfo().
This commit is contained in:
parent
c098ee2ce3
commit
64a456b867
8 changed files with 90 additions and 44 deletions
4
Makefile
4
Makefile
|
@ -851,6 +851,7 @@ REFGL3_OBJS_ := \
|
|||
src/client/refresh/gl3/gl3_sdl.o \
|
||||
src/client/refresh/files/pcx.o \
|
||||
src/client/refresh/files/stb.o \
|
||||
src/client/refresh/files/wal.o \
|
||||
src/common/shared/flash.o \
|
||||
src/common/shared/rand.o \
|
||||
src/common/shared/shared.o
|
||||
|
@ -859,8 +860,7 @@ REFGL3_OBJS_ := \
|
|||
REFGL3_TODO_ := \
|
||||
src/client/refresh/files/md2.o \
|
||||
src/client/refresh/files/pcx.o \
|
||||
src/client/refresh/files/sp2.o \
|
||||
src/client/refresh/files/wal.o
|
||||
src/client/refresh/files/sp2.o
|
||||
|
||||
# TODO: glad_dbg support
|
||||
REFGL3_OBJS_ += \
|
||||
|
|
|
@ -24,42 +24,11 @@
|
|||
* =======================================================================
|
||||
*/
|
||||
|
||||
#include "../gl/header/local.h"
|
||||
#include "../ref_shared.h"
|
||||
|
||||
image_t *
|
||||
LoadWal(char *origname)
|
||||
{
|
||||
miptex_t *mt;
|
||||
int width, height, ofs;
|
||||
image_t *image;
|
||||
char name[256];
|
||||
|
||||
Q_strlcpy(name, origname, sizeof(name));
|
||||
|
||||
/* Add the extension */
|
||||
if (strcmp(COM_FileExtension(name), "wal"))
|
||||
{
|
||||
Q_strlcat(name, ".wal", sizeof(name));
|
||||
}
|
||||
|
||||
ri.FS_LoadFile(name, (void **)&mt);
|
||||
|
||||
if (!mt)
|
||||
{
|
||||
R_Printf(PRINT_ALL, "LoadWall: can't load %s\n", name);
|
||||
return r_notexture;
|
||||
}
|
||||
|
||||
width = LittleLong(mt->width);
|
||||
height = LittleLong(mt->height);
|
||||
ofs = LittleLong(mt->offsets[0]);
|
||||
|
||||
image = R_LoadPic(name, (byte *)mt + ofs, width, 0, height, 0, it_wall, 8);
|
||||
|
||||
ri.FS_FreeFile((void *)mt);
|
||||
|
||||
return image;
|
||||
}
|
||||
/*
|
||||
* NOTE: LoadWal() is in *_image.c because it needs the renderer-specific image_t
|
||||
*/
|
||||
|
||||
void
|
||||
GetWalInfo(char *name, int *width, int *height)
|
||||
|
|
|
@ -283,10 +283,6 @@ int Draw_GetPalette(void);
|
|||
void R_ResampleTexture(unsigned *in, int inwidth, int inheight,
|
||||
unsigned *out, int outwidth, int outheight);
|
||||
|
||||
image_t *LoadWal(char *name);
|
||||
|
||||
void GetWalInfo(char *name, int *width, int *height);
|
||||
void GetPCXInfo(char *filename, int *width, int *height);
|
||||
image_t *R_LoadPic(char *name, byte *pic, int width, int realwidth,
|
||||
int height, int realheight, imagetype_t type, int bits);
|
||||
image_t *R_FindImage(char *name, imagetype_t type);
|
||||
|
|
|
@ -1013,6 +1013,41 @@ R_LoadPic(char *name, byte *pic, int width, int realwidth,
|
|||
return image;
|
||||
}
|
||||
|
||||
static image_t *
|
||||
LoadWal(char *origname)
|
||||
{
|
||||
miptex_t *mt;
|
||||
int width, height, ofs;
|
||||
image_t *image;
|
||||
char name[256];
|
||||
|
||||
Q_strlcpy(name, origname, sizeof(name));
|
||||
|
||||
/* Add the extension */
|
||||
if (strcmp(COM_FileExtension(name), "wal"))
|
||||
{
|
||||
Q_strlcat(name, ".wal", sizeof(name));
|
||||
}
|
||||
|
||||
ri.FS_LoadFile(name, (void **)&mt);
|
||||
|
||||
if (!mt)
|
||||
{
|
||||
R_Printf(PRINT_ALL, "LoadWal: can't load %s\n", name);
|
||||
return r_notexture;
|
||||
}
|
||||
|
||||
width = LittleLong(mt->width);
|
||||
height = LittleLong(mt->height);
|
||||
ofs = LittleLong(mt->offsets[0]);
|
||||
|
||||
image = R_LoadPic(name, (byte *)mt + ofs, width, 0, height, 0, it_wall, 8);
|
||||
|
||||
ri.FS_FreeFile((void *)mt);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/*
|
||||
* Finds or loads the given image
|
||||
*/
|
||||
|
|
|
@ -110,6 +110,42 @@ GL3_TextureMode(char *string)
|
|||
#endif // 0
|
||||
}
|
||||
|
||||
/*
|
||||
static gl3image_t *
|
||||
LoadWal(char *origname)
|
||||
{
|
||||
miptex_t *mt;
|
||||
int width, height, ofs;
|
||||
gl3image_t *image;
|
||||
char name[256];
|
||||
|
||||
Q_strlcpy(name, origname, sizeof(name));
|
||||
|
||||
/* Add the extension */
|
||||
if (strcmp(COM_FileExtension(name), "wal"))
|
||||
{
|
||||
Q_strlcat(name, ".wal", sizeof(name));
|
||||
}
|
||||
|
||||
ri.FS_LoadFile(name, (void **)&mt);
|
||||
|
||||
if (!mt)
|
||||
{
|
||||
R_Printf(PRINT_ALL, "LoadWal: can't load %s\n", name);
|
||||
return gl3_notexture;
|
||||
}
|
||||
|
||||
width = LittleLong(mt->width);
|
||||
height = LittleLong(mt->height);
|
||||
ofs = LittleLong(mt->offsets[0]);
|
||||
|
||||
image = GL3_LoadPic(name, (byte *)mt + ofs, width, 0, height, 0, it_wall, 8);
|
||||
|
||||
ri.FS_FreeFile((void *)mt);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/*
|
||||
* Finds or loads the given image
|
||||
*/
|
||||
|
|
|
@ -38,6 +38,9 @@ gl3state_t gl3state;
|
|||
|
||||
viddef_t vid;
|
||||
|
||||
gl3image_t *gl3_notexture; /* use for bad textures */
|
||||
gl3image_t *gl3_particletexture; /* little dot for particles */
|
||||
|
||||
cvar_t *gl_msaa_samples;
|
||||
cvar_t *gl_swapinterval;
|
||||
cvar_t *gl_retexturing;
|
||||
|
|
|
@ -89,6 +89,11 @@ typedef struct
|
|||
//qboolean hwgamma;
|
||||
} gl3state_t;
|
||||
|
||||
extern gl3config_t gl3config;
|
||||
extern gl3state_t gl3state;
|
||||
|
||||
extern viddef_t vid;
|
||||
|
||||
|
||||
typedef struct gl3image_s
|
||||
{
|
||||
|
@ -107,10 +112,10 @@ typedef struct gl3image_s
|
|||
qboolean paletted;
|
||||
} gl3image_t;
|
||||
|
||||
extern gl3config_t gl3config;
|
||||
extern gl3state_t gl3state;
|
||||
enum {MAX_GL3TEXTURES = 1024};
|
||||
|
||||
extern gl3image_t *gl3_notexture;
|
||||
|
||||
extern viddef_t vid;
|
||||
|
||||
extern int gl_filter_min;
|
||||
extern int gl_filter_max;
|
||||
|
|
|
@ -55,4 +55,6 @@ extern void GetPCXInfo(char *filename, int *width, int *height);
|
|||
|
||||
extern qboolean LoadSTB(const char *origname, const char* type, byte **pic, int *width, int *height);
|
||||
|
||||
extern void GetWalInfo(char *name, int *width, int *height);
|
||||
|
||||
#endif /* SRC_CLIENT_REFRESH_REF_SHARED_H_ */
|
||||
|
|
Loading…
Reference in a new issue