18 for(
i = 0;
i <
n; ++
i)
19 outpixels[4*
i+3] = inpixels[4*
i];
24void Image_CopyMux(
unsigned char *outpixels,
const unsigned char *inpixels,
int inputwidth,
int inputheight,
qbool inputflipx,
qbool inputflipy,
qbool inputflipdiagonal,
int numoutputcomponents,
int numinputcomponents,
int *outputinputcomponentindices)
27 const unsigned char *in, *line;
28 int row_inc = (inputflipy ? -inputwidth : inputwidth) * numinputcomponents, col_inc = (inputflipx ? -1 : 1) * numinputcomponents;
29 int row_ofs = (inputflipy ? (inputheight - 1) * inputwidth * numinputcomponents : 0), col_ofs = (inputflipx ? (inputwidth - 1) * numinputcomponents : 0);
31 for (c = 0; c < numoutputcomponents; c++)
32 if (outputinputcomponentindices[c] & 0x80000000)
34 if (c < numoutputcomponents)
37 if (inputflipdiagonal)
39 for (
x = 0, line = inpixels + col_ofs;
x < inputwidth;
x++, line += col_inc)
40 for (
y = 0, in = line + row_ofs;
y < inputheight;
y++, in += row_inc, outpixels += numoutputcomponents)
41 for (c = 0; c < numoutputcomponents; c++)
42 outpixels[c] = ((
index = outputinputcomponentindices[c]) & 0x80000000) ?
index : in[
index];
46 for (
y = 0, line = inpixels + row_ofs;
y < inputheight;
y++, line += row_inc)
47 for (
x = 0, in = line + col_ofs;
x < inputwidth;
x++, in += col_inc, outpixels += numoutputcomponents)
48 for (c = 0; c < numoutputcomponents; c++)
49 outpixels[c] = ((
index = outputinputcomponentindices[c]) & 0x80000000) ?
index : in[
index];
55 if (inputflipdiagonal)
57 for (
x = 0, line = inpixels + col_ofs;
x < inputwidth;
x++, line += col_inc)
58 for (
y = 0, in = line + row_ofs;
y < inputheight;
y++, in += row_inc, outpixels += numoutputcomponents)
59 for (c = 0; c < numoutputcomponents; c++)
60 outpixels[c] = in[outputinputcomponentindices[c]];
64 for (
y = 0, line = inpixels + row_ofs;
y < inputheight;
y++, line += row_inc)
65 for (
x = 0, in = line + col_ofs;
x < inputwidth;
x++, in += col_inc, outpixels += numoutputcomponents)
66 for (c = 0; c < numoutputcomponents; c++)
67 outpixels[c] = in[outputinputcomponentindices[c]];
73void Image_CopyMux(
unsigned char *outpixels,
const unsigned char *inpixels,
int inputwidth,
int inputheight,
qbool inputflipx,
qbool inputflipy,
qbool inputflipdiagonal,
int numoutputcomponents,
int numinputcomponents,
int *outputinputcomponentindices)
76 const unsigned char *in, *inrow, *incolumn;
77 if (inputflipdiagonal)
79 for (
x = 0;
x < inputwidth;
x++)
81 for (
y = 0;
y < inputheight;
y++)
83 in = inpixels + ((inputflipy ? inputheight - 1 -
y :
y) * inputwidth + (inputflipx ? inputwidth - 1 -
x :
x)) * numinputcomponents;
84 for (c = 0;c < numoutputcomponents;c++)
86 index = outputinputcomponentindices[c];
87 if (
index & 0x80000000)
90 *outpixels++ = in[
index];
97 for (
y = 0;
y < inputheight;
y++)
99 for (
x = 0;
x < inputwidth;
x++)
101 in = inpixels + ((inputflipy ? inputheight - 1 -
y :
y) * inputwidth + (inputflipx ? inputwidth - 1 -
x :
x)) * numinputcomponents;
102 for (c = 0;c < numoutputcomponents;c++)
104 index = outputinputcomponentindices[c];
105 if (
index & 0x80000000)
106 *outpixels++ =
index;
108 *outpixels++ = in[
index];
116void Image_GammaRemapRGB(
const unsigned char *in,
unsigned char *out,
int pixels,
const unsigned char *gammar,
const unsigned char *gammag,
const unsigned char *gammab)
120 out[0] = gammar[in[0]];
121 out[1] = gammag[in[1]];
122 out[2] = gammab[in[2]];
131 int *iout = (
int *)out;
134 iout[0] = pal[in[0]];
135 iout[1] = pal[in[1]];
136 iout[2] = pal[in[2]];
137 iout[3] = pal[in[3]];
138 iout[4] = pal[in[4]];
139 iout[5] = pal[in[5]];
140 iout[6] = pal[in[6]];
141 iout[7] = pal[in[7]];
148 iout[0] = pal[in[0]];
149 iout[1] = pal[in[1]];
150 iout[2] = pal[in[2]];
151 iout[3] = pal[in[3]];
157 iout[0] = pal[in[0]];
158 iout[1] = pal[in[1]];
163 iout[0] = pal[in[0]];
180 unsigned short xmin,ymin,
xmax,ymax;
182 unsigned char palette[48];
195static unsigned char*
LoadPCX_BGRA (
const unsigned char *
f,
int filesize,
int *miplevel)
198 unsigned char *
a, *
b, *image_buffer, *pbuf;
199 const unsigned char *palette, *fin, *enddata;
200 int x,
y,
x2, dataByte;
202 if (filesize < (
int)
sizeof(pcx) + 768)
210 memcpy(&pcx, fin,
sizeof(pcx));
231 palette =
f + filesize - 768;
252 x2 =
x + (dataByte & 0x3F);
290 const unsigned char *fin, *enddata;
291 int x,
y,
x2, dataByte, pcxwidth, pcxheight;
293 if (filesize < (
int)
sizeof(pcx) + 768)
300 memcpy(&pcx, fin,
sizeof(pcx));
314 pcxheight = pcx.
ymax + 1 - pcx.
ymin;
318 enddata =
f + filesize - 768;
320 for (
y = 0;
y < outheight && fin < enddata;
y++)
326 memset(
a, 0, outwidth);
329 for (
x = 0;
x < pcxwidth;)
336 x2 =
x + (dataByte & 0x3F);
369 memcpy(palette768b,
f + filesize - 768, 768);
381typedef struct _TargaHeader
393 Con_Printf(
"TargaHeader:\nuint8 id_length = %i;\nuint8 colormap_type = %i;\nuint8 image_type = %i;\nuint16 colormap_index = %i;\nuint16 colormap_length = %i;\nuint8 colormap_size = %i;\nuint16 x_origin = %i;\nuint16 y_origin = %i;\nuint16 width = %i;\nuint16 height = %i;\nuint8 pixel_size = %i;\nuint8 attributes = %i;\n", t->
id_length, t->
colormap_type, t->
image_type, t->
colormap_index, t->
colormap_length, t->
colormap_size, t->
x_origin, t->
y_origin, t->
width, t->
height, t->
pixel_size, t->
attributes);
401unsigned char *
LoadTGA_BGRA (
const unsigned char *
f,
int filesize,
int *miplevel)
403 int x,
y, pix_inc, row_inci, runlen, alphabits;
404 unsigned char *image_buffer;
405 unsigned int *pixbufi;
406 const unsigned char *fin, *enddata;
408 unsigned int palettei[256];
419 enddata =
f + filesize;
442 memset(palettei, 0,
sizeof(palettei));
457 Con_Print(
"LoadTGA: only up to 256 colormap_length supported\n");
463 Con_Print(
"LoadTGA: colormap_index not supported\n");
475 palettei[
x] = bgra.i;
485 Con_Print(
"LoadTGA: Only 32 and 24 bit colormap_size supported\n");
497 Con_Print(
"LoadTGA: only 24bit and 32bit pixel sizes supported for type 2 and type 10 images\n");
504 for (
x = 0;
x < 256;
x++)
506 bgra.b[0] = bgra.b[1] = bgra.b[2] =
x;
508 palettei[
x] = bgra.i;
514 Con_Print(
"LoadTGA: only 8bit pixel size for type 1, 3, 9, and 11 images supported\n");
520 Con_Printf(
"LoadTGA: Only type 1, 2, 3, 9, 10, and 11 targa RGB images supported, image_type = %i\n", targa_header.
image_type);
527 Con_Print(
"LoadTGA: origin must be in top left or bottom left, top right and bottom right are not supported\n");
533 if (alphabits != 8 && alphabits != 0)
535 Con_Print(
"LoadTGA: only 0 or 8 attribute (alpha) bits supported\n");
554 pixbufi = (
unsigned int*)image_buffer;
569 *pixbufi++ = palettei[*fin++];
575 if (targa_header.
pixel_size == 32 && alphabits)
608 if (fin + pix_inc > enddata)
612 bgra.i = palettei[*fin++];
620 if (fin + pix_inc * runlen > enddata)
625 *pixbufi++ = palettei[*fin++];
639 if (targa_header.
pixel_size == 32 && alphabits)
652 if (fin + pix_inc > enddata)
668 if (fin + pix_inc * runlen > enddata)
705 if (fin + pix_inc > enddata)
721 if (fin + pix_inc * runlen > enddata)
754typedef struct q2wal_s
765static unsigned char *
LoadWAL_BGRA (
const unsigned char *
f,
int filesize,
int *miplevel)
767 unsigned char *image_buffer;
770 if (filesize < (
int)
sizeof(
q2wal_t))
772 Con_Print(
"LoadWAL: invalid WAL file\n");
786 Con_Print(
"LoadWAL: invalid WAL file\n");
800qbool LoadWAL_GetMetadata(
const unsigned char *
f,
int filesize,
int *retwidth,
int *retheight,
int *retflags,
int *retvalue,
int *retcontents,
char *retanimname32c)
804 if (filesize < (
int)
sizeof(
q2wal_t))
806 Con_Print(
"LoadWAL: invalid WAL file\n");
818 memset(retanimname32c, 0, 32);
834 memcpy(retanimname32c, inwal->
animname, 32);
835 retanimname32c[31] = 0;
841static unsigned char*
LoadLMP_BGRA(
const unsigned char *
f,
int filesize,
int *miplevel)
843 unsigned char *image_buffer;
871 image_buffer[
i * 4 + 0] = p[0];
872 image_buffer[
i * 4 + 1] = p[1];
873 image_buffer[
i * 4 + 2] = p[2];
874 image_buffer[
i * 4 + 3] = p[3];
883 unsigned char *image_buffer;
904 image_buffer[
i * 4 + 0] = p[0];
905 image_buffer[
i * 4 + 1] = p[1];
906 image_buffer[
i * 4 + 2] = p[2];
907 image_buffer[
i * 4 + 3] = p[3];
921 if (ext && (!strcmp(ext,
"tga") || !strcmp(ext,
"pcx") || !strcmp(ext,
"lmp") || !strcmp(ext,
"png") || !strcmp(ext,
"jpg") || !strcmp(ext,
"wal")))
935 for (
i = 0;
i < 256;
i++)
937 for (
i = 0;
i < numpixels;
i++)
942 pout[
i*4+3] = pin[
i*4+3];
951 for (
i = 0;
i < 256;
i++)
953 for (
i = 0;
i < numpixels;
i++)
958 pout[
i*4+3] = pin[
i*4+3];
962typedef struct imageformat_s
965 unsigned char *(*loadfunc)(
const unsigned char *
f,
int filesize,
int *miplevel);
1054 Log_Printf(
"textures.log",
"%s\n", filename);
1057 for (c = basename;*c;c++)
1062 dp_strlcpy(afterpath, basename,
sizeof(afterpath));
1063 if (strchr(basename,
'/'))
1066 for (
i = 0;
i < (
int)
sizeof(path)-1 && basename[
i] !=
'/' && basename[
i];
i++)
1067 path[
i] = basename[
i];
1069 dp_strlcpy(afterpath, basename +
i + 1,
sizeof(afterpath));
1075 else if (!strcasecmp(path,
"textures"))
1077 else if (!strcasecmp(path,
"gfx") || !strcasecmp(path,
"locale"))
1092 mymiplevel = miplevel ? *miplevel : 0;
1095 data =
format->loadfunc(
f, (
int)filesize, &mymiplevel);
1101 dpsnprintf (name2,
sizeof(name2),
format->formatstring,
va(vabuf,
sizeof(vabuf),
"%s_alpha", basename));
1105 int mymiplevel2 = miplevel ? *miplevel : 0;
1108 data2 =
format->loadfunc(
f, (
int)filesize, &mymiplevel2);
1109 if(data2 && mymiplevel == mymiplevel2 &&
image_width == image_width_save &&
image_height == image_height_save)
1112 Con_Printf(
"loadimagepixelsrgba: corrupt or invalid alpha image %s_alpha\n", basename);
1123 *miplevel = mymiplevel;
1136 dpsnprintf(outfilename,
sizeof(outfilename),
"fixtrans/%s.tga",
buf);
1147 Con_DPrintf(
"Error loading image %s (file loaded but decode failed)\n",
name);
1150 if (!strcasecmp(path,
"gfx"))
1152 unsigned char *lmpdata;
1156 Con_Printf(
"loading gfx.wad lump \"%s\"\n", afterpath);
1158 mymiplevel = miplevel ? *miplevel : 0;
1159 if (!strcmp(afterpath,
"conchars"))
1169 Con_DPrintf(
"Error loading image %s (file loaded but decode failed)\n",
name);
1198 unsigned char *
data;
1201 if (!strcasecmp(filename,
"gfx/conchars"))
1204 *returnheight = 128;
1208 dpsnprintf(lmppath,
sizeof(lmppath),
"%s.lmp", filename);
1215 int h =
data[4] +
data[5] * 0x100 +
data[6] * 0x10000 +
data[7] * 0x1000000;
1226 if (!strncasecmp(filename,
"gfx/", 4))
1229 if (
data && filesize > 8)
1232 int h =
data[4] +
data[5] * 0x100 +
data[6] * 0x10000 +
data[7] * 0x1000000;
1247 unsigned char *
data;
1259 int const FIXTRANS_NEEDED = 1;
1260 int const FIXTRANS_HAS_L = 2;
1261 int const FIXTRANS_HAS_R = 4;
1262 int const FIXTRANS_HAS_U = 8;
1263 int const FIXTRANS_HAS_D = 16;
1264 int const FIXTRANS_FIXED = 32;
1267 int changedPixels = 0;
1270#define FIXTRANS_PIXEL (y*w+x)
1271#define FIXTRANS_PIXEL_U (((y+h-1)%h)*w+x)
1272#define FIXTRANS_PIXEL_D (((y+1)%h)*w+x)
1273#define FIXTRANS_PIXEL_L (y*w+((x+w-1)%w))
1274#define FIXTRANS_PIXEL_R (y*w+((x+1)%w))
1276 memset(fixMask, 0,
w * h);
1277 for(
y = 0;
y < h; ++
y)
1278 for(
x = 0;
x <
w; ++
x)
1293 if(fixPixels ==
w * h)
1297 for(
y = 0;
y < h; ++
y)
1298 for(
x = 0;
x <
w; ++
x)
1301 unsigned int sumR = 0, sumG = 0, sumB = 0, sumA = 0, sumRA = 0, sumGA = 0, sumBA = 0, cnt = 0;
1302 unsigned char r,
g,
b,
a, r0, g0, b0;
1309 sumR +=
r; sumG +=
g; sumB +=
b; sumA +=
a; sumRA +=
r*
a; sumGA +=
g*
a; sumBA +=
b*
a; ++cnt;
1317 sumR +=
r; sumG +=
g; sumB +=
b; sumA +=
a; sumRA +=
r*
a; sumGA +=
g*
a; sumBA +=
b*
a; ++cnt;
1325 sumR +=
r; sumG +=
g; sumB +=
b; sumA +=
a; sumRA +=
r*
a; sumGA +=
g*
a; sumBA +=
b*
a; ++cnt;
1333 sumR +=
r; sumG +=
g; sumB +=
b; sumA +=
a; sumRA +=
r*
a; sumGA +=
g*
a; sumBA +=
b*
a; ++cnt;
1343 r = (sumRA + sumA / 2) / sumA;
1344 g = (sumGA + sumA / 2) / sumA;
1345 b = (sumBA + sumA / 2) / sumA;
1350 r = (sumR + cnt / 2) / cnt;
1351 g = (sumG + cnt / 2) / cnt;
1352 b = (sumB + cnt / 2) / cnt;
1354 if(
r != r0 ||
g != g0 ||
b != b0)
1361 for(
y = 0;
y < h; ++
y)
1362 for(
x = 0;
x <
w; ++
x)
1373 return changedPixels;
1378 const char *filename, *filename_pattern;
1382 unsigned char *
data;
1397 dpsnprintf(outfilename,
sizeof(outfilename),
"fixtrans/%s.tga",
buf);
1403 Con_Printf(
"%s written (%d pixels changed).\n", outfilename,
n);
1415 unsigned char buffer[18];
1439 unsigned char *
buffer, *out;
1440 const unsigned char *in, *end;
1481 end = in +
width * 4;
1482 for (;in < end;in += 4)
1499 int j, xi, oldx = 0,
f, fstep, endx, lerp;
1500 fstep = (
int) (inwidth*65536.0f/outwidth);
1502 for (j = 0,
f = 0;j < outwidth;j++,
f += fstep)
1507 in += (xi - oldx) * 4;
1513 *out++ = (
unsigned char) ((((in[4] - in[0]) * lerp) >> 16) + in[0]);
1514 *out++ = (
unsigned char) ((((in[5] - in[1]) * lerp) >> 16) + in[1]);
1515 *out++ = (
unsigned char) ((((in[6] - in[2]) * lerp) >> 16) + in[2]);
1516 *out++ = (
unsigned char) ((((in[7] - in[3]) * lerp) >> 16) + in[3]);
1528#define LERPBYTE(i) r = resamplerow1[i];out[i] = (unsigned char) ((((resamplerow2[i] - r) * lerp) >> 16) + r)
1529static void Image_Resample32Lerp(
const void *indata,
int inwidth,
int inheight,
void *outdata,
int outwidth,
int outheight)
1531 int i, j,
r, yi, oldy,
f, fstep, lerp, endy = (inheight-1), inwidth4 = inwidth*4, outwidth4 = outwidth*4;
1533 const unsigned char *inrow;
1534 unsigned char *resamplerow1;
1535 unsigned char *resamplerow2;
1536 out = (
unsigned char *)outdata;
1537 fstep = (
int) (inheight*65536.0f/outheight);
1540 resamplerow2 = resamplerow1 + outwidth*4;
1542 inrow = (
const unsigned char *)indata;
1546 for (
i = 0,
f = 0;
i < outheight;
i++,
f += fstep)
1554 inrow = (
unsigned char *)indata + inwidth4*yi;
1556 memcpy(resamplerow1, resamplerow2, outwidth4);
1610 resamplerow1 -= outwidth4;
1611 resamplerow2 -= outwidth4;
1617 inrow = (
unsigned char *)indata + inwidth4*yi;
1619 memcpy(resamplerow1, resamplerow2, outwidth4);
1624 memcpy(out, resamplerow1, outwidth4);
1629 resamplerow1 =
NULL;
1630 resamplerow2 =
NULL;
1636 unsigned frac, fracstep;
1639 out = (
int *)outdata;
1641 fracstep = inwidth*0x10000/outwidth;
1642 for (
i = 0;
i < outheight;
i++)
1644 inrow = (
int *)indata + inwidth*(
i*inheight/outheight);
1645 frac = fracstep >> 1;
1649 out[0] = inrow[frac >> 16];frac += fracstep;
1650 out[1] = inrow[frac >> 16];frac += fracstep;
1651 out[2] = inrow[frac >> 16];frac += fracstep;
1652 out[3] = inrow[frac >> 16];frac += fracstep;
1658 out[0] = inrow[frac >> 16];frac += fracstep;
1659 out[1] = inrow[frac >> 16];frac += fracstep;
1664 out[0] = inrow[frac >> 16];frac += fracstep;
1675void Image_Resample32(
const void *indata,
int inwidth,
int inheight,
int indepth,
void *outdata,
int outwidth,
int outheight,
int outdepth,
int quality)
1677 if (indepth != 1 || outdepth != 1)
1679 Con_Printf (
"Image_Resample: 3D resampling not supported\n");
1691 const unsigned char *inrow;
1693 if (*
depth != 1 || destdepth != 1)
1695 Con_Printf (
"Image_Resample: 3D resampling not supported\n");
1696 if (*
width > destwidth)
1698 if (*
height > destheight)
1700 if (*
depth > destdepth)
1707 nextrow = *
width * 4;
1708 if (*
width > destwidth)
1711 if (*
height > destheight)
1715 for (
y = 0;
y < *
height;
y++, inrow += nextrow * 2)
1717 for (in = inrow,
x = 0;
x < *
width;
x++)
1719 out[0] = (
unsigned char) ((in[0] + in[4] + in[nextrow ] + in[nextrow+4]) >> 2);
1720 out[1] = (
unsigned char) ((in[1] + in[5] + in[nextrow+1] + in[nextrow+5]) >> 2);
1721 out[2] = (
unsigned char) ((in[2] + in[6] + in[nextrow+2] + in[nextrow+6]) >> 2);
1722 out[3] = (
unsigned char) ((in[3] + in[7] + in[nextrow+3] + in[nextrow+7]) >> 2);
1731 for (
y = 0;
y < *
height;
y++, inrow += nextrow)
1733 for (in = inrow,
x = 0;
x < *
width;
x++)
1735 out[0] = (
unsigned char) ((in[0] + in[4]) >> 1);
1736 out[1] = (
unsigned char) ((in[1] + in[5]) >> 1);
1737 out[2] = (
unsigned char) ((in[2] + in[6]) >> 1);
1738 out[3] = (
unsigned char) ((in[3] + in[7]) >> 1);
1747 if (*
height > destheight)
1751 for (
y = 0;
y < *
height;
y++, inrow += nextrow * 2)
1753 for (in = inrow,
x = 0;
x < *
width;
x++)
1755 out[0] = (
unsigned char) ((in[0] + in[nextrow ]) >> 1);
1756 out[1] = (
unsigned char) ((in[1] + in[nextrow+1]) >> 1);
1757 out[2] = (
unsigned char) ((in[2] + in[nextrow+2]) >> 1);
1758 out[3] = (
unsigned char) ((in[3] + in[nextrow+3]) >> 1);
1765 Con_Printf (
"Image_MipReduce: desired size already achieved\n");
1772 const unsigned char *
b, *row[3];
1775 float ibumpscale,
n[3];
1776 ibumpscale = (255.0f * 6.0f) / bumpscale;
1781 row[0] = inpixels + (y1 *
width) * 4;
1782 row[1] = inpixels + (
y *
width) * 4;
1783 row[2] = inpixels + (
y2 *
width) * 4;
1788 b = row[1] +
x1 * 4;p[0] = (
b[0] +
b[1] +
b[2]);
1789 b = row[1] +
x2 * 4;p[1] = (
b[0] +
b[1] +
b[2]);
1791 b = row[0] +
x * 4;p[2] = (
b[0] +
b[1] +
b[2]);
1792 b = row[2] +
x * 4;p[3] = (
b[0] +
b[1] +
b[2]);
1794 b = row[1] +
x * 4;p[4] = (
b[0] +
b[1] +
b[2]);
1801 out[2] = (
int)(128.0f +
n[0] * 127.0f);
1802 out[1] = (
int)(128.0f +
n[1] * 127.0f);
1803 out[0] = (
int)(128.0f +
n[2] * 127.0f);
1804 out[3] = (p[4]) / 3;
1816 unsigned char *
data;
1824 for (
i = 0;
i < 8192;
i++)
1828 data[
i * 4 + 2] = 83 + (
unsigned char)(
random * 64);
1829 data[
i * 4 + 1] = 71 + (
unsigned char)(
random * 32);
1830 data[
i * 4 + 0] = 23 + (
unsigned char)(
random * 16);
1833 for (
i = 8192;
i < 32768;
i++)
1837 data[
i * 4 + 2] = 95 + (
unsigned char)(
random * 64);
1838 data[
i * 4 + 1] = 95 + (
unsigned char)(
random * 64);
1839 data[
i * 4 + 0] = 95 + (
unsigned char)(
random * 64);
1842 for (
i = 32768;
i < 40960;
i++)
1846 data[
i * 4 + 2] = 83 + (
unsigned char)(
random * 64);
1847 data[
i * 4 + 1] = 71 + (
unsigned char)(
random * 32);
1848 data[
i * 4 + 0] = 23 + (
unsigned char)(
random * 16);
1851 for (
i = 40960;
i < 65536;
i++)
1855 data[
i * 4 + 2] = 96 + (
unsigned char)(
random * 64);
1856 data[
i * 4 + 1] = 43 + (
unsigned char)(
random * 32);
1857 data[
i * 4 + 0] = 27 + (
unsigned char)(
random * 32);
1873 for (
y = 0;
y < 8;
y++)
1875 for (
x = 0;
x < 8;
x++)
1877 data[(
y * 8 +
x) * 4 + 0] = ((
x^
y) & 4) ? 255 : 0;
1878 data[(
y * 8 +
x) * 4 + 1] = ((
x^
y) & 4) ? 255 : 0;
1879 data[(
y * 8 +
x) * 4 + 2] = ((
x^
y) & 4) ? 255 : 0;
1880 data[(
y * 8 +
x) * 4 + 3] = 255;
1894 for (
y = 0;
y < 16;
y++)
1896 for (
x = 0;
x < 16;
x++)
1898 data[(
y * 16 +
x) * 4 + 0] =
1899 data[(
y * 16 +
x) * 4 + 1] =
1900 data[(
y * 16 +
x) * 4 + 2] = (
y < 8) ^ (
x < 8) ? 128 : 64;
1901 data[(
y * 16 +
x) * 4 + 3] = 255;
1916typedef struct embeddedpic_s
1928 "gfx/prydoncursor001", 16, 16,
1947 "ui/mousepointer", 16, 16,
1966 "gfx/crosshair1", 16, 16,
1985 "gfx/crosshair2", 16, 16,
2004 "gfx/crosshair3", 16, 16,
2023 "gfx/crosshair4", 16, 16,
2042 "gfx/crosshair5", 8, 8,
2053 "gfx/crosshair6", 2, 2,
2058 "gfx/crosshair7", 16, 16,
2098 if (!strcmp(
name,
"white") || !strcmp(
name,
"#white") || !strcmp(
name,
"*white") || !strcmp(
name,
"$whiteimage"))
2100 if (!strcmp(
name,
"gfx/conchars"))
2102 if (!strcmp(
name,
"gfx/colorcontrol/ditherpattern"))
void CL_KeepaliveMessage(qbool readmessages)
static int Cmd_Argc(cmd_state_t *cmd)
static const char * Cmd_Argv(cmd_state_t *cmd, int arg)
Cmd_Argv(cmd, ) will return an empty string (not a NULL) if arg > argc, so string operations are alwa...
@ GAME_TENEBRAE
full of evil hackery
char * va(char *buf, size_t buflen, const char *format,...)
int dpsnprintf(char *buffer, size_t buffersize, const char *format,...)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
#define dp_strlcpy(dst, src, dsize)
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
void Con_DPrintf(const char *fmt,...)
A Con_Printf that only shows up if the "developer" cvar is set.
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
void Log_Printf(const char *logfilename, const char *fmt,...)
const char * FS_FileExtension(const char *in)
qbool FS_WriteFile(const char *filename, const void *data, fs_offset_t len)
unsigned char * FS_LoadFile(const char *path, mempool_t *pool, qbool quiet, fs_offset_t *filesizepointer)
void FS_FreeSearch(fssearch_t *search)
fssearch_t * FS_Search(const char *pattern, int caseinsensitive, int quiet, const char *packfile)
static int(ZEXPORT *qz_inflate)(z_stream *strm
void FS_StripExtension(const char *in, char *out, size_t size_out)
void FS_SanitizePath(char *path)
qbool FS_WriteFileInBlocks(const char *filename, const void *const *data, const fs_offset_t *len, size_t count)
const char * FS_FileExists(const char *filename)
Look for a file in the packages and in the filesystem Returns its canonical name (same case as used i...
cvar_t developer_texturelogging
int R_PicmipForFlags(int flags)
rtexture_t * R_LoadTexture2D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, const unsigned char *data, textype_t textype, int flags, int miplevel, const unsigned int *palette)
GLenum GLsizei GLsizei height
GLubyte GLubyte GLubyte GLubyte w
GLint GLint GLint GLsizei GLsizei GLenum format
GLint GLenum GLint GLint y
GLint GLenum GLsizei GLsizei GLsizei depth
GLsizeiptr const GLvoid * data
GLint GLenum GLenum GLvoid * pixels
GLenum GLuint GLenum GLsizei const GLchar * buf
static unsigned char * Image_GetEmbeddedPicBGRA(const char *name)
void Image_MakeLinearColorsFromsRGB(unsigned char *pout, const unsigned char *pin, int numpixels)
static unsigned char image_srgbfromlinear_lightmap[256]
rtexture_t * loadtextureimage(rtexturepool_t *pool, const char *filename, qbool complain, int flags, qbool allowFixtrans, qbool sRGB)
imageformat_t imageformats_gfx[]
static void Image_Resample32Lerp(const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight)
static unsigned char * LoadWAL_BGRA(const unsigned char *f, int filesize, int *miplevel)
qbool Image_GetStockPicSize(const char *filename, int *returnwidth, int *returnheight)
unsigned char * Image_GenerateNoTexture(void)
static unsigned char * Image_GenerateWhite(void)
qbool LoadWAL_GetMetadata(const unsigned char *f, int filesize, int *retwidth, int *retheight, int *retflags, int *retvalue, int *retcontents, char *retanimname32c)
static unsigned char image_linearfromsrgb[256]
unsigned char * LoadTGA_BGRA(const unsigned char *f, int filesize, int *miplevel)
void Image_FixTransparentPixels_f(cmd_state_t *cmd)
static void Image_CopyAlphaFromBlueBGRA(unsigned char *outpixels, const unsigned char *inpixels, int w, int h)
void Image_Resample32(const void *indata, int inwidth, int inheight, int indepth, void *outdata, int outwidth, int outheight, int outdepth, int quality)
static unsigned char * Image_GenerateConChars(void)
imageformat_t imageformats_other[]
static void PrintTargaHeader(TargaHeader *t)
imageformat_t imageformats_textures[]
void Image_HeightmapToNormalmap_BGRA(const unsigned char *inpixels, unsigned char *outpixels, int width, int height, int clamp, float bumpscale)
static unsigned char * Image_GenerateDitherPattern(void)
void Image_Copy8bitBGRA(const unsigned char *in, unsigned char *out, int pixels, const unsigned int *pal)
void Image_MipReduce32(const unsigned char *in, unsigned char *out, int *width, int *height, int *depth, int destwidth, int destheight, int destdepth)
static unsigned char * LoadConChars_BGRA(const unsigned char *f, int filesize, int *miplevel)
qbool Image_WriteTGABGR_preflipped(const char *filename, int width, int height, const unsigned char *data)
qbool LoadPCX_PaletteOnly(const unsigned char *f, int filesize, unsigned char *palette768b)
void Image_MakesRGBColorsFromLinear_Lightmap(unsigned char *pout, const unsigned char *pin, int numpixels)
imageformat_t imageformats_nopath[]
static const embeddedpic_t embeddedpics[]
void Image_CopyMux(unsigned char *outpixels, const unsigned char *inpixels, int inputwidth, int inputheight, qbool inputflipx, qbool inputflipy, qbool inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices)
imageformat_t imageformats_dq[]
qbool Image_WriteTGABGRA(const char *filename, int width, int height, const unsigned char *data)
imageformat_t imageformats_tenebrae[]
unsigned char * loadimagepixelsbgra(const char *filename, qbool complain, qbool allowFixtrans, qbool convertsRGB, int *miplevel)
static void Image_Resample32LerpLine(const unsigned char *in, unsigned char *out, int inwidth, int outwidth)
qbool LoadPCX_QWSkin(const unsigned char *f, int filesize, unsigned char *pixels, int outwidth, int outheight)
static void Image_Resample32Nolerp(const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight)
void Image_GammaRemapRGB(const unsigned char *in, unsigned char *out, int pixels, const unsigned char *gammar, const unsigned char *gammag, const unsigned char *gammab)
void Image_StripImageExtension(const char *in, char *out, size_t size_out)
int fixtransparentpixels(unsigned char *data, int w, int h)
static unsigned char * LoadPCX_BGRA(const unsigned char *f, int filesize, int *miplevel)
static unsigned char * LoadLMP_BGRA(const unsigned char *f, int filesize, int *miplevel)
#define Image_LinearFloatFromsRGB(c)
#define Image_sRGBFloatFromLinear_Lightmap(c)
unsigned char * PNG_LoadImage_BGRA(const unsigned char *raw, int filesize, int *miplevel)
unsigned char * JPEG_LoadImage_BGRA(const unsigned char *f, int filesize, int *miplevel)
static const unsigned char concharimage[]
#define VectorNormalize(v)
#define bound(min, num, max)
#define lhrandom(MIN, MAX)
LadyHavoc: this function never returns exactly MIN or exactly MAX, because of a QuakeC bug in id1 whe...
#define Vector4Copy(in, out)
unsigned int palette_bgra_transparent[256]
unsigned int palette_bgra_font[256]
unsigned int q2palette_bgra_complete[256]
unsigned int palette_bgra_embeddedpic[256]
#define MAX_QPATH
max length of a quake game pathname
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
unsigned short palette_type
unsigned short bytes_per_line
unsigned offsets[MIPLEVELS]
unsigned char * W_GetLumpName(const char *name, fs_offset_t *returnfilesize)
#define Mem_Alloc(pool, size)