Skip to content

Various color fixes

Kays Ishaq requested to merge kays/SRB2:various-color-fixes into next
  • help color in the console now only shows accessible colors as possible values - previously, it showed inaccessible colors including super colors and about 1000 blank freeslots.
  • Bugged setting of skincolor.accessible in Lua is fixed.
  • Invalid invcolors are accounted for in SOC and Lua custom skincolor definitions. This fixes a sigsegv that can be caused by haphazard scripting.
    • SOC will fall back on SKINCOLOR_GREEN, while Lua returns an error.
  • Duplicate names bring up a warning in SOC and Lua custom skincolor definitions.
    • SOC will attempt to rename the new skincolor, while Lua simply prints a warning in the console.
    • Empty string names aren't checked for duplicates, as they may be used for situations where the name doesn't matter (e.g., a skincolor not intended for player use)
  • R_GetColorByName and R_GetSuperColorByName both return SKINCOLOR_NONE rather than SKINCOLOR_GREEN/SKINCOLOR_SUPERGOLD1 if no color is found.
    • Usecase is for scripters to quickly check if a color name is already taken
    • The relevant S_SKIN parsing for PREFCOLOR, PREFOPPOSITECOLOR, and SUPERCOLOR account for this change and fall back on the defaults.
    • R_GetSuperColorByName is also exposed to Lua.
  • Other minor changes to Lua custom skincolor setting. The warning for a name with spaces exists for both setting by table and setting by field (previously only existed setting by field). In addition, it isn't checked until after the name's potential truncation, which may remove the offending spaces anyways. A redundant check to prevent standard skincolors from having accessible changed was removed (standard skincolors are already read-only to Lua).
Edited by Kays Ishaq

Merge request reports