Video flags

From SRB2 Wiki
Jump to navigation Jump to search
This article or section is outdated and has not been fully updated to reflect the current version of SRB2.

Please help the Wiki by correcting or removing any misinformation, as well as adding any new information to the page.

Video flags are a series of toggles that determine the properties of graphics drawn during SRB2 runtime, whether in the form of text or patches. These flags are listed here for reference, as they are used by both the console command cechoflags as well as Lua's HUD library functions. Also listed in this page are several constants related to the video flags used for masking and bit-shifting, which are detailed in their respective sections and are relevant only for SOC/Lua.

Video flag bits and masks

Unlike with other types of flags, the video flags are divided into individual sections which take up specific bits in the final combined value. These are detailed in the table below, along with the corresponding mask constants (and their values) to represent these bits:

Bits Mask name Mask value
(Decimal)
Mask value
(Hexadecimal)
Description
0–7 V_PARAMMASK 255 0x000000FF These bits are reserved for an 8-bit integer parameter internally. For example, when drawing individual characters in a string, this determines which character in the font is to be drawn. You cannot set nor control these bits using cechoflags or Lua's HUD library functions. An exception to this is Lua's v.drawFill, where these bits are the palette index to use as the fill color.
8–9 V_SCALEPATCHMASK 768 0x00000300 These bits determine how to scale text and patches.
10–11 V_SPACINGMASK 3072 0x00000C00 These bits determine text spacing types.
12–15 V_CHARCOLORMASK 61440 0x0000F000 These bits determine the color of text.
16–19 V_ALPHAMASK 983040 0x000F0000 These bits determine the alpha or translucency of text and patches.
20–31 none 4293918720 0xFFF00000 These bits determine miscellaneous flags. These flags can be combined with each other freely, unlike flags from the other sections.

List of flags

Scale

These flags control how text or patches are scaled in-game. However, they may or may not have an effect depending on the screen resolution – by default the size of graphics is determined by the ratio of the current resolution to the default resolution (320×200). Having none of the scaling flags set corresponds with con_textsize huge.

Note that the given X/Y positions of the top left corner of text or patches will also be scaled, unless V_NOSCALESTART is set. Patch offsets will also be scaled unless V_NOSCALESTART is set.

If any of these flags are set, the flags V_SNAPTOTOP, V_SNAPTOBOTTOM, V_SNAPTOLEFT and V_SNAPTORIGHT will have no effect.

Decimal Hexadecimal Flag name Description
256 0x00000100 V_NOSCALEPATCH Text or patches are not scaled. This will cause them to be sized as if the resolution was the default of 320×200, while still retaining their starting positions for the resolution currently being used, assuming V_NOSCALESTART is not being used. This causes text or patches to appear smaller in higher resolutions. Generally not recommended because text or patches will look different in different resolutions.

This flag corresponds with con_textsize small.

512 0x00000200 V_SMALLSCALEPATCH Text or patches are scaled to half of their normal scale. Will have no effect for resolutions 640×400 and smaller.

This flag corresponds with con_textsize medium.

768 0x00000300 V_MEDSCALEPATCH Text or patches are scaled to 2/3 of their normal scale. Will have no effect for 320×200.

This flag corresponds with con_textsize large.

Spacing

These flags control the type of text spacing used when drawing text. These flags do not apply for patches. By default, all spaces are 4 pixels in width, and a character's width is determined by the width of the graphic used.

Decimal Hexadecimal Flag name Description
1024 0x00000400 V_6WIDTHSPACE Spaces are 6 pixels wide; all other characters have a width matching their real image width. Old v2.1-style spacing.
2048 0x00000800 V_OLDSPACING All characters are 8 pixels wide, and spaces are 4 pixels wide. This is the spacing used by all versions of SRB2 prior to v2.1, and some parts of the game (menu options, for example) still use it.
3072 0x00000C00 V_MONOSPACE All characters are 8 pixels wide, spaces included.

Color

These flags control the color of text. These are not related to skin colors, as color-remapping for text is done differently compared to color-remapping for sprites. These flags do not apply for patches.

Note that the effects of these flags override any and all color codes within the text string, coloring all text drawn in the corresponding color for the flag. For applying colors to specific parts of a text rather than all if it, see SOC > Custom colors or SOC > Hexadecimal input for SOC, and Lua > Special characters for Lua.

Decimal Hexadecimal Flag name Description Example
4096 0x00001000 V_MAGENTAMAP Text is colored magenta.
8192 0x00002000 V_YELLOWMAP Text is colored yellow.
12288 0x00003000 V_GREENMAP Text is colored green.
16384 0x00004000 V_BLUEMAP Text is colored blue.
20480 0x00005000 V_REDMAP Text is colored red.
24576 0x00006000 V_GRAYMAP Text is colored gray.
28672 0x00007000 V_ORANGEMAP Text is colored orange.
32768 0x00008000 V_SKYMAP Text is colored sky blue.
36864 0x00009000 V_PURPLEMAP Text is colored purple.
40960 0x0000A000 V_AQUAMAP Text is colored aqua green.
45056 0x0000B000 V_PERIDOTMAP Text is colored peridot green.
49152 0x0000C000 V_AZUREMAP Text is colored azure blue.
53248 0x0000D000 V_BROWNMAP Text is colored brown.
57344 0x0000E000 V_ROSYMAP Text is colored rosy pink.
61440 0x0000F000 V_INVERTMAP Text is inverted.

Alpha & blending

These flags determine the alpha/translucency and blending mode of text and patches; if none are used, they will be opaque. Some of these depend on the value of the console variable translucenthud instead of having a fixed translucency.

Decimal Hexadecimal Flag name Description
65536 0x00010000 V_10TRANS Text or patches are 10% translucent.
131072 0x00020000 V_20TRANS Text or patches are 20% translucent.
196608 0x00030000 V_30TRANS Text or patches are 30% translucent.
262144 0x00040000 V_40TRANS Text or patches are 40% translucent.
327680 0x00050000 V_50TRANS

V_TRANSLUCENT

Text or patches are 50% translucent.
393216 0x00060000 V_60TRANS Text or patches are 60% translucent.
458752 0x00070000 V_70TRANS Text or patches are 70% translucent.
524288 0x00080000 V_80TRANS Text or patches are 80% translucent.
589824 0x00090000 V_90TRANS Text or patches are 90% translucent.
851968 0x000A0000 V_HUDTRANSHALF Text or patches will be adjusted to be half as opaque (twice as translucent) as the translucency determined by translucenthud:
  • 0 – Invisible
  • 1–2 – 90% translucent
  • 3–4 – 80% translucent
  • 5–6 – 70% translucent
  • 7–8 – 60% translucent
  • 9–10 – 50% translucent
917504 0x000B0000 V_HUDTRANS Text or patches will be adjusted to the translucency determined by translucenthud:
  • 0 – Invisible
  • 1 – 90% translucent
  • 2 – 80% translucent
  • 3 – 70% translucent
  • 4 – 60% translucent
  • 5 – 50% translucent
  • 6 – 40% translucent
  • 7 – 30% translucent
  • 8 – 20% translucent
  • 9 – 10% translucent
  • 10 – Opaque
983040 0x000C0000 V_HUDTRANSDOUBLE Text or patches will be adjusted to be twice as opaque (half as translucent) as the translucency determined by translucenthud:
  • 0 – Invisible
  • 1 – 80% translucent
  • 2 – 60% translucent
  • 3 – 40% translucent
  • 4 – 20% translucent
  • 5–10 – Opaque
1048576 0x00100000 V_ADD Text or patches use additive blending.

At 100% intensity by default, but can be combined with V_10TRANSV_90TRANS for 90%–10% intensity.

2097152 0x00200000 V_SUBTRACT Text or patches use subtractive blending.

At 100% intensity by default, but can be combined with V_10TRANSV_90TRANS for 90%–10% intensity.

3145728 0x00300000 V_REVERSESUBTRACT Text or patches use reverse subtractive blending.

At 100% intensity by default, but can be combined with V_10TRANSV_90TRANS for 90%–10% intensity.

4194304 0x00400000 V_MODULATE Text or patches use modulative blending.

Miscellaneous

These flags can be combined with each other freely; however, some flags may not be compatible with other flags from this or other sections.

Decimal Hexadecimal Flag name Description
8388608 0x00800000 V_ALLOWLOWERCASE (Strings only) Allows use of lowercase letters, instead of forcing letters to be all-uppercase by default.
8388608 0x00800000 V_FLIP (Patches only) Flips the patch across the X axis (horizontally).
8388608 0x00800000 V_CENTERNAMETAG (Nametags only) Centers the name tag text horizontally.
16777216 0x01000000 V_SNAPTOTOP Text or patches snap to the top edge of the screen in non-green resolutions. This means that the top of the string or patch will remain the same distance from the top edge of the screen as if it were using a green resolution. This flag has no effect if V_NOSCALESTART or any of the scaling flags are set.
33554432 0x02000000 V_SNAPTOBOTTOM Text or patches snap to the bottom edge of the screen in non-green resolutions. This means that the bottom of the string or patch will remain the same distance from the bottom edge of the screen as if it were using a green resolution. This flag has priority over V_SNAPTOTOP. This flag has no effect if V_NOSCALESTART or any of the scaling flags are set.
67108864 0x04000000 V_SNAPTOLEFT Text or patches snap to the left edge of the screen in non-green resolutions. This means that the left end of the string or patch will remain the same distance from the left edge of the screen as if it were using a green resolution, and text will be left-aligned. This flag has no effect if V_NOSCALESTART or any of the scaling flags are set.
134217728 0x08000000 V_SNAPTORIGHT Text or patches snap to the right edge of the screen in non-green resolutions. This means that the right end of the string or patch will remain the same distance from the right edge of the screen as if it were using a green resolution, and text will be right-aligned. This flag has priority over V_SNAPTOLEFT. This flag has no effect if V_NOSCALESTART or any of the scaling flags are set.
268435456 0x10000000 V_AUTOFADEOUT Makes cecho text automatically fade out before disappearing. Does not have any effect for non-cecho text or patches.
536870912 0x20000000 V_RETURN8 Line breaks in text move the start of the next line of text down by 8 pixels rather than 12. Since text characters are normally 8 characters tall, this means lines of text will have no distance between them vertically. This has no effect for patches.
1073741824 0x40000000 V_NOSCALESTART Do not scale the text or patch's starting position, i.e., the top-left corner of the text/patch. This will cause it to be placed as if the resolution was the default of 320×200, while still retaining the size of the text/patch for the resolution currently being used, assuming V_NOSCALEPATCH is not being used. This causes the text/patch to be in the top-left in higher resolutions. Generally not recommended because the resulting appearance will vary depending on the resolution used. Patch offsets will also not be scaled.

If this flag is set, the flags V_SNAPTOTOP, V_SNAPTOBOTTOM, V_SNAPTOLEFT and V_SNAPTORIGHT will have no effect.

2147483648 0x80000000 V_PERPLAYER In Splitscreen mode, text and patches will automatically adjust coordinates and scaling to fit on-screen.

Bit-shifts

These constants are used to bit-shift integer values to the bits for specific types of video flags, or to shift the flags back down to their integer values:

Name Value Description
V_CHARCOLORSHIFT 12 Number of bits to shift up to convert integers 1–16 to the color flags V_PURPLEMAPV_INVERTMAP, or the number of bits to shift down for vice versa.

Example: 1<<V_CHARCOLORSHIFT is V_MAGENTAMAP, and V_MAGENTAMAP>>V_CHARCOLORSHIFT is 1.

V_ALPHASHIFT 16 Number of bits to shift up to convert integers 1–9 to the alpha flags V_10TRANSV_90TRANS and integers 10–12 to the alpha flags V_HUDTRANSHALFV_HUDTRANSDOUBLE, or the number of bits to shift down for vice versa.

Example: 1<<V_ALPHASHIFT is V_10TRANS, and V_10TRANS>>V_ALPHASHIFT is 1.

V_BLENDSHIFT 20 Number of bits to shift up to convert integers 1–4 to the blending mode flags V_ADD, V_SUBTRACT, V_REVERSESUBTRACT and V_MODULATE, or the number of bits to shift down for vice versa.

Example: 1<<V_BLENDSHIFT is V_ADD, and V_ADD>>V_BLENDSHIFT is 1.