return true;
}
+/*
+============
+LoadPCX
+============
+*/
+qboolean LoadPCX_PaletteOnly(const unsigned char *f, int filesize, unsigned char *palette768b)
+{
+ if (filesize < 768)
+ return false;
+ memcpy(palette768b, f + filesize - 768, 768);
+ return true;
+}
+
/*
=========================================================
return NULL;
}
- if (filesize < (int) sizeof(q2wal_t) + (int) LittleLong(inwal->offsets[0]) + image_width * image_height)
+ if (filesize < (int) LittleLong(inwal->offsets[0]) + image_width * image_height)
{
Con_Print("LoadWAL: invalid WAL file\n");
return NULL;
Con_Printf("LoadWAL: not enough memory for %i by %i image\n", image_width, image_height);
return NULL;
}
- Image_Copy8bitBGRA(f + LittleLong(inwal->offsets[0]), image_buffer, image_width * image_height, palette_bgra_complete);
+ Image_Copy8bitBGRA(f + LittleLong(inwal->offsets[0]), image_buffer, image_width * image_height, q2palette_bgra_complete);
return image_buffer;
}
+qboolean LoadWAL_GetMetadata(const unsigned char *f, int filesize, int *retwidth, int *retheight, int *retflags, int *retvalue, int *retcontents, char *retanimname32c)
+{
+ unsigned char *image_buffer;
+ const q2wal_t *inwal = (const q2wal_t *)f;
+
+ if (filesize < (int) sizeof(q2wal_t))
+ {
+ Con_Print("LoadWAL: invalid WAL file\n");
+ *retwidth = 16;
+ *retheight = 16;
+ *retflags = 0;
+ *retvalue = 0;
+ *retcontents = 0;
+ memset(retanimname32c, 0, 32);
+ return false;
+ }
+
+ *retwidth = LittleLong(inwal->width);
+ *retheight = LittleLong(inwal->height);
+ *retflags = LittleLong(inwal->flags);
+ *retvalue = LittleLong(inwal->value);
+ *retcontents = LittleLong(inwal->contents);
+ memcpy(retanimname32c, inwal->animname, 32);
+ retanimname32c[31] = 0;
+ return true;
+}
+
void Image_StripImageExtension (const char *in, char *out, size_t size_out)
{
return;
ext = FS_FileExtension(in);
- if (ext && (!strcmp(ext, "tga") || !strcmp(ext, "pcx") || !strcmp(ext, "lmp") || !strcmp(ext, "png") || !strcmp(ext, "jpg")))
+ if (ext && (!strcmp(ext, "tga") || !strcmp(ext, "pcx") || !strcmp(ext, "lmp") || !strcmp(ext, "png") || !strcmp(ext, "jpg") || !strcmp(ext, "wal")))
FS_StripExtension(in, out, size_out);
else
strlcpy(out, in, size_out);
if (f)
{
int mymiplevel = miplevel ? *miplevel : 0;
+ image_width = 0;
+ image_height = 0;
data = format->loadfunc(f, (int)filesize, &mymiplevel);
Mem_Free(f);
if (data)