Make colors UINT16, increase color freeslots to 1024

This commit is contained in:
SwitchKaze 2020-05-23 19:29:07 -05:00
parent 46191cade7
commit b37c73b008
34 changed files with 163 additions and 143 deletions

View File

@ -1495,7 +1495,7 @@ static boolean SV_SendServerConfig(INT32 node)
if (!playeringame[i]) if (!playeringame[i])
continue; continue;
netbuffer->u.servercfg.playerskins[i] = (UINT8)players[i].skin; netbuffer->u.servercfg.playerskins[i] = (UINT8)players[i].skin;
netbuffer->u.servercfg.playercolor[i] = (UINT8)players[i].skincolor; netbuffer->u.servercfg.playercolor[i] = (UINT16)players[i].skincolor;
netbuffer->u.servercfg.playeravailabilities[i] = (UINT32)LONG(players[i].availabilities); netbuffer->u.servercfg.playeravailabilities[i] = (UINT32)LONG(players[i].availabilities);
} }
@ -3877,7 +3877,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
for (j = 0; j < MAXPLAYERS; j++) for (j = 0; j < MAXPLAYERS; j++)
{ {
if (netbuffer->u.servercfg.playerskins[j] == 0xFF if (netbuffer->u.servercfg.playerskins[j] == 0xFF
&& netbuffer->u.servercfg.playercolor[j] == 0xFF && netbuffer->u.servercfg.playercolor[j] == 0xFFFF
&& netbuffer->u.servercfg.playeravailabilities[j] == 0xFFFFFFFF) && netbuffer->u.servercfg.playeravailabilities[j] == 0xFFFFFFFF)
continue; // not in game continue; // not in game

View File

@ -188,7 +188,7 @@ typedef struct
SINT8 xtralife; SINT8 xtralife;
SINT8 pity; SINT8 pity;
UINT8 skincolor; UINT16 skincolor;
INT32 skin; INT32 skin;
UINT32 availabilities; UINT32 availabilities;
// Just in case Lua does something like // Just in case Lua does something like
@ -308,7 +308,7 @@ typedef struct
// 0xFF == not in game; else player skin num // 0xFF == not in game; else player skin num
UINT8 playerskins[MAXPLAYERS]; UINT8 playerskins[MAXPLAYERS];
UINT8 playercolor[MAXPLAYERS]; UINT16 playercolor[MAXPLAYERS];
UINT32 playeravailabilities[MAXPLAYERS]; UINT32 playeravailabilities[MAXPLAYERS];
UINT8 gametype; UINT8 gametype;
@ -414,7 +414,7 @@ typedef struct
{ {
char name[MAXPLAYERNAME+1]; char name[MAXPLAYERNAME+1];
UINT8 skin; UINT8 skin;
UINT8 color; UINT16 color;
UINT32 pflags; UINT32 pflags;
UINT32 score; UINT32 score;
UINT8 ctfteam; UINT8 ctfteam;

View File

@ -225,7 +225,7 @@ consvar_t cv_allowseenames = {"allowseenames", "Yes", CV_NETVAR, CV_YesNo, NULL,
consvar_t cv_playername = {"name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playername = {"name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_playername2 = {"name2", "Tails", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name2_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playername2 = {"name2", "Tails", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name2_OnChange, 0, NULL, NULL, 0, 0, NULL};
// player colors // player colors
UINT8 lastgoodcolor = SKINCOLOR_BLUE, lastgoodcolor2 = SKINCOLOR_BLUE; UINT16 lastgoodcolor = SKINCOLOR_BLUE, lastgoodcolor2 = SKINCOLOR_BLUE;
consvar_t cv_playercolor = {"color", "Blue", CV_CALL|CV_NOINIT, Color_cons_t, Color_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playercolor = {"color", "Blue", CV_CALL|CV_NOINIT, Color_cons_t, Color_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_playercolor2 = {"color2", "Orange", CV_CALL|CV_NOINIT, Color_cons_t, Color2_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playercolor2 = {"color2", "Orange", CV_CALL|CV_NOINIT, Color_cons_t, Color2_OnChange, 0, NULL, NULL, 0, 0, NULL};
// player's skin, saved for commodity, when using a favorite skins wad.. // player's skin, saved for commodity, when using a favorite skins wad..
@ -1285,7 +1285,7 @@ static void SendNameAndColor(void)
players[consoleplayer].skincolor = cv_playercolor.value % numskincolors; players[consoleplayer].skincolor = cv_playercolor.value % numskincolors;
if (players[consoleplayer].mo) if (players[consoleplayer].mo)
players[consoleplayer].mo->color = (UINT8)players[consoleplayer].skincolor; players[consoleplayer].mo->color = (UINT16)players[consoleplayer].skincolor;
}*/ }*/
} }
else else
@ -1323,7 +1323,7 @@ static void SendNameAndColor(void)
// Finally write out the complete packet and send it off. // Finally write out the complete packet and send it off.
WRITESTRINGN(p, cv_playername.zstring, MAXPLAYERNAME); WRITESTRINGN(p, cv_playername.zstring, MAXPLAYERNAME);
WRITEUINT32(p, (UINT32)players[consoleplayer].availabilities); WRITEUINT32(p, (UINT32)players[consoleplayer].availabilities);
WRITEUINT8(p, (UINT8)cv_playercolor.value); WRITEUINT16(p, (UINT16)cv_playercolor.value);
WRITEUINT8(p, (UINT8)cv_skin.value); WRITEUINT8(p, (UINT8)cv_skin.value);
SendNetXCmd(XD_NAMEANDCOLOR, buf, p - buf); SendNetXCmd(XD_NAMEANDCOLOR, buf, p - buf);
} }
@ -1439,7 +1439,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
{ {
player_t *p = &players[playernum]; player_t *p = &players[playernum];
char name[MAXPLAYERNAME+1]; char name[MAXPLAYERNAME+1];
UINT8 color, skin; UINT16 color;
UINT8 skin;
#ifdef PARANOIA #ifdef PARANOIA
if (playernum < 0 || playernum > MAXPLAYERS) if (playernum < 0 || playernum > MAXPLAYERS)
@ -1458,7 +1459,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
READSTRINGN(*cp, name, MAXPLAYERNAME); READSTRINGN(*cp, name, MAXPLAYERNAME);
p->availabilities = READUINT32(*cp); p->availabilities = READUINT32(*cp);
color = READUINT8(*cp); color = READUINT16(*cp);
skin = READUINT8(*cp); skin = READUINT8(*cp);
// set name // set name
@ -1468,7 +1469,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
// set color // set color
p->skincolor = color % numskincolors; p->skincolor = color % numskincolors;
if (p->mo) if (p->mo)
p->mo->color = (UINT8)p->skincolor; p->mo->color = (UINT16)p->skincolor;
// normal player colors // normal player colors
if (server && (p != &players[consoleplayer] && p != &players[secondarydisplayplayer])) if (server && (p != &players[consoleplayer] && p != &players[secondarydisplayplayer]))

View File

@ -366,7 +366,7 @@ typedef struct player_s
UINT16 flashpal; UINT16 flashpal;
// Player skin colorshift, 0-15 for which color to draw player. // Player skin colorshift, 0-15 for which color to draw player.
UINT8 skincolor; UINT16 skincolor;
INT32 skin; INT32 skin;
UINT32 availabilities; UINT32 availabilities;

View File

@ -452,7 +452,7 @@ static void readPlayer(MYFILE *f, INT32 num)
else if (fastcmp(word, "OPPOSITECOLOR") || fastcmp(word, "OPPOSITECOLOUR")) else if (fastcmp(word, "OPPOSITECOLOR") || fastcmp(word, "OPPOSITECOLOUR"))
{ {
SLOTFOUND SLOTFOUND
description[num].oppositecolor = (UINT8)get_number(word2); description[num].oppositecolor = (UINT16)get_number(word2);
} }
else if (fastcmp(word, "NAMETAG") || fastcmp(word, "TAGNAME")) else if (fastcmp(word, "NAMETAG") || fastcmp(word, "TAGNAME"))
{ {
@ -462,12 +462,12 @@ static void readPlayer(MYFILE *f, INT32 num)
else if (fastcmp(word, "TAGTEXTCOLOR") || fastcmp(word, "TAGTEXTCOLOUR")) else if (fastcmp(word, "TAGTEXTCOLOR") || fastcmp(word, "TAGTEXTCOLOUR"))
{ {
SLOTFOUND SLOTFOUND
description[num].tagtextcolor = (UINT8)get_number(word2); description[num].tagtextcolor = (UINT16)get_number(word2);
} }
else if (fastcmp(word, "TAGOUTLINECOLOR") || fastcmp(word, "TAGOUTLINECOLOUR")) else if (fastcmp(word, "TAGOUTLINECOLOR") || fastcmp(word, "TAGOUTLINECOLOUR"))
{ {
SLOTFOUND SLOTFOUND
description[num].tagoutlinecolor = (UINT8)get_number(word2); description[num].tagoutlinecolor = (UINT16)get_number(word2);
} }
else if (fastcmp(word, "STATUS")) else if (fastcmp(word, "STATUS"))
{ {
@ -821,11 +821,11 @@ static void readskincolor(MYFILE *f, INT32 num)
} }
else if (fastcmp(word, "INVCOLOR")) else if (fastcmp(word, "INVCOLOR"))
{ {
skincolors[num].invcolor = (UINT8)get_number(word2); skincolors[num].invcolor = (UINT16)get_number(word2);
} }
else if (fastcmp(word, "INVSHADE")) else if (fastcmp(word, "INVSHADE"))
{ {
skincolors[num].invshade = get_number(word2); skincolors[num].invshade = get_number(word2)%COLORRAMPSIZE;
} }
else if (fastcmp(word, "CHATCOLOR")) else if (fastcmp(word, "CHATCOLOR"))
{ {
@ -4043,19 +4043,19 @@ static void readmaincfg(MYFILE *f)
} }
else if (fastcmp(word, "REDTEAM")) else if (fastcmp(word, "REDTEAM"))
{ {
skincolor_redteam = (UINT8)get_number(word2); skincolor_redteam = (UINT16)get_number(word2);
} }
else if (fastcmp(word, "BLUETEAM")) else if (fastcmp(word, "BLUETEAM"))
{ {
skincolor_blueteam = (UINT8)get_number(word2); skincolor_blueteam = (UINT16)get_number(word2);
} }
else if (fastcmp(word, "REDRING")) else if (fastcmp(word, "REDRING"))
{ {
skincolor_redring = (UINT8)get_number(word2); skincolor_redring = (UINT16)get_number(word2);
} }
else if (fastcmp(word, "BLUERING")) else if (fastcmp(word, "BLUERING"))
{ {
skincolor_bluering = (UINT8)get_number(word2); skincolor_bluering = (UINT16)get_number(word2);
} }
else if (fastcmp(word, "INVULNTICS")) else if (fastcmp(word, "INVULNTICS"))
{ {

View File

@ -241,12 +241,13 @@ extern char logfilename[1024];
#define COLORRAMPSIZE 16 #define COLORRAMPSIZE 16
#define MAXCOLORNAME 32 #define MAXCOLORNAME 32
#define NUMCOLORFREESLOTS 1024
typedef struct skincolor_s typedef struct skincolor_s
{ {
char name[MAXCOLORNAME+1]; // Skincolor name char name[MAXCOLORNAME+1]; // Skincolor name
UINT8 ramp[COLORRAMPSIZE]; // Colormap ramp UINT8 ramp[COLORRAMPSIZE]; // Colormap ramp
UINT8 invcolor; // Signpost color UINT16 invcolor; // Signpost color
UINT8 invshade; // Signpost color shade UINT8 invshade; // Signpost color shade
UINT16 chatcolor; // Chat color UINT16 chatcolor; // Chat color
boolean accessible; // Accessible by the color command + setup menu boolean accessible; // Accessible by the color command + setup menu
@ -388,7 +389,7 @@ typedef enum
SKINCOLOR_SUPERTAN5, SKINCOLOR_SUPERTAN5,
SKINCOLOR_FIRSTFREESLOT, SKINCOLOR_FIRSTFREESLOT,
SKINCOLOR_LASTFREESLOT = 255, SKINCOLOR_LASTFREESLOT = SKINCOLOR_FIRSTFREESLOT + NUMCOLORFREESLOTS - 1,
MAXSKINCOLORS, MAXSKINCOLORS,
@ -397,7 +398,6 @@ typedef enum
UINT16 numskincolors; UINT16 numskincolors;
#define NUMCOLORFREESLOTS (SKINCOLOR_LASTFREESLOT-SKINCOLOR_FIRSTFREESLOT)+1
extern skincolor_t skincolors[MAXSKINCOLORS]; extern skincolor_t skincolors[MAXSKINCOLORS];
// State updates, number of tics / second. // State updates, number of tics / second.

View File

@ -145,7 +145,7 @@ extern INT32 tutorialanalog; // store cv_analog[0] user value
extern boolean looptitle; extern boolean looptitle;
// CTF colors. // CTF colors.
extern UINT8 skincolor_redteam, skincolor_blueteam, skincolor_redring, skincolor_bluering; extern UINT16 skincolor_redteam, skincolor_blueteam, skincolor_redring, skincolor_bluering;
extern tic_t countdowntimer; extern tic_t countdowntimer;
extern boolean countdowntimeup; extern boolean countdowntimeup;

View File

@ -68,7 +68,7 @@ static struct {
UINT8 flags; // EZT flags UINT8 flags; // EZT flags
// EZT_COLOR // EZT_COLOR
UINT8 color, lastcolor; UINT16 color, lastcolor;
// EZT_SCALE // EZT_SCALE
fixed_t scale, lastscale; fixed_t scale, lastscale;
@ -82,7 +82,8 @@ static struct {
// There is no conflict here. // There is no conflict here.
typedef struct demoghost { typedef struct demoghost {
UINT8 checksum[16]; UINT8 checksum[16];
UINT8 *buffer, *p, color, fadein; UINT8 *buffer, *p, fadein;
UINT16 color;
UINT16 version; UINT16 version;
mobj_t oldmo, *mo; mobj_t oldmo, *mo;
struct demoghost *next; struct demoghost *next;
@ -93,7 +94,7 @@ demoghost *ghosts = NULL;
// DEMO RECORDING // DEMO RECORDING
// //
#define DEMOVERSION 0x000c #define DEMOVERSION 0x000d
#define DEMOHEADER "\xF0" "SRB2Replay" "\x0F" #define DEMOHEADER "\xF0" "SRB2Replay" "\x0F"
#define DF_GHOST 0x01 // This demo contains ghost data too! #define DF_GHOST 0x01 // This demo contains ghost data too!
@ -280,13 +281,13 @@ void G_GhostAddColor(ghostcolor_t color)
{ {
if (!demorecording || !(demoflags & DF_GHOST)) if (!demorecording || !(demoflags & DF_GHOST))
return; return;
if (ghostext.lastcolor == (UINT8)color) if (ghostext.lastcolor == (UINT16)color)
{ {
ghostext.flags &= ~EZT_COLOR; ghostext.flags &= ~EZT_COLOR;
return; return;
} }
ghostext.flags |= EZT_COLOR; ghostext.flags |= EZT_COLOR;
ghostext.color = (UINT8)color; ghostext.color = (UINT16)color;
} }
void G_GhostAddScale(fixed_t scale) void G_GhostAddScale(fixed_t scale)
@ -425,7 +426,7 @@ void G_WriteGhostTic(mobj_t *ghost)
WRITEUINT8(demo_p,ghostext.flags); WRITEUINT8(demo_p,ghostext.flags);
if (ghostext.flags & EZT_COLOR) if (ghostext.flags & EZT_COLOR)
{ {
WRITEUINT8(demo_p,ghostext.color); WRITEUINT16(demo_p,ghostext.color);
ghostext.lastcolor = ghostext.color; ghostext.lastcolor = ghostext.color;
} }
if (ghostext.flags & EZT_SCALE) if (ghostext.flags & EZT_SCALE)
@ -501,7 +502,7 @@ void G_WriteGhostTic(mobj_t *ghost)
WRITEUINT8(demo_p,ghost->player->followmobj->sprite2); WRITEUINT8(demo_p,ghost->player->followmobj->sprite2);
WRITEUINT16(demo_p,ghost->player->followmobj->sprite); WRITEUINT16(demo_p,ghost->player->followmobj->sprite);
WRITEUINT8(demo_p,(ghost->player->followmobj->frame & FF_FRAMEMASK)); WRITEUINT8(demo_p,(ghost->player->followmobj->frame & FF_FRAMEMASK));
WRITEUINT8(demo_p,ghost->player->followmobj->color); WRITEUINT16(demo_p,ghost->player->followmobj->color);
*followtic_p = followtic; *followtic_p = followtic;
} }
@ -566,7 +567,7 @@ void G_ConsGhostTic(void)
{ // But wait, there's more! { // But wait, there's more!
UINT8 xziptic = READUINT8(demo_p); UINT8 xziptic = READUINT8(demo_p);
if (xziptic & EZT_COLOR) if (xziptic & EZT_COLOR)
demo_p++; demo_p += (demoversion==0x000c) ? 1 : sizeof(UINT16);
if (xziptic & EZT_SCALE) if (xziptic & EZT_SCALE)
demo_p += sizeof(fixed_t); demo_p += sizeof(fixed_t);
if (xziptic & EZT_HIT) if (xziptic & EZT_HIT)
@ -633,7 +634,7 @@ void G_ConsGhostTic(void)
demo_p++; demo_p++;
demo_p += sizeof(UINT16); demo_p += sizeof(UINT16);
demo_p++; demo_p++;
demo_p++; demo_p += (demoversion==0x000c) ? 1 : sizeof(UINT16);
} }
// Re-synchronise // Re-synchronise
@ -731,7 +732,7 @@ void G_GhostTicker(void)
xziptic = READUINT8(g->p); xziptic = READUINT8(g->p);
if (xziptic & EZT_COLOR) if (xziptic & EZT_COLOR)
{ {
g->color = READUINT8(g->p); g->color = (g->version==0x000c) ? READUINT8(g->p) : READUINT16(g->p);
switch(g->color) switch(g->color)
{ {
default: default:
@ -864,7 +865,7 @@ void G_GhostTicker(void)
g->mo->color += abs( ( (signed)( (unsigned)leveltime >> 1 ) % 9) - 4); g->mo->color += abs( ( (signed)( (unsigned)leveltime >> 1 ) % 9) - 4);
break; break;
case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer) case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer)
g->mo->color = (UINT8)(SKINCOLOR_RUBY + (leveltime % (MAXSKINCOLORS - SKINCOLOR_RUBY))); // Passes through all saturated colours g->mo->color = (UINT16)(SKINCOLOR_RUBY + (leveltime % (FIRSTSUPERCOLOR - SKINCOLOR_RUBY))); // Passes through all saturated colours
break; break;
default: default:
break; break;
@ -918,7 +919,7 @@ void G_GhostTicker(void)
follow->sprite = READUINT16(g->p); follow->sprite = READUINT16(g->p);
follow->frame = (READUINT8(g->p)) | (g->mo->frame & FF_TRANSMASK); follow->frame = (READUINT8(g->p)) | (g->mo->frame & FF_TRANSMASK);
follow->angle = g->mo->angle; follow->angle = g->mo->angle;
follow->color = READUINT8(g->p); follow->color = (g->version==0x000c) ? READUINT8(g->p) : READUINT16(g->p);
if (!(followtic & FZT_SPAWNED)) if (!(followtic & FZT_SPAWNED))
{ {
@ -1158,7 +1159,7 @@ void G_ReadMetalTic(mobj_t *metal)
follow->sprite = READUINT16(metal_p); follow->sprite = READUINT16(metal_p);
follow->frame = READUINT32(metal_p); // NOT & FF_FRAMEMASK here, so 32 bits follow->frame = READUINT32(metal_p); // NOT & FF_FRAMEMASK here, so 32 bits
follow->angle = metal->angle; follow->angle = metal->angle;
follow->color = READUINT8(metal_p); follow->color = (metalversion==0x000c) ? READUINT8(metal_p) : READUINT16(metal_p);
if (!(followtic & FZT_SPAWNED)) if (!(followtic & FZT_SPAWNED))
{ {
@ -1340,7 +1341,7 @@ void G_WriteMetalTic(mobj_t *metal)
WRITEUINT8(demo_p,metal->player->followmobj->sprite2); WRITEUINT8(demo_p,metal->player->followmobj->sprite2);
WRITEUINT16(demo_p,metal->player->followmobj->sprite); WRITEUINT16(demo_p,metal->player->followmobj->sprite);
WRITEUINT32(demo_p,metal->player->followmobj->frame); // NOT & FF_FRAMEMASK here, so 32 bits WRITEUINT32(demo_p,metal->player->followmobj->frame); // NOT & FF_FRAMEMASK here, so 32 bits
WRITEUINT8(demo_p,metal->player->followmobj->color); WRITEUINT16(demo_p,metal->player->followmobj->color);
*followtic_p = followtic; *followtic_p = followtic;
} }
@ -1394,7 +1395,7 @@ void G_RecordMetal(void)
void G_BeginRecording(void) void G_BeginRecording(void)
{ {
UINT8 i; UINT8 i;
char name[16]; char name[MAXCOLORNAME+1];
player_t *player = &players[consoleplayer]; player_t *player = &players[consoleplayer];
if (demo_p) if (demo_p)
@ -1457,12 +1458,12 @@ void G_BeginRecording(void)
demo_p += 16; demo_p += 16;
// Color // Color
for (i = 0; i < 16 && cv_playercolor.string[i]; i++) for (i = 0; i < MAXCOLORNAME && cv_playercolor.string[i]; i++)
name[i] = cv_playercolor.string[i]; name[i] = cv_playercolor.string[i];
for (; i < 16; i++) for (; i < MAXCOLORNAME; i++)
name[i] = '\0'; name[i] = '\0';
M_Memcpy(demo_p,name,16); M_Memcpy(demo_p,name,MAXCOLORNAME);
demo_p += 16; demo_p += MAXCOLORNAME;
// Stats // Stats
WRITEUINT8(demo_p,player->charability); WRITEUINT8(demo_p,player->charability);
@ -1622,7 +1623,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
c = READUINT8(p); // SUBVERSION c = READUINT8(p); // SUBVERSION
I_Assert(c == SUBVERSION); I_Assert(c == SUBVERSION);
s = READUINT16(p); s = READUINT16(p);
I_Assert(s == DEMOVERSION); I_Assert(s >= 0x000c);
p += 16; // demo checksum p += 16; // demo checksum
I_Assert(!memcmp(p, "PLAY", 4)); I_Assert(!memcmp(p, "PLAY", 4));
p += 4; // PLAY p += 4; // PLAY
@ -1671,6 +1672,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
switch(oldversion) // demoversion switch(oldversion) // demoversion
{ {
case DEMOVERSION: // latest always supported case DEMOVERSION: // latest always supported
case 0x000c: // all that changed between then and now was longer color name
break; break;
// too old, cannot support. // too old, cannot support.
default: default:
@ -1744,15 +1746,15 @@ void G_DoPlayDemo(char *defdemoname)
{ {
UINT8 i; UINT8 i;
lumpnum_t l; lumpnum_t l;
char skin[17],color[17],*n,*pdemoname; char skin[17],color[MAXCOLORNAME+1],*n,*pdemoname;
UINT8 version,subversion,charability,charability2,thrustfactor,accelstart,acceleration; UINT8 version,subversion,charability,charability2,thrustfactor,accelstart,acceleration,cnamelen;
pflags_t pflags; pflags_t pflags;
UINT32 randseed, followitem; UINT32 randseed, followitem;
fixed_t camerascale,shieldscale,actionspd,mindash,maxdash,normalspeed,runspeed,jumpfactor,height,spinheight; fixed_t camerascale,shieldscale,actionspd,mindash,maxdash,normalspeed,runspeed,jumpfactor,height,spinheight;
char msg[1024]; char msg[1024];
skin[16] = '\0'; skin[16] = '\0';
color[16] = '\0'; color[MAXCOLORNAME] = '\0';
n = defdemoname+strlen(defdemoname); n = defdemoname+strlen(defdemoname);
while (*n != '/' && *n != '\\' && n != defdemoname) while (*n != '/' && *n != '\\' && n != defdemoname)
@ -1810,6 +1812,11 @@ void G_DoPlayDemo(char *defdemoname)
switch(demoversion) switch(demoversion)
{ {
case DEMOVERSION: // latest always supported case DEMOVERSION: // latest always supported
cnamelen = MAXCOLORNAME;
break;
// all that changed between then and now was longer color name
case 0x000c:
cnamelen = 16;
break; break;
// too old, cannot support. // too old, cannot support.
default: default:
@ -1876,8 +1883,8 @@ void G_DoPlayDemo(char *defdemoname)
demo_p += 16; demo_p += 16;
// Color // Color
M_Memcpy(color,demo_p,16); M_Memcpy(color,demo_p,cnamelen);
demo_p += 16; demo_p += cnamelen;
charability = READUINT8(demo_p); charability = READUINT8(demo_p);
charability2 = READUINT8(demo_p); charability2 = READUINT8(demo_p);
@ -1941,7 +1948,9 @@ void G_DoPlayDemo(char *defdemoname)
// Set skin // Set skin
SetPlayerSkin(0, skin); SetPlayerSkin(0, skin);
#ifdef HAVE_BLUA
LUAh_MapChange(gamemap); LUAh_MapChange(gamemap);
#endif
displayplayer = consoleplayer = 0; displayplayer = consoleplayer = 0;
memset(playeringame,0,sizeof(playeringame)); memset(playeringame,0,sizeof(playeringame));
playeringame[0] = true; playeringame[0] = true;
@ -1949,8 +1958,9 @@ void G_DoPlayDemo(char *defdemoname)
G_InitNew(false, G_BuildMapName(gamemap), true, true, false); G_InitNew(false, G_BuildMapName(gamemap), true, true, false);
// Set color // Set color
for (i = 0; i < MAXSKINCOLORS; i++) players[0].skincolor = skins[players[0].skin].prefcolor;
if (!stricmp(Color_Names[i],color)) for (i = 0; i < numskincolors; i++)
if (!stricmp(skincolors[i].name,color))
{ {
players[0].skincolor = i; players[0].skincolor = i;
break; break;
@ -1992,7 +2002,8 @@ void G_AddGhost(char *defdemoname)
{ {
INT32 i; INT32 i;
lumpnum_t l; lumpnum_t l;
char name[17],skin[17],color[17],*n,*pdemoname,md5[16]; char name[17],skin[17],color[MAXCOLORNAME+1],*n,*pdemoname,md5[16];
UINT8 cnamelen;
demoghost *gh; demoghost *gh;
UINT8 flags; UINT8 flags;
UINT8 *buffer,*p; UINT8 *buffer,*p;
@ -2047,6 +2058,11 @@ void G_AddGhost(char *defdemoname)
switch(ghostversion) switch(ghostversion)
{ {
case DEMOVERSION: // latest always supported case DEMOVERSION: // latest always supported
cnamelen = MAXCOLORNAME;
break;
// all that changed between then and now was longer color name
case 0x000c:
cnamelen = 16;
break; break;
// too old, cannot support. // too old, cannot support.
default: default:
@ -2109,8 +2125,8 @@ void G_AddGhost(char *defdemoname)
p += 16; p += 16;
// Color // Color
M_Memcpy(color, p,16); M_Memcpy(color, p,cnamelen);
p += 16; p += cnamelen;
// Ghosts do not have a player structure to put this in. // Ghosts do not have a player structure to put this in.
p++; // charability p++; // charability
@ -2198,10 +2214,10 @@ void G_AddGhost(char *defdemoname)
// Set color // Set color
gh->mo->color = ((skin_t*)gh->mo->skin)->prefcolor; gh->mo->color = ((skin_t*)gh->mo->skin)->prefcolor;
for (i = 0; i < MAXSKINCOLORS; i++) for (i = 0; i < numskincolors; i++)
if (!stricmp(Color_Names[i],color)) if (!stricmp(skincolors[i].name,color))
{ {
gh->mo->color = (UINT8)i; gh->mo->color = (UINT16)i;
break; break;
} }
gh->oldmo.color = gh->mo->color; gh->oldmo.color = gh->mo->color;
@ -2292,6 +2308,7 @@ void G_DoPlayMetal(void)
switch(metalversion) switch(metalversion)
{ {
case DEMOVERSION: // latest always supported case DEMOVERSION: // latest always supported
case 0x000c: // all that changed between then and now was longer color name
break; break;
// too old, cannot support. // too old, cannot support.
default: default:

View File

@ -54,7 +54,7 @@ UINT8 ultimatemode = false;
boolean botingame; boolean botingame;
UINT8 botskin; UINT8 botskin;
UINT8 botcolor; UINT16 botcolor;
JoyType_t Joystick; JoyType_t Joystick;
JoyType_t Joystick2; JoyType_t Joystick2;
@ -135,10 +135,10 @@ INT32 tutorialanalog = 0; // store cv_analog[0] user value
boolean looptitle = false; boolean looptitle = false;
UINT8 skincolor_redteam = SKINCOLOR_RED; UINT16 skincolor_redteam = SKINCOLOR_RED;
UINT8 skincolor_blueteam = SKINCOLOR_BLUE; UINT16 skincolor_blueteam = SKINCOLOR_BLUE;
UINT8 skincolor_redring = SKINCOLOR_SALMON; UINT16 skincolor_redring = SKINCOLOR_SALMON;
UINT8 skincolor_bluering = SKINCOLOR_CORNFLOWER; UINT16 skincolor_bluering = SKINCOLOR_CORNFLOWER;
tic_t countdowntimer = 0; tic_t countdowntimer = 0;
boolean countdowntimeup = false; boolean countdowntimeup = false;
@ -2381,7 +2381,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
INT16 totalring; INT16 totalring;
UINT8 laps; UINT8 laps;
UINT8 mare; UINT8 mare;
UINT8 skincolor; UINT16 skincolor;
INT32 skin; INT32 skin;
UINT32 availabilities; UINT32 availabilities;
tic_t jointime; tic_t jointime;
@ -4475,7 +4475,7 @@ cleanup:
// //
void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, boolean SSSG, boolean FLS) void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, boolean SSSG, boolean FLS)
{ {
UINT8 color = skins[pickedchar].prefcolor; UINT16 color = skins[pickedchar].prefcolor;
paused = false; paused = false;
if (demoplayback) if (demoplayback)

View File

@ -57,6 +57,7 @@ extern UINT8 ultimatemode; // was sk_insane
extern gameaction_t gameaction; extern gameaction_t gameaction;
extern boolean botingame; extern boolean botingame;
extern UINT8 botskin, botcolor; extern UINT8 botskin;
extern UINT16 botcolor;
#endif //__G_STATE__ #endif //__G_STATE__

View File

@ -682,7 +682,7 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
UINT16 w = gpatch->width, h = gpatch->height; UINT16 w = gpatch->width, h = gpatch->height;
UINT32 size = w*h; UINT32 size = w*h;
RGBA_t *image, *blendimage, *cur, blendcolor; RGBA_t *image, *blendimage, *cur, blendcolor;
UINT8 translation[16]; // First the color index UINT16 translation[16]; // First the color index
UINT8 cutoff[16]; // Brightness cutoff before using the next color UINT8 cutoff[16]; // Brightness cutoff before using the next color
UINT8 translen = 0; UINT8 translen = 0;
UINT8 i; UINT8 i;
@ -741,7 +741,7 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
numdupes = 1; numdupes = 1;
translen++; translen++;
translation[translen] = (UINT8)skincolors[color].ramp[i]; translation[translen] = (UINT16)skincolors[color].ramp[i];
} }
translen++; translen++;

View File

@ -2424,6 +2424,17 @@ static int lib_rGetColorByName(lua_State *L)
return 1; return 1;
} }
// Lua exclusive function, returns the name of a color from the SKINCOLOR_ constant.
// SKINCOLOR_GREEN > "Green" for example
static int lib_rGetNameByColor(lua_State *L)
{
UINT16 colornum = (UINT16)luaL_checkinteger(L, 1);
if (!colornum || colornum >= numskincolors)
return luaL_error(L, "skincolor %d out of range (1 - %d).", colornum, numskincolors-1);
lua_pushstring(L, skincolors[colornum].name);
return 1;
}
// S_SOUND // S_SOUND
//////////// ////////////
static int lib_sStartSound(lua_State *L) static int lib_sStartSound(lua_State *L)
@ -3337,6 +3348,7 @@ static luaL_Reg lib[] = {
// r_draw // r_draw
{"R_GetColorByName", lib_rGetColorByName}, {"R_GetColorByName", lib_rGetColorByName},
{"R_GetNameByColor", lib_rGetNameByColor},
// s_sound // s_sound
{"S_StartSound",lib_sStartSound}, {"S_StartSound",lib_sStartSound},

View File

@ -878,8 +878,8 @@ static int libd_drawNameTag(lua_State *L)
INT32 y; INT32 y;
const char *str; const char *str;
INT32 flags; INT32 flags;
UINT8 basecolor; UINT16 basecolor;
UINT8 outlinecolor; UINT16 outlinecolor;
UINT8 *basecolormap = NULL; UINT8 *basecolormap = NULL;
UINT8 *outlinecolormap = NULL; UINT8 *outlinecolormap = NULL;
@ -908,8 +908,8 @@ static int libd_drawScaledNameTag(lua_State *L)
const char *str; const char *str;
INT32 flags; INT32 flags;
fixed_t scale; fixed_t scale;
UINT8 basecolor; UINT16 basecolor;
UINT8 outlinecolor; UINT16 outlinecolor;
UINT8 *basecolormap = NULL; UINT8 *basecolormap = NULL;
UINT8 *outlinecolormap = NULL; UINT8 *outlinecolormap = NULL;

View File

@ -1508,10 +1508,10 @@ static int lib_setSkinColor(lua_State *L)
{ {
UINT32 j; UINT32 j;
skincolor_t *info; skincolor_t *info;
UINT8 cnum; //skincolor num UINT16 cnum; //skincolor num
lua_remove(L, 1); // don't care about skincolors[] userdata. lua_remove(L, 1); // don't care about skincolors[] userdata.
{ {
cnum = (UINT8)luaL_checkinteger(L, 1); cnum = (UINT16)luaL_checkinteger(L, 1);
if (cnum < SKINCOLOR_FIRSTFREESLOT || cnum >= numskincolors) if (cnum < SKINCOLOR_FIRSTFREESLOT || cnum >= numskincolors)
return luaL_error(L, "skincolors[] index %d out of range (%d - %d)", cnum, SKINCOLOR_FIRSTFREESLOT, numskincolors-1); return luaL_error(L, "skincolors[] index %d out of range (%d - %d)", cnum, SKINCOLOR_FIRSTFREESLOT, numskincolors-1);
info = &skincolors[cnum]; // get the skincolor to assign to. info = &skincolors[cnum]; // get the skincolor to assign to.
@ -1551,9 +1551,9 @@ static int lib_setSkinColor(lua_State *L)
info->ramp[j] = (*((UINT8 **)luaL_checkudata(L, 3, META_COLORRAMP)))[j]; info->ramp[j] = (*((UINT8 **)luaL_checkudata(L, 3, META_COLORRAMP)))[j];
R_FlushTranslationColormapCache(); R_FlushTranslationColormapCache();
} else if (i == 3 || (str && fastcmp(str,"invcolor"))) } else if (i == 3 || (str && fastcmp(str,"invcolor")))
info->invcolor = (UINT8)luaL_checkinteger(L, 3); info->invcolor = (UINT16)luaL_checkinteger(L, 3);
else if (i == 4 || (str && fastcmp(str,"invshade"))) else if (i == 4 || (str && fastcmp(str,"invshade")))
info->invshade = (UINT8)luaL_checkinteger(L, 3); info->invshade = (UINT8)luaL_checkinteger(L, 3)%COLORRAMPSIZE;
else if (i == 5 || (str && fastcmp(str,"chatcolor"))) else if (i == 5 || (str && fastcmp(str,"chatcolor")))
info->chatcolor = (UINT16)luaL_checkinteger(L, 3); info->chatcolor = (UINT16)luaL_checkinteger(L, 3);
else if (i == 6 || (str && fastcmp(str,"accessible"))) { else if (i == 6 || (str && fastcmp(str,"accessible"))) {
@ -1631,9 +1631,9 @@ static int skincolor_set(lua_State *L)
info->ramp[i] = (*((UINT8 **)luaL_checkudata(L, 3, META_COLORRAMP)))[i]; info->ramp[i] = (*((UINT8 **)luaL_checkudata(L, 3, META_COLORRAMP)))[i];
R_FlushTranslationColormapCache(); R_FlushTranslationColormapCache();
} else if (fastcmp(field,"invcolor")) } else if (fastcmp(field,"invcolor"))
info->invcolor = (UINT8)luaL_checkinteger(L, 3); info->invcolor = (UINT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"invshade")) else if (fastcmp(field,"invshade"))
info->invshade = (UINT8)luaL_checkinteger(L, 3); info->invshade = (UINT8)luaL_checkinteger(L, 3)%COLORRAMPSIZE;
else if (fastcmp(field,"chatcolor")) else if (fastcmp(field,"chatcolor"))
info->chatcolor = (UINT16)luaL_checkinteger(L, 3); info->chatcolor = (UINT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"accessible")) else if (fastcmp(field,"accessible"))

View File

@ -175,7 +175,7 @@ static int lib_all7emeralds(lua_State *L)
// Returns both color and signpost shade numbers! // Returns both color and signpost shade numbers!
static int lib_coloropposite(lua_State *L) static int lib_coloropposite(lua_State *L)
{ {
UINT8 colornum = (UINT8)luaL_checkinteger(L, 1); UINT16 colornum = (UINT16)luaL_checkinteger(L, 1);
if (!colornum || colornum >= numskincolors) if (!colornum || colornum >= numskincolors)
return luaL_error(L, "skincolor %d out of range (1 - %d).", colornum, numskincolors-1); return luaL_error(L, "skincolor %d out of range (1 - %d).", colornum, numskincolors-1);
lua_pushinteger(L, skincolors[colornum].invcolor); // push color lua_pushinteger(L, skincolors[colornum].invcolor); // push color

View File

@ -574,7 +574,7 @@ static int mobj_set(lua_State *L)
} }
case mobj_color: case mobj_color:
{ {
UINT8 newcolor = (UINT8)luaL_checkinteger(L,3); UINT16 newcolor = (UINT16)luaL_checkinteger(L,3);
if (newcolor >= numskincolors) if (newcolor >= numskincolors)
return luaL_error(L, "mobj.color %d out of range (0 - %d).", newcolor, numskincolors-1); return luaL_error(L, "mobj.color %d out of range (0 - %d).", newcolor, numskincolors-1);
mo->color = newcolor; mo->color = newcolor;

View File

@ -461,7 +461,7 @@ static int player_set(lua_State *L)
plr->flashpal = (UINT16)luaL_checkinteger(L, 3); plr->flashpal = (UINT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"skincolor")) else if (fastcmp(field,"skincolor"))
{ {
UINT8 newcolor = (UINT8)luaL_checkinteger(L,3); UINT16 newcolor = (UINT16)luaL_checkinteger(L,3);
if (newcolor >= numskincolors) if (newcolor >= numskincolors)
return luaL_error(L, "player.skincolor %d out of range (0 - %d).", newcolor, numskincolors-1); return luaL_error(L, "player.skincolor %d out of range (0 - %d).", newcolor, numskincolors-1);
plr->skincolor = newcolor; plr->skincolor = newcolor;

View File

@ -978,7 +978,7 @@ static mobjflag2_t op_oldflags2 = 0;
static UINT32 op_oldeflags = 0; static UINT32 op_oldeflags = 0;
static fixed_t op_oldmomx = 0, op_oldmomy = 0, op_oldmomz = 0, op_oldheight = 0; static fixed_t op_oldmomx = 0, op_oldmomy = 0, op_oldmomz = 0, op_oldheight = 0;
static statenum_t op_oldstate = 0; static statenum_t op_oldstate = 0;
static UINT8 op_oldcolor = 0; static UINT16 op_oldcolor = 0;
// //
// Static calculation / common output help // Static calculation / common output help

View File

@ -90,7 +90,7 @@ typedef struct
INT16 tag; ///< Tag of emblem mapthing INT16 tag; ///< Tag of emblem mapthing
INT16 level; ///< Level on which this emblem can be found. INT16 level; ///< Level on which this emblem can be found.
UINT8 sprite; ///< emblem sprite to use, 0 - 25 UINT8 sprite; ///< emblem sprite to use, 0 - 25
UINT8 color; ///< skincolor to use UINT16 color; ///< skincolor to use
INT32 var; ///< If needed, specifies information on the target amount to achieve (or target skin) INT32 var; ///< If needed, specifies information on the target amount to achieve (or target skin)
char hint[110]; ///< Hint for emblem hints menu char hint[110]; ///< Hint for emblem hints menu
UINT8 collected; ///< Do you have this emblem? UINT8 collected; ///< Do you have this emblem?
@ -102,7 +102,7 @@ typedef struct
UINT8 conditionset; ///< Condition set that awards this emblem. UINT8 conditionset; ///< Condition set that awards this emblem.
UINT8 showconditionset; ///< Condition set that shows this emblem. UINT8 showconditionset; ///< Condition set that shows this emblem.
UINT8 sprite; ///< emblem sprite to use, 0 - 25 UINT8 sprite; ///< emblem sprite to use, 0 - 25
UINT8 color; ///< skincolor to use UINT16 color; ///< skincolor to use
UINT8 collected; ///< Do you have this emblem? UINT8 collected; ///< Do you have this emblem?
} extraemblem_t; } extraemblem_t;

View File

@ -9055,7 +9055,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
skin_t *charskin = &skins[0]; skin_t *charskin = &skins[0];
INT32 skinnum = 0; INT32 skinnum = 0;
UINT8 col; UINT16 col;
UINT8 *colormap = NULL; UINT8 *colormap = NULL;
INT32 prev = -1, next = -1; INT32 prev = -1, next = -1;
@ -9145,8 +9145,8 @@ static void M_DrawSetupChoosePlayerMenu(void)
INT32 ox, oxsh = FixedInt(FixedMul(BASEVIDWIDTH*FRACUNIT, FixedDiv(char_scroll, 128*FRACUNIT))), txsh; INT32 ox, oxsh = FixedInt(FixedMul(BASEVIDWIDTH*FRACUNIT, FixedDiv(char_scroll, 128*FRACUNIT))), txsh;
patch_t *curpatch = NULL, *prevpatch = NULL, *nextpatch = NULL; patch_t *curpatch = NULL, *prevpatch = NULL, *nextpatch = NULL;
const char *curtext = NULL, *prevtext = NULL, *nexttext = NULL; const char *curtext = NULL, *prevtext = NULL, *nexttext = NULL;
UINT8 curtextcolor = 0, prevtextcolor = 0, nexttextcolor = 0; UINT16 curtextcolor = 0, prevtextcolor = 0, nexttextcolor = 0;
UINT8 curoutlinecolor = 0, prevoutlinecolor = 0, nextoutlinecolor = 0; UINT16 curoutlinecolor = 0, prevoutlinecolor = 0, nextoutlinecolor = 0;
// Name tag // Name tag
curtext = description[char_on].displayname; curtext = description[char_on].displayname;
@ -11355,7 +11355,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
} }
else if (itemOn == 2) else if (itemOn == 2)
{ {
UINT8 col = skins[setupm_fakeskin].prefcolor; UINT16 col = skins[setupm_fakeskin].prefcolor;
if ((setupm_fakecolor->color != col) && skincolors[col].accessible) if ((setupm_fakecolor->color != col) && skincolors[col].accessible)
{ {
S_StartSound(NULL,sfx_menu1); // Tails S_StartSound(NULL,sfx_menu1); // Tails
@ -11514,7 +11514,7 @@ static boolean M_QuitMultiPlayerMenu(void)
return true; return true;
} }
void M_AddMenuColor(UINT8 color) { void M_AddMenuColor(UINT16 color) {
menucolor_t *c; menucolor_t *c;
if (color >= numskincolors) { if (color >= numskincolors) {
@ -11538,7 +11538,7 @@ void M_AddMenuColor(UINT8 color) {
} }
} }
void M_MoveColorBefore(UINT8 color, UINT8 targ) { void M_MoveColorBefore(UINT16 color, UINT16 targ) {
menucolor_t *look, *c = NULL, *t = NULL; menucolor_t *look, *c = NULL, *t = NULL;
if (color == targ) if (color == targ)
@ -11580,7 +11580,7 @@ void M_MoveColorBefore(UINT8 color, UINT8 targ) {
t->prev = c; t->prev = c;
} }
void M_MoveColorAfter(UINT8 color, UINT8 targ) { void M_MoveColorAfter(UINT16 color, UINT16 targ) {
menucolor_t *look, *c = NULL, *t = NULL; menucolor_t *look, *c = NULL, *t = NULL;
if (color == targ) if (color == targ)
@ -11622,7 +11622,7 @@ void M_MoveColorAfter(UINT8 color, UINT8 targ) {
t->next = c; t->next = c;
} }
UINT8 M_GetColorBefore(UINT8 color) { UINT16 M_GetColorBefore(UINT16 color) {
menucolor_t *look; menucolor_t *look;
if (color >= numskincolors) { if (color >= numskincolors) {
@ -11638,7 +11638,7 @@ UINT8 M_GetColorBefore(UINT8 color) {
} }
} }
UINT8 M_GetColorAfter(UINT8 color) { UINT16 M_GetColorAfter(UINT16 color) {
menucolor_t *look; menucolor_t *look;
if (color >= numskincolors) { if (color >= numskincolors) {

View File

@ -355,11 +355,11 @@ typedef struct
// new character select // new character select
char displayname[SKINNAMESIZE+1]; char displayname[SKINNAMESIZE+1];
SINT8 skinnum[2]; SINT8 skinnum[2];
UINT8 oppositecolor; UINT16 oppositecolor;
char nametag[8]; char nametag[8];
patch_t *namepic; patch_t *namepic;
UINT8 tagtextcolor; UINT16 tagtextcolor;
UINT8 tagoutlinecolor; UINT16 tagoutlinecolor;
} description_t; } description_t;
// level select platter // level select platter
@ -447,16 +447,16 @@ void Moviemode_option_Onchange(void);
typedef struct menucolor_s { typedef struct menucolor_s {
struct menucolor_s *next; struct menucolor_s *next;
struct menucolor_s *prev; struct menucolor_s *prev;
UINT8 color; UINT16 color;
} menucolor_t; } menucolor_t;
menucolor_t *menucolorhead, *menucolortail; menucolor_t *menucolorhead, *menucolortail;
void M_AddMenuColor(UINT8 color); void M_AddMenuColor(UINT16 color);
void M_MoveColorBefore(UINT8 color, UINT8 targ); void M_MoveColorBefore(UINT16 color, UINT16 targ);
void M_MoveColorAfter(UINT8 color, UINT8 targ); void M_MoveColorAfter(UINT16 color, UINT16 targ);
UINT8 M_GetColorBefore(UINT8 color); UINT16 M_GetColorBefore(UINT16 color);
UINT8 M_GetColorAfter(UINT8 color); UINT16 M_GetColorAfter(UINT16 color);
void M_InitPlayerSetupColors(void); void M_InitPlayerSetupColors(void);
void M_FreePlayerSetupColors(void); void M_FreePlayerSetupColors(void);

View File

@ -5106,7 +5106,7 @@ void A_SignPlayer(mobj_t *actor)
INT32 locvar2 = var2; INT32 locvar2 = var2;
skin_t *skin = NULL; skin_t *skin = NULL;
mobj_t *ov; mobj_t *ov;
UINT8 facecolor, signcolor = (UINT8)locvar2; UINT16 facecolor, signcolor = (UINT16)locvar2;
UINT32 signframe = states[actor->info->raisestate].frame; UINT32 signframe = states[actor->info->raisestate].frame;
if (LUA_CallAction("A_SignPlayer", actor)) if (LUA_CallAction("A_SignPlayer", actor))
@ -5212,19 +5212,8 @@ void A_SignPlayer(mobj_t *actor)
} }
actor->tracer->color = signcolor; actor->tracer->color = signcolor;
/*
If you're here from the comment above Color_Opposite,
the following line is the one which is dependent on the
array being symmetrical. It gets the opposite of the
opposite of your desired colour just so it can get the
brightness frame for the End Sign. It's not a great
design choice, but it's constant time array access and
the idea that the colours should be OPPOSITES is kind
of in the name. If you have a better idea, feel free
to let me know. ~toast 2016/07/20
*/
if (signcolor && signcolor < numskincolors) if (signcolor && signcolor < numskincolors)
signframe += (15 - skincolors[skincolors[signcolor].invcolor].invshade); signframe += (15 - skincolors[signcolor].invshade);
actor->tracer->frame = signframe; actor->tracer->frame = signframe;
} }
@ -8804,10 +8793,10 @@ void A_ChangeColorRelative(mobj_t *actor)
{ {
// Have you ever seen anything so hideous? // Have you ever seen anything so hideous?
if (actor->target) if (actor->target)
actor->color = (UINT8)(actor->color + actor->target->color); actor->color = (UINT16)(actor->color + actor->target->color);
} }
else else
actor->color = (UINT8)(actor->color + locvar2); actor->color = (UINT16)(actor->color + locvar2);
} }
// Function: A_ChangeColorAbsolute // Function: A_ChangeColorAbsolute
@ -8831,7 +8820,7 @@ void A_ChangeColorAbsolute(mobj_t *actor)
actor->color = actor->target->color; actor->color = actor->target->color;
} }
else else
actor->color = (UINT8)locvar2; actor->color = (UINT16)locvar2;
} }
// Function: A_Dye // Function: A_Dye
@ -8850,7 +8839,7 @@ void A_Dye(mobj_t *actor)
UINT8 color = (UINT8)locvar2; UINT8 color = (UINT8)locvar2;
if (LUA_CallAction("A_Dye", actor)) if (LUA_CallAction("A_Dye", actor))
return; return;
if (color >= MAXTRANSLATIONS) if (color >= numskincolors)
return; return;
if (!color) if (!color)

View File

@ -9429,7 +9429,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
case MT_BOSSFLYPOINT: case MT_BOSSFLYPOINT:
return false; return false;
case MT_NIGHTSCORE: case MT_NIGHTSCORE:
mobj->color = (UINT8)(leveltime % SKINCOLOR_WHITE); mobj->color = (UINT16)(leveltime % SKINCOLOR_WHITE);
break; break;
case MT_JETFUME1: case MT_JETFUME1:
if (!P_JetFume1Think(mobj)) if (!P_JetFume1Think(mobj))
@ -11939,7 +11939,7 @@ static boolean P_SetupEmblem(mapthing_t *mthing, mobj_t *mobj)
mobj->health = j + 1; mobj->health = j + 1;
emcolor = M_GetEmblemColor(&emblemlocations[j]); // workaround for compiler complaint about bad function casting emcolor = M_GetEmblemColor(&emblemlocations[j]); // workaround for compiler complaint about bad function casting
mobj->color = (UINT8)emcolor; mobj->color = (UINT16)emcolor;
if (emblemlocations[j].collected if (emblemlocations[j].collected
|| (emblemlocations[j].type == ET_SKIN && emblemlocations[j].var != players[0].skin)) || (emblemlocations[j].type == ET_SKIN && emblemlocations[j].var != players[0].skin))

View File

@ -312,7 +312,7 @@ typedef struct mobj_s
void *skin; // overrides 'sprite' when non-NULL (for player bodies to 'remember' the skin) void *skin; // overrides 'sprite' when non-NULL (for player bodies to 'remember' the skin)
// Player and mobj sprites in multiplayer modes are modified // Player and mobj sprites in multiplayer modes are modified
// using an internal color lookup table for re-indexing. // using an internal color lookup table for re-indexing.
UINT8 color; // This replaces MF_TRANSLATION. Use 0 for default (no translation). UINT16 color; // This replaces MF_TRANSLATION. Use 0 for default (no translation).
// Interaction info, by BLOCKMAP. // Interaction info, by BLOCKMAP.
// Links in blocks (if needed). // Links in blocks (if needed).

View File

@ -1593,7 +1593,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
if (diff2 & MD2_SKIN) if (diff2 & MD2_SKIN)
WRITEUINT8(save_p, (UINT8)((skin_t *)mobj->skin - skins)); WRITEUINT8(save_p, (UINT8)((skin_t *)mobj->skin - skins));
if (diff2 & MD2_COLOR) if (diff2 & MD2_COLOR)
WRITEUINT8(save_p, mobj->color); WRITEUINT16(save_p, mobj->color);
if (diff2 & MD2_EXTVAL1) if (diff2 & MD2_EXTVAL1)
WRITEINT32(save_p, mobj->extravalue1); WRITEINT32(save_p, mobj->extravalue1);
if (diff2 & MD2_EXTVAL2) if (diff2 & MD2_EXTVAL2)
@ -2600,7 +2600,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
if (diff2 & MD2_SKIN) if (diff2 & MD2_SKIN)
mobj->skin = &skins[READUINT8(save_p)]; mobj->skin = &skins[READUINT8(save_p)];
if (diff2 & MD2_COLOR) if (diff2 & MD2_COLOR)
mobj->color = READUINT8(save_p); mobj->color = READUINT16(save_p);
if (diff2 & MD2_EXTVAL1) if (diff2 & MD2_EXTVAL1)
mobj->extravalue1 = READINT32(save_p); mobj->extravalue1 = READINT32(save_p);
if (diff2 & MD2_EXTVAL2) if (diff2 & MD2_EXTVAL2)

View File

@ -3971,7 +3971,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (mo) if (mo)
{ {
if (color < 0 || color >= MAXTRANSLATIONS) if (color < 0 || color >= numskincolors)
return; return;
var1 = 0; var1 = 0;

View File

@ -1916,7 +1916,7 @@ void P_SpawnShieldOrb(player_t *player)
shieldobj->colorized = true; shieldobj->colorized = true;
} }
else else
shieldobj->color = (UINT8)shieldobj->info->painchance; shieldobj->color = (UINT16)shieldobj->info->painchance;
shieldobj->threshold = (player->powers[pw_shield] & SH_FORCE) ? SH_FORCE : (player->powers[pw_shield] & SH_NOSTACK); shieldobj->threshold = (player->powers[pw_shield] & SH_FORCE) ? SH_FORCE : (player->powers[pw_shield] & SH_NOSTACK);
if (shieldobj->info->seestate) if (shieldobj->info->seestate)
@ -2986,7 +2986,7 @@ static void P_CheckInvincibilityTimer(player_t *player)
return; return;
if (mariomode && !player->powers[pw_super]) if (mariomode && !player->powers[pw_super])
player->mo->color = (UINT8)(SKINCOLOR_RUBY + (leveltime % (numskincolors - SKINCOLOR_RUBY))); // Passes through all saturated colours player->mo->color = (UINT16)(SKINCOLOR_RUBY + (leveltime % (numskincolors - SKINCOLOR_RUBY))); // Passes through all saturated colours
else if (leveltime % (TICRATE/7) == 0) else if (leveltime % (TICRATE/7) == 0)
{ {
mobj_t *sparkle = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_IVSP); mobj_t *sparkle = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_IVSP);

View File

@ -184,7 +184,7 @@ void R_InitTranslationTables(void)
\param dest_colormap colormap to populate \param dest_colormap colormap to populate
\param skincolor translation color \param skincolor translation color
*/ */
static void R_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor) static void R_RainbowColormap(UINT8 *dest_colormap, UINT16 skincolor)
{ {
INT32 i; INT32 i;
RGBA_t color; RGBA_t color;
@ -226,7 +226,7 @@ static void R_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor)
#undef SETBRIGHTNESS #undef SETBRIGHTNESS
static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color) static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, UINT16 color)
{ {
INT32 i, starttranscolor, skinramplength; INT32 i, starttranscolor, skinramplength;
@ -419,9 +419,9 @@ void R_FlushTranslationColormapCache(void)
memset(translationtablecache[i], 0, MAXSKINCOLORS * sizeof(UINT8**)); memset(translationtablecache[i], 0, MAXSKINCOLORS * sizeof(UINT8**));
} }
UINT8 R_GetColorByName(const char *name) UINT16 R_GetColorByName(const char *name)
{ {
UINT16 color = (UINT8)atoi(name); UINT16 color = (UINT16)atoi(name);
if (color > 0 && color < numskincolors) if (color > 0 && color < numskincolors)
return color; return color;
for (color = 1; color < numskincolors; color++) for (color = 1; color < numskincolors; color++)
@ -430,7 +430,7 @@ UINT8 R_GetColorByName(const char *name)
return SKINCOLOR_GREEN; return SKINCOLOR_GREEN;
} }
UINT8 R_GetSuperColorByName(const char *name) UINT16 R_GetSuperColorByName(const char *name)
{ {
UINT16 i, color = SKINCOLOR_SUPERGOLD1; UINT16 i, color = SKINCOLOR_SUPERGOLD1;
char *realname = Z_Malloc(MAXCOLORNAME+1, PU_STATIC, NULL); char *realname = Z_Malloc(MAXCOLORNAME+1, PU_STATIC, NULL);

View File

@ -114,8 +114,8 @@ extern lumpnum_t viewborderlump[8];
void R_InitTranslationTables(void); void R_InitTranslationTables(void);
UINT8* R_GetTranslationColormap(INT32 skinnum, skincolornum_t color, UINT8 flags); UINT8* R_GetTranslationColormap(INT32 skinnum, skincolornum_t color, UINT8 flags);
void R_FlushTranslationColormapCache(void); void R_FlushTranslationColormapCache(void);
UINT8 R_GetColorByName(const char *name); UINT16 R_GetColorByName(const char *name);
UINT8 R_GetSuperColorByName(const char *name); UINT16 R_GetSuperColorByName(const char *name);
// Custom player skin translation // Custom player skin translation
void R_InitViewBuffer(INT32 width, INT32 height); void R_InitViewBuffer(INT32 width, INT32 height);

View File

@ -248,7 +248,7 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
{ {
player_t *player = &players[playernum]; player_t *player = &players[playernum];
skin_t *skin = &skins[skinnum]; skin_t *skin = &skins[skinnum];
UINT8 newcolor = 0; UINT16 newcolor = 0;
if (skinnum >= 0 && skinnum < numskins && R_SkinUsable(playernum, skinnum)) // Make sure it exists! if (skinnum >= 0 && skinnum < numskins && R_SkinUsable(playernum, skinnum)) // Make sure it exists!
{ {

View File

@ -65,9 +65,9 @@ typedef struct
// Definable color translation table // Definable color translation table
UINT8 starttranscolor; UINT8 starttranscolor;
UINT8 prefcolor; UINT16 prefcolor;
UINT8 supercolor; UINT16 supercolor;
UINT8 prefoppositecolor; // if 0 use tables instead UINT16 prefoppositecolor; // if 0 use tables instead
fixed_t highresscale; // scale of highres, default is 0.5 fixed_t highresscale; // scale of highres, default is 0.5
UINT8 contspeed; // continue screen animation speed UINT8 contspeed; // continue screen animation speed

View File

@ -1040,7 +1040,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
// V_DrawContinueIcon // V_DrawContinueIcon
// Draw a mini player! If we can, that is. Otherwise we draw a star. // Draw a mini player! If we can, that is. Otherwise we draw a star.
// //
void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT8 skincolor) void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT16 skincolor)
{ {
if (skinnum >= 0 && skinnum < numskins && skins[skinnum].sprites[SPR2_XTRA].numframes > XTRA_CONTINUE) if (skinnum >= 0 && skinnum < numskins && skins[skinnum].sprites[SPR2_XTRA].numframes > XTRA_CONTINUE)
{ {

View File

@ -160,7 +160,7 @@ void V_CubeApply(UINT8 *red, UINT8 *green, UINT8 *blue);
void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 scrn, patch_t *patch, const UINT8 *colormap); void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 scrn, patch_t *patch, const UINT8 *colormap);
void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t *patch, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h); void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t *patch, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT8 skincolor); void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT16 skincolor);
// Draw a linear block of pixels into the view buffer. // Draw a linear block of pixels into the view buffer.
void V_DrawBlock(INT32 x, INT32 y, INT32 scrn, INT32 width, INT32 height, const UINT8 *src); void V_DrawBlock(INT32 x, INT32 y, INT32 scrn, INT32 width, INT32 height, const UINT8 *src);

View File

@ -99,7 +99,7 @@ typedef union
UINT8 continues; UINT8 continues;
patch_t *pcontinues; patch_t *pcontinues;
INT32 *playerchar; // Continue HUD INT32 *playerchar; // Continue HUD
UINT8 *playercolor; UINT16 *playercolor;
UINT8 gotlife; // Number of extra lives obtained UINT8 gotlife; // Number of extra lives obtained
} spec; } spec;
@ -107,7 +107,7 @@ typedef union
struct struct
{ {
UINT32 scores[MAXPLAYERS]; // Winner's score UINT32 scores[MAXPLAYERS]; // Winner's score
UINT8 *color[MAXPLAYERS]; // Winner's color # UINT16 *color[MAXPLAYERS]; // Winner's color #
boolean spectator[MAXPLAYERS]; // Spectator list boolean spectator[MAXPLAYERS]; // Spectator list
INT32 *character[MAXPLAYERS]; // Winner's character # INT32 *character[MAXPLAYERS]; // Winner's character #
INT32 num[MAXPLAYERS]; // Winner's player # INT32 num[MAXPLAYERS]; // Winner's player #
@ -121,7 +121,7 @@ typedef union
struct struct
{ {
UINT8 *color[MAXPLAYERS]; // Winner's color # UINT16 *color[MAXPLAYERS]; // Winner's color #
INT32 *character[MAXPLAYERS]; // Winner's character # INT32 *character[MAXPLAYERS]; // Winner's character #
INT32 num[MAXPLAYERS]; // Winner's player # INT32 num[MAXPLAYERS]; // Winner's player #
char name[MAXPLAYERS][9]; // Winner's name char name[MAXPLAYERS][9]; // Winner's name