Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
SRB2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
265
Issues
265
List
Board
Labels
Milestones
Merge Requests
74
Merge Requests
74
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
STJr
SRB2
Commits
b37c73b0
Commit
b37c73b0
authored
May 23, 2020
by
James Hale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make colors UINT16, increase color freeslots to 1024
parent
46191cad
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
163 additions
and
143 deletions
+163
-143
d_clisrv.c
src/d_clisrv.c
+2
-2
d_clisrv.h
src/d_clisrv.h
+3
-3
d_netcmd.c
src/d_netcmd.c
+7
-6
d_player.h
src/d_player.h
+1
-1
dehacked.c
src/dehacked.c
+9
-9
doomdef.h
src/doomdef.h
+3
-3
doomstat.h
src/doomstat.h
+1
-1
g_demo.c
src/g_demo.c
+50
-33
g_game.c
src/g_game.c
+7
-7
g_state.h
src/g_state.h
+2
-1
hw_md2.c
src/hardware/hw_md2.c
+2
-2
lua_baselib.c
src/lua_baselib.c
+12
-0
lua_hudlib.c
src/lua_hudlib.c
+4
-4
lua_infolib.c
src/lua_infolib.c
+6
-6
lua_mathlib.c
src/lua_mathlib.c
+1
-1
lua_mobjlib.c
src/lua_mobjlib.c
+1
-1
lua_playerlib.c
src/lua_playerlib.c
+1
-1
m_cheat.c
src/m_cheat.c
+1
-1
m_cond.h
src/m_cond.h
+2
-2
m_menu.c
src/m_menu.c
+9
-9
m_menu.h
src/m_menu.h
+9
-9
p_enemy.c
src/p_enemy.c
+6
-17
p_mobj.c
src/p_mobj.c
+2
-2
p_mobj.h
src/p_mobj.h
+1
-1
p_saveg.c
src/p_saveg.c
+2
-2
p_spec.c
src/p_spec.c
+1
-1
p_user.c
src/p_user.c
+2
-2
r_draw.c
src/r_draw.c
+5
-5
r_draw.h
src/r_draw.h
+2
-2
r_skins.c
src/r_skins.c
+1
-1
r_skins.h
src/r_skins.h
+3
-3
v_video.c
src/v_video.c
+1
-1
v_video.h
src/v_video.h
+1
-1
y_inter.c
src/y_inter.c
+3
-3
No files found.
src/d_clisrv.c
View file @
b37c73b0
...
...
@@ -1495,7 +1495,7 @@ static boolean SV_SendServerConfig(INT32 node)
if
(
!
playeringame
[
i
])
continue
;
netbuffer
->
u
.
servercfg
.
playerskins
[
i
]
=
(
UINT8
)
players
[
i
].
skin
;
netbuffer
->
u
.
servercfg
.
playercolor
[
i
]
=
(
UINT
8
)
players
[
i
].
skincolor
;
netbuffer
->
u
.
servercfg
.
playercolor
[
i
]
=
(
UINT
16
)
players
[
i
].
skincolor
;
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
++
)
{
if
(
netbuffer
->
u
.
servercfg
.
playerskins
[
j
]
==
0xFF
&&
netbuffer
->
u
.
servercfg
.
playercolor
[
j
]
==
0xFF
&&
netbuffer
->
u
.
servercfg
.
playercolor
[
j
]
==
0xFF
FF
&&
netbuffer
->
u
.
servercfg
.
playeravailabilities
[
j
]
==
0xFFFFFFFF
)
continue
;
// not in game
...
...
src/d_clisrv.h
View file @
b37c73b0
...
...
@@ -188,7 +188,7 @@ typedef struct
SINT8
xtralife
;
SINT8
pity
;
UINT
8
skincolor
;
UINT
16
skincolor
;
INT32
skin
;
UINT32
availabilities
;
// Just in case Lua does something like
...
...
@@ -308,7 +308,7 @@ typedef struct
// 0xFF == not in game; else player skin num
UINT8
playerskins
[
MAXPLAYERS
];
UINT
8
playercolor
[
MAXPLAYERS
];
UINT
16
playercolor
[
MAXPLAYERS
];
UINT32
playeravailabilities
[
MAXPLAYERS
];
UINT8
gametype
;
...
...
@@ -414,7 +414,7 @@ typedef struct
{
char
name
[
MAXPLAYERNAME
+
1
];
UINT8
skin
;
UINT
8
color
;
UINT
16
color
;
UINT32
pflags
;
UINT32
score
;
UINT8
ctfteam
;
...
...
src/d_netcmd.c
View file @
b37c73b0
...
...
@@ -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_playername2
=
{
"name2"
,
"Tails"
,
CV_SAVE
|
CV_CALL
|
CV_NOINIT
,
NULL
,
Name2_OnChange
,
0
,
NULL
,
NULL
,
0
,
0
,
NULL
};
// player colors
UINT
8
lastgoodcolor
=
SKINCOLOR_BLUE
,
lastgoodcolor2
=
SKINCOLOR_BLUE
;
UINT
16
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_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..
...
...
@@ -1285,7 +1285,7 @@ static void SendNameAndColor(void)
players[consoleplayer].skincolor = cv_playercolor.value % numskincolors;
if (players[consoleplayer].mo)
players[consoleplayer].mo->color = (UINT
8
)players[consoleplayer].skincolor;
players[consoleplayer].mo->color = (UINT
16
)players[consoleplayer].skincolor;
}*/
}
else
...
...
@@ -1323,7 +1323,7 @@ static void SendNameAndColor(void)
// Finally write out the complete packet and send it off.
WRITESTRINGN
(
p
,
cv_playername
.
zstring
,
MAXPLAYERNAME
);
WRITEUINT32
(
p
,
(
UINT32
)
players
[
consoleplayer
].
availabilities
);
WRITEUINT
8
(
p
,
(
UINT8
)
cv_playercolor
.
value
);
WRITEUINT
16
(
p
,
(
UINT16
)
cv_playercolor
.
value
);
WRITEUINT8
(
p
,
(
UINT8
)
cv_skin
.
value
);
SendNetXCmd
(
XD_NAMEANDCOLOR
,
buf
,
p
-
buf
);
}
...
...
@@ -1439,7 +1439,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
{
player_t
*
p
=
&
players
[
playernum
];
char
name
[
MAXPLAYERNAME
+
1
];
UINT8
color
,
skin
;
UINT16
color
;
UINT8
skin
;
#ifdef PARANOIA
if
(
playernum
<
0
||
playernum
>
MAXPLAYERS
)
...
...
@@ -1458,7 +1459,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
READSTRINGN
(
*
cp
,
name
,
MAXPLAYERNAME
);
p
->
availabilities
=
READUINT32
(
*
cp
);
color
=
READUINT
8
(
*
cp
);
color
=
READUINT
16
(
*
cp
);
skin
=
READUINT8
(
*
cp
);
// set name
...
...
@@ -1468,7 +1469,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
// set color
p
->
skincolor
=
color
%
numskincolors
;
if
(
p
->
mo
)
p
->
mo
->
color
=
(
UINT
8
)
p
->
skincolor
;
p
->
mo
->
color
=
(
UINT
16
)
p
->
skincolor
;
// normal player colors
if
(
server
&&
(
p
!=
&
players
[
consoleplayer
]
&&
p
!=
&
players
[
secondarydisplayplayer
]))
...
...
src/d_player.h
View file @
b37c73b0
...
...
@@ -366,7 +366,7 @@ typedef struct player_s
UINT16
flashpal
;
// Player skin colorshift, 0-15 for which color to draw player.
UINT
8
skincolor
;
UINT
16
skincolor
;
INT32
skin
;
UINT32
availabilities
;
...
...
src/dehacked.c
View file @
b37c73b0
...
...
@@ -452,7 +452,7 @@ static void readPlayer(MYFILE *f, INT32 num)
else
if
(
fastcmp
(
word
,
"OPPOSITECOLOR"
)
||
fastcmp
(
word
,
"OPPOSITECOLOUR"
))
{
SLOTFOUND
description
[
num
].
oppositecolor
=
(
UINT
8
)
get_number
(
word2
);
description
[
num
].
oppositecolor
=
(
UINT
16
)
get_number
(
word2
);
}
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"
))
{
SLOTFOUND
description
[
num
].
tagtextcolor
=
(
UINT
8
)
get_number
(
word2
);
description
[
num
].
tagtextcolor
=
(
UINT
16
)
get_number
(
word2
);
}
else
if
(
fastcmp
(
word
,
"TAGOUTLINECOLOR"
)
||
fastcmp
(
word
,
"TAGOUTLINECOLOUR"
))
{
SLOTFOUND
description
[
num
].
tagoutlinecolor
=
(
UINT
8
)
get_number
(
word2
);
description
[
num
].
tagoutlinecolor
=
(
UINT
16
)
get_number
(
word2
);
}
else
if
(
fastcmp
(
word
,
"STATUS"
))
{
...
...
@@ -821,11 +821,11 @@ static void readskincolor(MYFILE *f, INT32 num)
}
else
if
(
fastcmp
(
word
,
"INVCOLOR"
))
{
skincolors
[
num
].
invcolor
=
(
UINT
8
)
get_number
(
word2
);
skincolors
[
num
].
invcolor
=
(
UINT
16
)
get_number
(
word2
);
}
else
if
(
fastcmp
(
word
,
"INVSHADE"
))
{
skincolors
[
num
].
invshade
=
get_number
(
word2
);
skincolors
[
num
].
invshade
=
get_number
(
word2
)
%
COLORRAMPSIZE
;
}
else
if
(
fastcmp
(
word
,
"CHATCOLOR"
))
{
...
...
@@ -4043,19 +4043,19 @@ static void readmaincfg(MYFILE *f)
}
else
if
(
fastcmp
(
word
,
"REDTEAM"
))
{
skincolor_redteam
=
(
UINT
8
)
get_number
(
word2
);
skincolor_redteam
=
(
UINT
16
)
get_number
(
word2
);
}
else
if
(
fastcmp
(
word
,
"BLUETEAM"
))
{
skincolor_blueteam
=
(
UINT
8
)
get_number
(
word2
);
skincolor_blueteam
=
(
UINT
16
)
get_number
(
word2
);
}
else
if
(
fastcmp
(
word
,
"REDRING"
))
{
skincolor_redring
=
(
UINT
8
)
get_number
(
word2
);
skincolor_redring
=
(
UINT
16
)
get_number
(
word2
);
}
else
if
(
fastcmp
(
word
,
"BLUERING"
))
{
skincolor_bluering
=
(
UINT
8
)
get_number
(
word2
);
skincolor_bluering
=
(
UINT
16
)
get_number
(
word2
);
}
else
if
(
fastcmp
(
word
,
"INVULNTICS"
))
{
...
...
src/doomdef.h
View file @
b37c73b0
...
...
@@ -241,12 +241,13 @@ extern char logfilename[1024];
#define COLORRAMPSIZE 16
#define MAXCOLORNAME 32
#define NUMCOLORFREESLOTS 1024
typedef
struct
skincolor_s
{
char
name
[
MAXCOLORNAME
+
1
];
// Skincolor name
UINT8
ramp
[
COLORRAMPSIZE
];
// Colormap ramp
UINT
8
invcolor
;
// Signpost color
UINT
16
invcolor
;
// Signpost color
UINT8
invshade
;
// Signpost color shade
UINT16
chatcolor
;
// Chat color
boolean
accessible
;
// Accessible by the color command + setup menu
...
...
@@ -388,7 +389,7 @@ typedef enum
SKINCOLOR_SUPERTAN5
,
SKINCOLOR_FIRSTFREESLOT
,
SKINCOLOR_LASTFREESLOT
=
255
,
SKINCOLOR_LASTFREESLOT
=
SKINCOLOR_FIRSTFREESLOT
+
NUMCOLORFREESLOTS
-
1
,
MAXSKINCOLORS
,
...
...
@@ -397,7 +398,6 @@ typedef enum
UINT16
numskincolors
;
#define NUMCOLORFREESLOTS (SKINCOLOR_LASTFREESLOT-SKINCOLOR_FIRSTFREESLOT)+1
extern
skincolor_t
skincolors
[
MAXSKINCOLORS
];
// State updates, number of tics / second.
...
...
src/doomstat.h
View file @
b37c73b0
...
...
@@ -145,7 +145,7 @@ extern INT32 tutorialanalog; // store cv_analog[0] user value
extern
boolean
looptitle
;
// CTF colors.
extern
UINT
8
skincolor_redteam
,
skincolor_blueteam
,
skincolor_redring
,
skincolor_bluering
;
extern
UINT
16
skincolor_redteam
,
skincolor_blueteam
,
skincolor_redring
,
skincolor_bluering
;
extern
tic_t
countdowntimer
;
extern
boolean
countdowntimeup
;
...
...
src/g_demo.c
View file @
b37c73b0
...
...
@@ -68,7 +68,7 @@ static struct {
UINT8
flags
;
// EZT flags
// EZT_COLOR
UINT
8
color
,
lastcolor
;
UINT
16
color
,
lastcolor
;
// EZT_SCALE
fixed_t
scale
,
lastscale
;
...
...
@@ -82,7 +82,8 @@ static struct {
// There is no conflict here.
typedef
struct
demoghost
{
UINT8
checksum
[
16
];
UINT8
*
buffer
,
*
p
,
color
,
fadein
;
UINT8
*
buffer
,
*
p
,
fadein
;
UINT16
color
;
UINT16
version
;
mobj_t
oldmo
,
*
mo
;
struct
demoghost
*
next
;
...
...
@@ -93,7 +94,7 @@ demoghost *ghosts = NULL;
// DEMO RECORDING
//
#define DEMOVERSION 0x000
c
#define DEMOVERSION 0x000
d
#define DEMOHEADER "\xF0" "SRB2Replay" "\x0F"
#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
))
return
;
if
(
ghostext
.
lastcolor
==
(
UINT
8
)
color
)
if
(
ghostext
.
lastcolor
==
(
UINT
16
)
color
)
{
ghostext
.
flags
&=
~
EZT_COLOR
;
return
;
}
ghostext
.
flags
|=
EZT_COLOR
;
ghostext
.
color
=
(
UINT
8
)
color
;
ghostext
.
color
=
(
UINT
16
)
color
;
}
void
G_GhostAddScale
(
fixed_t
scale
)
...
...
@@ -425,7 +426,7 @@ void G_WriteGhostTic(mobj_t *ghost)
WRITEUINT8
(
demo_p
,
ghostext
.
flags
);
if
(
ghostext
.
flags
&
EZT_COLOR
)
{
WRITEUINT
8
(
demo_p
,
ghostext
.
color
);
WRITEUINT
16
(
demo_p
,
ghostext
.
color
);
ghostext
.
lastcolor
=
ghostext
.
color
;
}
if
(
ghostext
.
flags
&
EZT_SCALE
)
...
...
@@ -501,7 +502,7 @@ void G_WriteGhostTic(mobj_t *ghost)
WRITEUINT8
(
demo_p
,
ghost
->
player
->
followmobj
->
sprite2
);
WRITEUINT16
(
demo_p
,
ghost
->
player
->
followmobj
->
sprite
);
WRITEUINT8
(
demo_p
,(
ghost
->
player
->
followmobj
->
frame
&
FF_FRAMEMASK
));
WRITEUINT
8
(
demo_p
,
ghost
->
player
->
followmobj
->
color
);
WRITEUINT
16
(
demo_p
,
ghost
->
player
->
followmobj
->
color
);
*
followtic_p
=
followtic
;
}
...
...
@@ -566,7 +567,7 @@ void G_ConsGhostTic(void)
{
// But wait, there's more!
UINT8
xziptic
=
READUINT8
(
demo_p
);
if
(
xziptic
&
EZT_COLOR
)
demo_p
++
;
demo_p
+=
(
demoversion
==
0x000c
)
?
1
:
sizeof
(
UINT16
)
;
if
(
xziptic
&
EZT_SCALE
)
demo_p
+=
sizeof
(
fixed_t
);
if
(
xziptic
&
EZT_HIT
)
...
...
@@ -633,7 +634,7 @@ void G_ConsGhostTic(void)
demo_p
++
;
demo_p
+=
sizeof
(
UINT16
);
demo_p
++
;
demo_p
++
;
demo_p
+=
(
demoversion
==
0x000c
)
?
1
:
sizeof
(
UINT16
)
;
}
// Re-synchronise
...
...
@@ -731,7 +732,7 @@ void G_GhostTicker(void)
xziptic
=
READUINT8
(
g
->
p
);
if
(
xziptic
&
EZT_COLOR
)
{
g
->
color
=
READUINT8
(
g
->
p
);
g
->
color
=
(
g
->
version
==
0x000c
)
?
READUINT8
(
g
->
p
)
:
READUINT16
(
g
->
p
);
switch
(
g
->
color
)
{
default:
...
...
@@ -864,7 +865,7 @@ void G_GhostTicker(void)
g
->
mo
->
color
+=
abs
(
(
(
signed
)(
(
unsigned
)
leveltime
>>
1
)
%
9
)
-
4
);
break
;
case
GHC_INVINCIBLE
:
// Mario invincibility (P_CheckInvincibilityTimer)
g
->
mo
->
color
=
(
UINT
8
)(
SKINCOLOR_RUBY
+
(
leveltime
%
(
MAXSKINCOLORS
-
SKINCOLOR_RUBY
)));
// Passes through all saturated colours
g
->
mo
->
color
=
(
UINT
16
)(
SKINCOLOR_RUBY
+
(
leveltime
%
(
FIRSTSUPERCOLOR
-
SKINCOLOR_RUBY
)));
// Passes through all saturated colours
break
;
default:
break
;
...
...
@@ -918,7 +919,7 @@ void G_GhostTicker(void)
follow
->
sprite
=
READUINT16
(
g
->
p
);
follow
->
frame
=
(
READUINT8
(
g
->
p
))
|
(
g
->
mo
->
frame
&
FF_TRANSMASK
);
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
))
{
...
...
@@ -1158,7 +1159,7 @@ void G_ReadMetalTic(mobj_t *metal)
follow
->
sprite
=
READUINT16
(
metal_p
);
follow
->
frame
=
READUINT32
(
metal_p
);
// NOT & FF_FRAMEMASK here, so 32 bits
follow
->
angle
=
metal
->
angle
;
follow
->
color
=
READUINT8
(
metal_p
);
follow
->
color
=
(
metalversion
==
0x000c
)
?
READUINT8
(
metal_p
)
:
READUINT16
(
metal_p
);
if
(
!
(
followtic
&
FZT_SPAWNED
))
{
...
...
@@ -1340,7 +1341,7 @@ void G_WriteMetalTic(mobj_t *metal)
WRITEUINT8
(
demo_p
,
metal
->
player
->
followmobj
->
sprite2
);
WRITEUINT16
(
demo_p
,
metal
->
player
->
followmobj
->
sprite
);
WRITEUINT32
(
demo_p
,
metal
->
player
->
followmobj
->
frame
);
// NOT & FF_FRAMEMASK here, so 32 bits
WRITEUINT
8
(
demo_p
,
metal
->
player
->
followmobj
->
color
);
WRITEUINT
16
(
demo_p
,
metal
->
player
->
followmobj
->
color
);
*
followtic_p
=
followtic
;
}
...
...
@@ -1394,7 +1395,7 @@ void G_RecordMetal(void)
void
G_BeginRecording
(
void
)
{
UINT8
i
;
char
name
[
16
];
char
name
[
MAXCOLORNAME
+
1
];
player_t
*
player
=
&
players
[
consoleplayer
];
if
(
demo_p
)
...
...
@@ -1457,12 +1458,12 @@ void G_BeginRecording(void)
demo_p
+=
16
;
// 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
];
for
(;
i
<
16
;
i
++
)
for
(;
i
<
MAXCOLORNAME
;
i
++
)
name
[
i
]
=
'\0'
;
M_Memcpy
(
demo_p
,
name
,
16
);
demo_p
+=
16
;
M_Memcpy
(
demo_p
,
name
,
MAXCOLORNAME
);
demo_p
+=
MAXCOLORNAME
;
// Stats
WRITEUINT8
(
demo_p
,
player
->
charability
);
...
...
@@ -1622,7 +1623,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
c
=
READUINT8
(
p
);
// SUBVERSION
I_Assert
(
c
==
SUBVERSION
);
s
=
READUINT16
(
p
);
I_Assert
(
s
==
DEMOVERSION
);
I_Assert
(
s
>=
0x000c
);
p
+=
16
;
// demo checksum
I_Assert
(
!
memcmp
(
p
,
"PLAY"
,
4
));
p
+=
4
;
// PLAY
...
...
@@ -1671,6 +1672,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
switch
(
oldversion
)
// demoversion
{
case
DEMOVERSION
:
// latest always supported
case
0x000c
:
// all that changed between then and now was longer color name
break
;
// too old, cannot support.
default:
...
...
@@ -1744,15 +1746,15 @@ void G_DoPlayDemo(char *defdemoname)
{
UINT8
i
;
lumpnum_t
l
;
char
skin
[
17
],
color
[
17
],
*
n
,
*
pdemoname
;
UINT8
version
,
subversion
,
charability
,
charability2
,
thrustfactor
,
accelstart
,
acceleration
;
char
skin
[
17
],
color
[
MAXCOLORNAME
+
1
],
*
n
,
*
pdemoname
;
UINT8
version
,
subversion
,
charability
,
charability2
,
thrustfactor
,
accelstart
,
acceleration
,
cnamelen
;
pflags_t
pflags
;
UINT32
randseed
,
followitem
;
fixed_t
camerascale
,
shieldscale
,
actionspd
,
mindash
,
maxdash
,
normalspeed
,
runspeed
,
jumpfactor
,
height
,
spinheight
;
char
msg
[
1024
];
skin
[
16
]
=
'\0'
;
color
[
16
]
=
'\0'
;
color
[
MAXCOLORNAME
]
=
'\0'
;
n
=
defdemoname
+
strlen
(
defdemoname
);
while
(
*
n
!=
'/'
&&
*
n
!=
'\\'
&&
n
!=
defdemoname
)
...
...
@@ -1810,6 +1812,11 @@ void G_DoPlayDemo(char *defdemoname)
switch
(
demoversion
)
{
case
DEMOVERSION
:
// latest always supported
cnamelen
=
MAXCOLORNAME
;
break
;
// all that changed between then and now was longer color name
case
0x000c
:
cnamelen
=
16
;
break
;
// too old, cannot support.
default:
...
...
@@ -1876,8 +1883,8 @@ void G_DoPlayDemo(char *defdemoname)
demo_p
+=
16
;
// Color
M_Memcpy
(
color
,
demo_p
,
16
);
demo_p
+=
16
;
M_Memcpy
(
color
,
demo_p
,
cnamelen
);
demo_p
+=
cnamelen
;
charability
=
READUINT8
(
demo_p
);
charability2
=
READUINT8
(
demo_p
);
...
...
@@ -1941,7 +1948,9 @@ void G_DoPlayDemo(char *defdemoname)
// Set skin
SetPlayerSkin
(
0
,
skin
);
#ifdef HAVE_BLUA
LUAh_MapChange
(
gamemap
);
#endif
displayplayer
=
consoleplayer
=
0
;
memset
(
playeringame
,
0
,
sizeof
(
playeringame
));
playeringame
[
0
]
=
true
;
...
...
@@ -1949,8 +1958,9 @@ void G_DoPlayDemo(char *defdemoname)
G_InitNew
(
false
,
G_BuildMapName
(
gamemap
),
true
,
true
,
false
);
// Set color
for
(
i
=
0
;
i
<
MAXSKINCOLORS
;
i
++
)
if
(
!
stricmp
(
Color_Names
[
i
],
color
))
players
[
0
].
skincolor
=
skins
[
players
[
0
].
skin
].
prefcolor
;
for
(
i
=
0
;
i
<
numskincolors
;
i
++
)
if
(
!
stricmp
(
skincolors
[
i
].
name
,
color
))
{
players
[
0
].
skincolor
=
i
;
break
;
...
...
@@ -1992,7 +2002,8 @@ void G_AddGhost(char *defdemoname)
{
INT32
i
;
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
;
UINT8
flags
;
UINT8
*
buffer
,
*
p
;
...
...
@@ -2047,6 +2058,11 @@ void G_AddGhost(char *defdemoname)
switch
(
ghostversion
)
{
case
DEMOVERSION
:
// latest always supported
cnamelen
=
MAXCOLORNAME
;
break
;
// all that changed between then and now was longer color name
case
0x000c
:
cnamelen
=
16
;
break
;
// too old, cannot support.
default:
...
...
@@ -2109,8 +2125,8 @@ void G_AddGhost(char *defdemoname)
p
+=
16
;
// Color
M_Memcpy
(
color
,
p
,
16
);
p
+=
16
;
M_Memcpy
(
color
,
p
,
cnamelen
);
p
+=
cnamelen
;
// Ghosts do not have a player structure to put this in.
p
++
;
// charability
...
...
@@ -2198,10 +2214,10 @@ void G_AddGhost(char *defdemoname)
// Set color
gh
->
mo
->
color
=
((
skin_t
*
)
gh
->
mo
->
skin
)
->
prefcolor
;
for
(
i
=
0
;
i
<
MAXSKINCOLORS
;
i
++
)
if
(
!
stricmp
(
Color_Names
[
i
]
,
color
))
for
(
i
=
0
;
i
<
numskincolors
;
i
++
)
if
(
!
stricmp
(
skincolors
[
i
].
name
,
color
))
{
gh
->
mo
->
color
=
(
UINT
8
)
i
;
gh
->
mo
->
color
=
(
UINT
16
)
i
;
break
;
}
gh
->
oldmo
.
color
=
gh
->
mo
->
color
;
...
...
@@ -2292,6 +2308,7 @@ void G_DoPlayMetal(void)
switch
(
metalversion
)
{
case
DEMOVERSION
:
// latest always supported
case
0x000c
:
// all that changed between then and now was longer color name
break
;
// too old, cannot support.
default:
...
...
src/g_game.c
View file @
b37c73b0
...
...
@@ -54,7 +54,7 @@ UINT8 ultimatemode = false;
boolean
botingame
;
UINT8
botskin
;
UINT
8
botcolor
;
UINT
16
botcolor
;
JoyType_t
Joystick
;
JoyType_t
Joystick2
;
...
...
@@ -135,10 +135,10 @@ INT32 tutorialanalog = 0; // store cv_analog[0] user value
boolean
looptitle
=
false
;
UINT
8
skincolor_redteam
=
SKINCOLOR_RED
;
UINT
8
skincolor_blueteam
=
SKINCOLOR_BLUE
;
UINT
8
skincolor_redring
=
SKINCOLOR_SALMON
;
UINT
8
skincolor_bluering
=
SKINCOLOR_CORNFLOWER
;
UINT
16
skincolor_redteam
=
SKINCOLOR_RED
;
UINT
16
skincolor_blueteam
=
SKINCOLOR_BLUE
;
UINT
16
skincolor_redring
=
SKINCOLOR_SALMON
;
UINT
16
skincolor_bluering
=
SKINCOLOR_CORNFLOWER
;
tic_t
countdowntimer
=
0
;
boolean
countdowntimeup
=
false
;
...
...
@@ -2381,7 +2381,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
INT16
totalring
;
UINT8
laps
;
UINT8
mare
;
UINT
8
skincolor
;
UINT
16
skincolor
;
INT32
skin
;
UINT32
availabilities
;
tic_t
jointime
;
...
...
@@ -4475,7 +4475,7 @@ cleanup:
//
void
G_DeferedInitNew
(
boolean
pultmode
,
const
char
*
mapname
,
INT32
pickedchar
,
boolean
SSSG
,
boolean
FLS
)
{
UINT
8
color
=
skins
[
pickedchar
].
prefcolor
;
UINT
16
color
=
skins
[
pickedchar
].
prefcolor
;
paused
=
false
;
if
(
demoplayback
)
...
...
src/g_state.h
View file @
b37c73b0
...
...
@@ -57,6 +57,7 @@ extern UINT8 ultimatemode; // was sk_insane
extern
gameaction_t
gameaction
;
extern
boolean
botingame
;
extern
UINT8
botskin
,
botcolor
;
extern
UINT8
botskin
;
extern
UINT16
botcolor
;
#endif //__G_STATE__
src/hardware/hw_md2.c
View file @
b37c73b0
...
...
@@ -682,7 +682,7 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
UINT16
w
=
gpatch
->
width
,
h
=
gpatch
->
height
;
UINT32
size
=
w
*
h
;
RGBA_t
*
image
,
*
blendimage
,
*
cur
,
blendcolor
;
UINT
8
translation
[
16
];
// First the color index
UINT
16
translation
[
16
];
// First the color index
UINT8
cutoff
[
16
];
// Brightness cutoff before using the next color
UINT8
translen
=
0
;
UINT8
i
;
...
...
@@ -741,7 +741,7 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
numdupes
=
1
;
translen
++
;
translation
[
translen
]
=
(
UINT
8
)
skincolors
[
color
].
ramp
[
i
];
translation
[
translen
]
=
(
UINT
16
)
skincolors
[
color
].
ramp
[
i
];
}
translen
++
;
...
...
src/lua_baselib.c
View file @
b37c73b0
...
...
@@ -2424,6 +2424,17 @@ static int lib_rGetColorByName(lua_State *L)
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
////////////
static
int
lib_sStartSound
(
lua_State
*
L
)
...
...
@@ -3337,6 +3348,7 @@ static luaL_Reg lib[] = {
// r_draw
{
"R_GetColorByName"
,
lib_rGetColorByName
},
{
"R_GetNameByColor"
,
lib_rGetNameByColor
},
// s_sound
{
"S_StartSound"
,
lib_sStartSound
},
...
...
src/lua_hudlib.c
View file @
b37c73b0
...
...
@@ -878,8 +878,8 @@ static int libd_drawNameTag(lua_State *L)
INT32
y
;
const
char
*
str
;
INT32
flags
;
UINT
8
basecolor
;
UINT
8
outlinecolor
;
UINT
16
basecolor
;
UINT
16
outlinecolor
;
UINT8
*
basecolormap
=
NULL
;
UINT8
*
outlinecolormap
=
NULL
;
...
...
@@ -908,8 +908,8 @@ static int libd_drawScaledNameTag(lua_State *L)
const
char
*
str
;
INT32
flags
;
fixed_t
scale
;
UINT
8
basecolor
;
UINT
8
outlinecolor
;
UINT
16
basecolor
;
UINT
16
outlinecolor
;
UINT8
*
basecolormap
=
NULL
;
UINT8
*
outlinecolormap
=
NULL
;
...
...
src/lua_infolib.c
View file @
b37c73b0
...
...
@@ -1508,10 +1508,10 @@ static int lib_setSkinColor(lua_State *L)
{
UINT32
j
;
skincolor_t
*
info
;
UINT
8
cnum
;
//skincolor num
UINT
16
cnum
;
//skincolor num
lua_remove
(
L
,
1
);
// don't care about skincolors[] userdata.
{
cnum
=
(
UINT
8
)
luaL_checkinteger
(
L
,
1
);
cnum
=
(
UINT
16
)
luaL_checkinteger
(
L
,
1
);
if
(
cnum
<
SKINCOLOR_FIRSTFREESLOT
||
cnum
>=
numskincolors
)
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.
...
...
@@ -1551,9 +1551,9 @@ static int lib_setSkinColor(lua_State *L)
info
->
ramp
[
j
]
=
(
*
((
UINT8
**
)
luaL_checkudata
(
L
,
3
,
META_COLORRAMP
)))[
j
];
R_FlushTranslationColormapCache
();
}
else
if
(
i
==
3
||
(
str
&&
fastcmp
(
str
,
"invcolor"
)))
info
->
invcolor
=
(
UINT
8
)
luaL_checkinteger
(
L
,
3
);
info
->
invcolor
=
(
UINT
16
)
luaL_checkinteger
(
L
,
3
);
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"
)))
info
->
chatcolor
=
(
UINT16
)
luaL_checkinteger
(
L
,
3
);
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
];
R_FlushTranslationColormapCache
();
}
else
if
(
fastcmp
(
field
,
"invcolor"
))
info
->
invcolor
=
(
UINT
8
)
luaL_checkinteger
(
L
,
3
);
info
->
invcolor
=
(
UINT
16
)
luaL_checkinteger
(
L
,
3
);
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"
))
info
->
chatcolor
=
(
UINT16
)
luaL_checkinteger
(
L
,
3
);
else
if
(
fastcmp
(
field
,
"accessible"
))
...
...
src/lua_mathlib.c
View file @
b37c73b0
...
...
@@ -175,7 +175,7 @@ static int lib_all7emeralds(lua_State *L)
// Returns both color and signpost shade numbers!
static
int
lib_coloropposite
(
lua_State
*
L
)
{
UINT
8
colornum
=
(
UINT8
)
luaL_checkinteger
(
L
,
1
);
UINT
16
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_pushinteger
(
L
,
skincolors
[
colornum
].
invcolor
);
// push color
...
...
src/lua_mobjlib.c
View file @
b37c73b0
...
...
@@ -574,7 +574,7 @@ static int mobj_set(lua_State *L)
}
case
mobj_color
:
{
UINT
8
newcolor
=
(
UINT8
)
luaL_checkinteger
(
L
,
3
);
UINT
16
newcolor
=
(
UINT16
)
luaL_checkinteger
(
L
,
3
);
if
(
newcolor
>=
numskincolors
)
return
luaL_error
(
L
,
"mobj.color %d out of range (0 - %d)."
,
newcolor
,
numskincolors
-
1
);
mo
->
color
=
newcolor
;
...
...
src/lua_playerlib.c
View file @
b37c73b0
...
...
@@ -461,7 +461,7 @@ static int player_set(lua_State *L)
plr
->
flashpal
=
(
UINT16
)
luaL_checkinteger
(
L
,
3
);
else
if
(
fastcmp
(
field
,
"skincolor"
))
{
UINT
8
newcolor
=
(
UINT8
)
luaL_checkinteger
(
L
,
3
);
UINT
16
newcolor
=
(
UINT16
)
luaL_checkinteger
(
L
,
3
);
if
(
newcolor
>=
numskincolors
)
return
luaL_error
(
L
,
"player.skincolor %d out of range (0 - %d)."
,
newcolor
,
numskincolors
-
1
);
plr
->
skincolor
=
newcolor
;
...
...
src/m_cheat.c
View file @
b37c73b0
...
...
@@ -978,7 +978,7 @@ static mobjflag2_t op_oldflags2 = 0;
static
UINT32
op_oldeflags
=
0
;
static
fixed_t
op_oldmomx
=
0
,
op_oldmomy
=
0
,
op_oldmomz
=
0
,
op_oldheight
=
0
;
static
statenum_t
op_oldstate
=
0
;
static
UINT
8
op_oldcolor
=
0
;
static
UINT
16
op_oldcolor
=
0
;
//
// Static calculation / common output help
...
...
src/m_cond.h
View file @
b37c73b0
...
...
@@ -90,7 +90,7 @@ typedef struct
INT16
tag
;
///< Tag of emblem mapthing
INT16
level
;
///< Level on which this emblem can be found.
UINT8
sprite
;
///< emblem sprite to use, 0 - 25
UINT
8
color
;
///< skincolor to use
UINT
16
color
;
///< skincolor to use
INT32
var
;
///< If needed, specifies information on the target amount to achieve (or target skin)
char
hint
[
110
];
///< Hint for emblem hints menu
UINT8
collected
;
///< Do you have this emblem?
...
...
@@ -102,7 +102,7 @@ typedef struct
UINT8
conditionset
;
///< Condition set that awards this emblem.
UINT8
showconditionset
;
///< Condition set that shows this emblem.
UINT8
sprite
;
///< emblem sprite to use, 0 - 25
UINT
8
color
;
///< skincolor to use
UINT
16
color
;
///< skincolor to use
UINT8
collected
;
///< Do you have this emblem?
}
extraemblem_t
;
...
...
src/m_menu.c
View file @
b37c73b0
...
...
@@ -9055,7 +9055,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
skin_t
*
charskin
=
&
skins
[
0
];
INT32
skinnum
=
0
;
UINT
8
col
;
UINT
16
col
;
UINT8
*
colormap
=
NULL
;
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
;
patch_t
*
curpatch
=
NULL
,
*
prevpatch
=
NULL
,
*
nextpatch
=
NULL
;
const
char
*
curtext
=
NULL
,
*
prevtext
=
NULL
,
*
nexttext
=
NULL
;
UINT
8
curtextcolor
=
0
,
prevtextcolor
=
0
,
nexttextcolor
=
0
;
UINT
8
curoutlinecolor
=
0
,
prevoutlinecolor
=
0
,
nextoutlinecolor
=
0
;
UINT
16
curtextcolor
=
0
,
prevtextcolor
=
0
,
nexttextcolor
=
0
;
UINT
16
curoutlinecolor
=
0
,
prevoutlinecolor
=
0
,
nextoutlinecolor
=
0
;