Merge branch 'public_next'
# Conflicts: # src/p_setup.c # src/r_data.c
This commit is contained in:
commit
fd783f09ea
68
src/i_tcp.c
68
src/i_tcp.c
|
@ -649,14 +649,29 @@ static boolean SOCK_CanGet(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NONET
|
#ifndef NONET
|
||||||
static void SOCK_Send(void)
|
static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr)
|
||||||
{
|
{
|
||||||
ssize_t c = ERRSOCKET;
|
|
||||||
socklen_t d4 = (socklen_t)sizeof(struct sockaddr_in);
|
socklen_t d4 = (socklen_t)sizeof(struct sockaddr_in);
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
socklen_t d6 = (socklen_t)sizeof(struct sockaddr_in6);
|
socklen_t d6 = (socklen_t)sizeof(struct sockaddr_in6);
|
||||||
#endif
|
#endif
|
||||||
socklen_t d, da = (socklen_t)sizeof(mysockaddr_t);
|
socklen_t d, da = (socklen_t)sizeof(mysockaddr_t);
|
||||||
|
|
||||||
|
switch (sockaddr->any.sa_family)
|
||||||
|
{
|
||||||
|
case AF_INET: d = d4; break;
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
case AF_INET6: d = d6; break;
|
||||||
|
#endif
|
||||||
|
default: d = da; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sendto(socket, (char *)&doomcom->data, doomcom->datalength, 0, &sockaddr->any, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SOCK_Send(void)
|
||||||
|
{
|
||||||
|
ssize_t c = ERRSOCKET;
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
|
|
||||||
if (!nodeconnected[doomcom->remotenode])
|
if (!nodeconnected[doomcom->remotenode])
|
||||||
|
@ -669,19 +684,7 @@ static void SOCK_Send(void)
|
||||||
for (j = 0; j < broadcastaddresses; j++)
|
for (j = 0; j < broadcastaddresses; j++)
|
||||||
{
|
{
|
||||||
if (myfamily[i] == broadcastaddress[j].any.sa_family)
|
if (myfamily[i] == broadcastaddress[j].any.sa_family)
|
||||||
{
|
SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]);
|
||||||
if (broadcastaddress[i].any.sa_family == AF_INET)
|
|
||||||
d = d4;
|
|
||||||
#ifdef HAVE_IPV6
|
|
||||||
else if (broadcastaddress[i].any.sa_family == AF_INET6)
|
|
||||||
d = d6;
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
d = da;
|
|
||||||
|
|
||||||
c = sendto(mysockets[i], (char *)&doomcom->data, doomcom->datalength, 0,
|
|
||||||
&broadcastaddress[j].any, d);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -691,35 +694,13 @@ static void SOCK_Send(void)
|
||||||
for (i = 0; i < mysocketses; i++)
|
for (i = 0; i < mysocketses; i++)
|
||||||
{
|
{
|
||||||
if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family)
|
if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family)
|
||||||
{
|
SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]);
|
||||||
if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET)
|
|
||||||
d = d4;
|
|
||||||
#ifdef HAVE_IPV6
|
|
||||||
else if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET6)
|
|
||||||
d = d6;
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
d = da;
|
|
||||||
|
|
||||||
sendto(mysockets[i], (char *)&doomcom->data, doomcom->datalength, 0,
|
|
||||||
&clientaddress[doomcom->remotenode].any, d);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET)
|
c = SOCK_SendToAddr(nodesocket[doomcom->remotenode], &clientaddress[doomcom->remotenode]);
|
||||||
d = d4;
|
|
||||||
#ifdef HAVE_IPV6
|
|
||||||
else if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET6)
|
|
||||||
d = d6;
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
d = da;
|
|
||||||
|
|
||||||
c = sendto(nodesocket[doomcom->remotenode], (char *)&doomcom->data, doomcom->datalength, 0,
|
|
||||||
&clientaddress[doomcom->remotenode].any, d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == ERRSOCKET && errno != ECONNREFUSED && errno != EWOULDBLOCK)
|
if (c == ERRSOCKET && errno != ECONNREFUSED && errno != EWOULDBLOCK)
|
||||||
|
@ -1007,7 +988,7 @@ static boolean UDP_Socket(void)
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
while (runp != NULL)
|
while (runp != NULL && s < MAXNETNODES+1)
|
||||||
{
|
{
|
||||||
memcpy(&clientaddress[s], runp->ai_addr, runp->ai_addrlen);
|
memcpy(&clientaddress[s], runp->ai_addr, runp->ai_addrlen);
|
||||||
s++;
|
s++;
|
||||||
|
@ -1022,12 +1003,15 @@ static boolean UDP_Socket(void)
|
||||||
clientaddress[s].ip4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); //GetLocalAddress(); // my own ip
|
clientaddress[s].ip4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); //GetLocalAddress(); // my own ip
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s = 0;
|
||||||
|
|
||||||
// setup broadcast adress to BROADCASTADDR entry
|
// setup broadcast adress to BROADCASTADDR entry
|
||||||
gaie = I_getaddrinfo("255.255.255.255", "0", &hints, &ai);
|
gaie = I_getaddrinfo("255.255.255.255", "0", &hints, &ai);
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
while (runp != NULL)
|
while (runp != NULL && s < MAXNETNODES+1)
|
||||||
{
|
{
|
||||||
memcpy(&broadcastaddress[s], runp->ai_addr, runp->ai_addrlen);
|
memcpy(&broadcastaddress[s], runp->ai_addr, runp->ai_addrlen);
|
||||||
s++;
|
s++;
|
||||||
|
@ -1050,7 +1034,7 @@ static boolean UDP_Socket(void)
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
while (runp != NULL)
|
while (runp != NULL && s < MAXNETNODES+1)
|
||||||
{
|
{
|
||||||
memcpy(&broadcastaddress[s], runp->ai_addr, runp->ai_addrlen);
|
memcpy(&broadcastaddress[s], runp->ai_addr, runp->ai_addrlen);
|
||||||
s++;
|
s++;
|
||||||
|
|
|
@ -2937,7 +2937,6 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
// Important: take care of the ordering of the next functions.
|
// Important: take care of the ordering of the next functions.
|
||||||
if (!loadedbm)
|
if (!loadedbm)
|
||||||
P_CreateBlockMap(); // Graue 02-29-2004
|
P_CreateBlockMap(); // Graue 02-29-2004
|
||||||
R_MakeColormaps();
|
|
||||||
P_LoadLineDefs2();
|
P_LoadLineDefs2();
|
||||||
P_GroupLines();
|
P_GroupLines();
|
||||||
numdmstarts = numredctfstarts = numbluectfstarts = 0;
|
numdmstarts = numredctfstarts = numbluectfstarts = 0;
|
||||||
|
@ -2974,7 +2973,6 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
// Important: take care of the ordering of the next functions.
|
// Important: take care of the ordering of the next functions.
|
||||||
if (!loadedbm)
|
if (!loadedbm)
|
||||||
P_CreateBlockMap(); // Graue 02-29-2004
|
P_CreateBlockMap(); // Graue 02-29-2004
|
||||||
R_MakeColormaps();
|
|
||||||
P_LoadLineDefs2();
|
P_LoadLineDefs2();
|
||||||
P_GroupLines();
|
P_GroupLines();
|
||||||
numdmstarts = numredctfstarts = numbluectfstarts = 0;
|
numdmstarts = numredctfstarts = numbluectfstarts = 0;
|
||||||
|
|
201
src/r_data.c
201
src/r_data.c
|
@ -1313,9 +1313,6 @@ void R_ReInitColormaps(UINT16 num)
|
||||||
|
|
||||||
static lumpnum_t foundcolormaps[MAXCOLORMAPS];
|
static lumpnum_t foundcolormaps[MAXCOLORMAPS];
|
||||||
|
|
||||||
static char colormapFixingArray[MAXCOLORMAPS][3][9];
|
|
||||||
static size_t carrayindex;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_ClearColormaps
|
// R_ClearColormaps
|
||||||
//
|
//
|
||||||
|
@ -1327,8 +1324,6 @@ void R_ClearColormaps(void)
|
||||||
|
|
||||||
num_extra_colormaps = 0;
|
num_extra_colormaps = 0;
|
||||||
|
|
||||||
carrayindex = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < MAXCOLORMAPS; i++)
|
for (i = 0; i < MAXCOLORMAPS; i++)
|
||||||
foundcolormaps[i] = LUMPERROR;
|
foundcolormaps[i] = LUMPERROR;
|
||||||
|
|
||||||
|
@ -1385,7 +1380,7 @@ static int RoundUp(double number);
|
||||||
INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
{
|
{
|
||||||
double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb;
|
double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb;
|
||||||
double r, g, b, cbrightness, maskamt = 0, othermask = 0;
|
double maskamt = 0, othermask = 0;
|
||||||
int mask, fog = 0;
|
int mask, fog = 0;
|
||||||
size_t mapnum = num_extra_colormaps;
|
size_t mapnum = num_extra_colormaps;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
@ -1438,7 +1433,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
fadedist = fadeend - fadestart;
|
fadedist = fadeend - fadestart;
|
||||||
fog = NUMFROMCHAR(p2[1]);
|
fog = NUMFROMCHAR(p2[1]);
|
||||||
}
|
}
|
||||||
#undef getnum
|
#undef NUMFROMCHAR
|
||||||
|
|
||||||
if (p3[0] == '#')
|
if (p3[0] == '#')
|
||||||
{
|
{
|
||||||
|
@ -1469,14 +1464,31 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
if (num_extra_colormaps == MAXCOLORMAPS)
|
if (num_extra_colormaps == MAXCOLORMAPS)
|
||||||
I_Error("R_CreateColormap: Too many colormaps! the limit is %d\n", MAXCOLORMAPS);
|
I_Error("R_CreateColormap: Too many colormaps! the limit is %d\n", MAXCOLORMAPS);
|
||||||
|
|
||||||
strncpy(colormapFixingArray[num_extra_colormaps][0], p1, 8);
|
|
||||||
strncpy(colormapFixingArray[num_extra_colormaps][1], p2, 8);
|
|
||||||
strncpy(colormapFixingArray[num_extra_colormaps][2], p3, 8);
|
|
||||||
|
|
||||||
num_extra_colormaps++;
|
num_extra_colormaps++;
|
||||||
|
|
||||||
|
foundcolormaps[mapnum] = LUMPERROR;
|
||||||
|
|
||||||
|
// aligned on 8 bit for asm code
|
||||||
|
extra_colormaps[mapnum].colormap = NULL;
|
||||||
|
extra_colormaps[mapnum].maskcolor = (UINT16)maskcolor;
|
||||||
|
extra_colormaps[mapnum].fadecolor = (UINT16)fadecolor;
|
||||||
|
extra_colormaps[mapnum].maskamt = maskamt;
|
||||||
|
extra_colormaps[mapnum].fadestart = (UINT16)fadestart;
|
||||||
|
extra_colormaps[mapnum].fadeend = (UINT16)fadeend;
|
||||||
|
extra_colormaps[mapnum].fog = fog;
|
||||||
|
|
||||||
|
// This code creates the colormap array used by software renderer
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft)
|
||||||
{
|
{
|
||||||
|
double r, g, b, cbrightness;
|
||||||
|
int p;
|
||||||
|
char *colormap_p;
|
||||||
|
|
||||||
|
// Initialise the map and delta arrays
|
||||||
|
// map[i] stores an RGB color (as double) for index i,
|
||||||
|
// which is then converted to SRB2's palette later
|
||||||
|
// deltas[i] stores a corresponding fade delta between the RGB color and the final fade color;
|
||||||
|
// map[i]'s values are decremented by after each use
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
r = pMasterPalette[i].s.red;
|
r = pMasterPalette[i].s.red;
|
||||||
|
@ -1499,168 +1511,13 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
map[i][2] = 255.0l;
|
map[i][2] = 255.0l;
|
||||||
deltas[i][2] = (map[i][2] - cdestb) / (double)fadedist;
|
deltas[i][2] = (map[i][2] - cdestb) / (double)fadedist;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
foundcolormaps[mapnum] = LUMPERROR;
|
// Now allocate memory for the actual colormap array itself!
|
||||||
|
|
||||||
// aligned on 8 bit for asm code
|
|
||||||
extra_colormaps[mapnum].colormap = NULL;
|
|
||||||
extra_colormaps[mapnum].maskcolor = (UINT16)maskcolor;
|
|
||||||
extra_colormaps[mapnum].fadecolor = (UINT16)fadecolor;
|
|
||||||
extra_colormaps[mapnum].maskamt = maskamt;
|
|
||||||
extra_colormaps[mapnum].fadestart = (UINT16)fadestart;
|
|
||||||
extra_colormaps[mapnum].fadeend = (UINT16)fadeend;
|
|
||||||
extra_colormaps[mapnum].fog = fog;
|
|
||||||
|
|
||||||
return (INT32)mapnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
void R_MakeColormaps(void)
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
carrayindex = num_extra_colormaps;
|
|
||||||
num_extra_colormaps = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < carrayindex; i++)
|
|
||||||
R_CreateColormap2(colormapFixingArray[i][0], colormapFixingArray[i][1],
|
|
||||||
colormapFixingArray[i][2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void R_CreateColormap2(char *p1, char *p2, char *p3)
|
|
||||||
{
|
|
||||||
double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb;
|
|
||||||
double r, g, b, cbrightness;
|
|
||||||
double maskamt = 0, othermask = 0;
|
|
||||||
int mask, p, fog = 0;
|
|
||||||
size_t mapnum = num_extra_colormaps;
|
|
||||||
size_t i;
|
|
||||||
char *colormap_p;
|
|
||||||
UINT32 cr, cg, cb, maskcolor, fadecolor;
|
|
||||||
UINT32 fadestart = 0, fadeend = 31, fadedist = 31;
|
|
||||||
|
|
||||||
#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0)
|
|
||||||
if (p1[0] == '#')
|
|
||||||
{
|
|
||||||
cr = ((HEX2INT(p1[1]) * 16) + HEX2INT(p1[2]));
|
|
||||||
cmaskr = cr;
|
|
||||||
cg = ((HEX2INT(p1[3]) * 16) + HEX2INT(p1[4]));
|
|
||||||
cmaskg = cg;
|
|
||||||
cb = ((HEX2INT(p1[5]) * 16) + HEX2INT(p1[6]));
|
|
||||||
cmaskb = cb;
|
|
||||||
// Create a rough approximation of the color (a 16 bit color)
|
|
||||||
maskcolor = ((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11);
|
|
||||||
if (p1[7] >= 'a' && p1[7] <= 'z')
|
|
||||||
mask = (p1[7] - 'a');
|
|
||||||
else if (p1[7] >= 'A' && p1[7] <= 'Z')
|
|
||||||
mask = (p1[7] - 'A');
|
|
||||||
else
|
|
||||||
mask = 24;
|
|
||||||
|
|
||||||
maskamt = (double)(mask/24.0l);
|
|
||||||
|
|
||||||
othermask = 1 - maskamt;
|
|
||||||
maskamt /= 0xff;
|
|
||||||
cmaskr *= maskamt;
|
|
||||||
cmaskg *= maskamt;
|
|
||||||
cmaskb *= maskamt;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cmaskr = cmaskg = cmaskb = 0xff;
|
|
||||||
maskamt = 0;
|
|
||||||
maskcolor = ((0xff) >> 3) + (((0xff) >> 2) << 5) + (((0xff) >> 3) << 11);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NUMFROMCHAR(c) (c >= '0' && c <= '9' ? c - '0' : 0)
|
|
||||||
if (p2[0] == '#')
|
|
||||||
{
|
|
||||||
// Get parameters like fadestart, fadeend, and the fogflag
|
|
||||||
fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10);
|
|
||||||
fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10);
|
|
||||||
if (fadestart > 30)
|
|
||||||
fadestart = 0;
|
|
||||||
if (fadeend > 31 || fadeend < 1)
|
|
||||||
fadeend = 31;
|
|
||||||
fadedist = fadeend - fadestart;
|
|
||||||
fog = NUMFROMCHAR(p2[1]);
|
|
||||||
}
|
|
||||||
#undef getnum
|
|
||||||
|
|
||||||
if (p3[0] == '#')
|
|
||||||
{
|
|
||||||
cdestr = cr = ((HEX2INT(p3[1]) * 16) + HEX2INT(p3[2]));
|
|
||||||
cdestg = cg = ((HEX2INT(p3[3]) * 16) + HEX2INT(p3[4]));
|
|
||||||
cdestb = cb = ((HEX2INT(p3[5]) * 16) + HEX2INT(p3[6]));
|
|
||||||
fadecolor = (((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
cdestr = cdestg = cdestb = fadecolor = 0;
|
|
||||||
#undef HEX2INT
|
|
||||||
|
|
||||||
for (i = 0; i < num_extra_colormaps; i++)
|
|
||||||
{
|
|
||||||
if (foundcolormaps[i] != LUMPERROR)
|
|
||||||
continue;
|
|
||||||
if (maskcolor == extra_colormaps[i].maskcolor
|
|
||||||
&& fadecolor == extra_colormaps[i].fadecolor
|
|
||||||
&& (float)maskamt == (float)extra_colormaps[i].maskamt
|
|
||||||
&& fadestart == extra_colormaps[i].fadestart
|
|
||||||
&& fadeend == extra_colormaps[i].fadeend
|
|
||||||
&& fog == extra_colormaps[i].fog)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num_extra_colormaps == MAXCOLORMAPS)
|
|
||||||
I_Error("R_CreateColormap: Too many colormaps! the limit is %d\n", MAXCOLORMAPS);
|
|
||||||
|
|
||||||
num_extra_colormaps++;
|
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
{
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
{
|
|
||||||
r = pMasterPalette[i].s.red;
|
|
||||||
g = pMasterPalette[i].s.green;
|
|
||||||
b = pMasterPalette[i].s.blue;
|
|
||||||
cbrightness = sqrt((r*r) + (g*g) + (b*b));
|
|
||||||
|
|
||||||
map[i][0] = (cbrightness * cmaskr) + (r * othermask);
|
|
||||||
if (map[i][0] > 255.0l)
|
|
||||||
map[i][0] = 255.0l;
|
|
||||||
deltas[i][0] = (map[i][0] - cdestr) / (double)fadedist;
|
|
||||||
|
|
||||||
map[i][1] = (cbrightness * cmaskg) + (g * othermask);
|
|
||||||
if (map[i][1] > 255.0l)
|
|
||||||
map[i][1] = 255.0l;
|
|
||||||
deltas[i][1] = (map[i][1] - cdestg) / (double)fadedist;
|
|
||||||
|
|
||||||
map[i][2] = (cbrightness * cmaskb) + (b * othermask);
|
|
||||||
if (map[i][2] > 255.0l)
|
|
||||||
map[i][2] = 255.0l;
|
|
||||||
deltas[i][2] = (map[i][2] - cdestb) / (double)fadedist;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foundcolormaps[mapnum] = LUMPERROR;
|
|
||||||
|
|
||||||
// aligned on 8 bit for asm code
|
|
||||||
extra_colormaps[mapnum].colormap = NULL;
|
|
||||||
extra_colormaps[mapnum].maskcolor = (UINT16)maskcolor;
|
|
||||||
extra_colormaps[mapnum].fadecolor = (UINT16)fadecolor;
|
|
||||||
extra_colormaps[mapnum].maskamt = maskamt;
|
|
||||||
extra_colormaps[mapnum].fadestart = (UINT16)fadestart;
|
|
||||||
extra_colormaps[mapnum].fadeend = (UINT16)fadeend;
|
|
||||||
extra_colormaps[mapnum].fog = fog;
|
|
||||||
|
|
||||||
#define ABS2(x) ((x) < 0 ? -(x) : (x))
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
{
|
|
||||||
colormap_p = Z_MallocAlign((256 * 34) + 10, PU_LEVEL, NULL, 8);
|
colormap_p = Z_MallocAlign((256 * 34) + 10, PU_LEVEL, NULL, 8);
|
||||||
extra_colormaps[mapnum].colormap = (UINT8 *)colormap_p;
|
extra_colormaps[mapnum].colormap = (UINT8 *)colormap_p;
|
||||||
|
|
||||||
|
// Calculate the palette index for each palette index, for each light level
|
||||||
|
// (as well as the two unused colormap lines we inherited from Doom)
|
||||||
for (p = 0; p < 34; p++)
|
for (p = 0; p < 34; p++)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
|
@ -1672,7 +1529,7 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
|
||||||
|
|
||||||
if ((UINT32)p < fadestart)
|
if ((UINT32)p < fadestart)
|
||||||
continue;
|
continue;
|
||||||
|
#define ABS2(x) ((x) < 0 ? -(x) : (x))
|
||||||
if (ABS2(map[i][0] - cdestr) > ABS2(deltas[i][0]))
|
if (ABS2(map[i][0] - cdestr) > ABS2(deltas[i][0]))
|
||||||
map[i][0] -= deltas[i][0];
|
map[i][0] -= deltas[i][0];
|
||||||
else
|
else
|
||||||
|
@ -1687,12 +1544,12 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
|
||||||
map[i][2] -= deltas[i][2];
|
map[i][2] -= deltas[i][2];
|
||||||
else
|
else
|
||||||
map[i][2] = cdestb;
|
map[i][2] = cdestb;
|
||||||
|
#undef ABS2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#undef ABS2
|
|
||||||
|
|
||||||
return;
|
return (INT32)mapnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Thanks to quake2 source!
|
// Thanks to quake2 source!
|
||||||
|
|
|
@ -100,8 +100,6 @@ void R_ReInitColormaps(UINT16 num);
|
||||||
void R_ClearColormaps(void);
|
void R_ClearColormaps(void);
|
||||||
INT32 R_ColormapNumForName(char *name);
|
INT32 R_ColormapNumForName(char *name);
|
||||||
INT32 R_CreateColormap(char *p1, char *p2, char *p3);
|
INT32 R_CreateColormap(char *p1, char *p2, char *p3);
|
||||||
void R_CreateColormap2(char *p1, char *p2, char *p3);
|
|
||||||
void R_MakeColormaps(void);
|
|
||||||
const char *R_ColormapNameForNum(INT32 num);
|
const char *R_ColormapNameForNum(INT32 num);
|
||||||
|
|
||||||
extern INT32 numtextures;
|
extern INT32 numtextures;
|
||||||
|
|
Loading…
Reference in New Issue