Jump to content

Translations

From SRB2 Wiki
This article is a stub. It already has some of the necessary information on this topic, but it could be expanded upon. You can help the SRB2 Wiki and its users by expanding it!

Translations in SRB2 resemble the ZDoom specification, but have significant differences in usage and built-ins. These allow you to remap any palette colors in sprites and patches upon rendering, and are useful for special effects and power-ups, and could enhance usage of blend modes.

Usage

SRB2 currently only supports defining custom translations using the TRNSLATE lump. There is no limit on how many translations can be defined. The lump is formatted as a text file like so:

// This is a comment
/*
	Long comments are
	also supported.
*/
LuminousRed = "0:255=%[2.00,0.00,0.00]:[2.00,2.00,2.00]"
// todo: add some more translation examples

SLADE has built-in functionality for translations, and displays the current translation string at the bottom of the window, which can be copied into the TRNSLATE lump. Custom translations can be applied to Map Objects using the translation property with Lua, or the SOC action A_SetTranslation. Lua currently only supports calling translation definitions directly, and will not accept being set to the translation string itself, unlike ZDoom.

Skincolors

Unlike ZDoom, player colors are handled separately than translations, and are applied before the translation's effects. However, translations can oftentimes base their own changes off of the palette below them, so skincolors can show through in less than obvious ways.

Built-in Translations

SRB2 has a small set of built-in translations defined on load. They are meant to to be used by mods, if authors so choose.

Grayscale AllWhite AllBlack Invert DashMode

While looks might be deceiving, vanilla SRB2 does not use these translations directly, instead using Special Translations to apply these effects, following TC_* constants. Some like TC_RAINBOW contain effects that cannot be easily recreated with custom translations.

Note
For source code modders, TC_ALLWHITE and TC_DASHMODE pull directly from their built-in translation counterparts for their remapping, so changing them will change the look of these too.