Skip to content

Custom skincolors

James Hale requested to merge Machturne/SRB2:luacolors into next

Allows Lua and SOC to create custom skincolors.

skincolor_t

Name Type Access. Description
name string R/W The name of the skincolor. Used in the console and Player Setup menu. Names containing spaces must be put in quotes in the console.
ramp UINT8 array R/W An array of 16 palette indices, which in whole represent the skincolor's color ramp.
invcolor UINT8 R/W The opposite skincolor. Used on the Goal Sign.
invshade UINT8 R/W The shade of the opposite skincolor, from 0 to 15. Used on the Goal Sign.
chatcolor UINT16 R/W Color to use when coloring a player name in the chat. Accepts V_*MAP constants.
accessible boolean R/W Skincolor accessibility. Determines whether the color can be accessed from the Player Setup menu or from the console.

Both of these are identical to each other and functionally identical to the internal color SKINCOLOR_BLUE:

freeslot("SKINCOLOR_BLUECLONE")
skincolors[SKINCOLOR_BLUECLONE] = {
	name = "BlueClone",
	ramp = {146,147,148,149,150,151,152,153,154,155,156,157,158,159,253,254},
	invcolor = SKINCOLOR_ORANGE,
	invshade = 9,
	chatcolor = V_BLUEMAP,
	accessible = true
}
FREESLOT
SKINCOLOR_BLUECLONE

SKINCOLOR SKINCOLOR_BLUECLONE
NAME = BlueClone
RAMP = 146,147,148,149,150,151,152,153,154,155,156,157,158,159,253,254
INVCOLOR = SKINCOLOR_ORANGE
INVSHADE = 9
CHATCOLOR = V_BLUEMAP
ACCESSIBLE = TRUE

Several functions have also been added. These functions can be used to get or set the order of skincolors as displayed in the Player Setup menu.

Function Returns Description
M_MoveColorBefore(int color, int targ) nil Moves the color color before the color targ.
M_MoveColorAfter(int color, int targ) nil Moves the color color after the color targ.
M_GetColorBefore(int color) int Returns the color before the color color.
M_GetColorAfter(int color) int Returns the color after the color color.

Due to lump loading order being the way it is, a color must be defined in a Lua lump to be used in S_SKIN. For a skin to use a custom super color ColorName in its S_SKIN, there must be exist 5 colors with names Super ColorName 1 through Super ColorName 5.

Demonstration:

https://gfycat.com/slipperymadeupangelwingmussel

https://gfycat.com/drearyexcellentcrane

Edited by James Hale

Merge request reports

Loading