fullbrights on player skins now work properly instead of using the fb skin

of the player model.
This commit is contained in:
Bill Currie 2001-01-20 06:47:01 +00:00
parent 92f357a2ad
commit 1444bac78d
7 changed files with 111 additions and 75 deletions

View file

@ -40,41 +40,39 @@
#include "r_local.h"
#include "sys.h"
int
Mod_CalcFullbright (byte *in, byte *out, int pixels)
{
int fb = 0;
while (pixels--) {
if (*in >= 256 - 32) {
fb = 1;
*out++ = *in++;
} else {
*out++ = 255;
in++;
}
}
return fb;
}
int
Mod_Fullbright (byte * skin, int width, int height, char *name)
{
int j;
int pixels;
qboolean hasfullbrights = false;
int texnum;
int texnum = 0;
byte *ptexels;
// Check for fullbright pixels..
pixels = width * height;
for (j = 0; j < pixels; j++) {
if (skin[j] >= 256 - 32) {
hasfullbrights = true;
break;
}
}
if (hasfullbrights) {
byte *ptexels;
// ptexels = Hunk_Alloc(s);
ptexels = malloc (pixels);
// ptexels = Hunk_Alloc(s);
ptexels = malloc (pixels);
if (Mod_CalcFullbright (skin, ptexels, pixels)) {
Con_DPrintf ("FB Model ID: '%s'\n", name);
for (j = 0; j < pixels; j++) {
if (skin[j] >= 256 - 32) {
ptexels[j] = skin[j];
} else {
ptexels[j] = 255;
}
}
texnum = GL_LoadTexture (name, width, height, ptexels, true, true, 1);
free (ptexels);
return texnum;
}
return 0;
free (ptexels);
return texnum;
}