Video flags

From SRB2 Wiki
Jump to: navigation, search

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 as 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, their effects 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 the given X/Y positions of the top left corner of text or patches will also be scaled, unless V_NOSCALESTART is given.

These flags do not allow the effects of V_SNAPTOTOP, V_SNAPTOBOTTOM, V_SNAPTOLEFT and V_SNAPTORIGHT to function.

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 the 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 for use 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 1/2 the 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 the 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 in width, all other characters have a width matching their real image width. Old 2.1 style spacing.
2048 0x00000800 V_OLDSPACING All characters are 8 pixels wide, and spaces are 4 pixels wide. This is the spacing previously used by all versions of SRB2 prior to 2.1, and some things (menu options, for one) 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 in specific parts of text rather than all, 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_PURPLEMAP Text is colored purple.
Error creating thumbnail: Unable to save thumbnail to destination
8192 0x00002000 V_YELLOWMAP Text is colored yellow.
Error creating thumbnail: Unable to save thumbnail to destination
12288 0x00003000 V_GREENMAP Text is colored green.
Error creating thumbnail: Unable to save thumbnail to destination
16384 0x00004000 V_BLUEMAP Text is colored blue.
Error creating thumbnail: Unable to save thumbnail to destination
20480 0x00005000 V_REDMAP Text is colored red.
Error creating thumbnail: Unable to save thumbnail to destination
24576 0x00006000 V_GRAYMAP Text is colored gray.
Error creating thumbnail: Unable to save thumbnail to destination
28672 0x00007000 V_ORANGEMAP Text is colored orange.
Error creating thumbnail: Unable to save thumbnail to destination

Alpha

These flags determine the alpha or translucency 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. Note that 0x000A0000, 0x000B0000 and 0x000C0000 will all make the patch/text invisible.

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_TRANSLUCENT
(or V_50TRANS)
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 0x000D0000 V_HUDTRANSHALF Text or patches will be adjusted to be half as opaque (twice as translucent) as the corresponding 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 0x000E0000 V_HUDTRANS Text or patches will be adjusted to the corresponding 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 0x000F0000 V_HUDTRANSDOUBLE Text or patches will be adjusted to be twice as opaque (half as translucent) as the corresponding translucency determined by translucenthud:
  • 0 – Invisible
  • 1 – 80% translucent
  • 2 – 60% translucent
  • 3 – 40% translucent
  • 4 – 20% translucent
  • 5–10 – Opaque

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
1048576 0x00100000 V_AUTOFADEOUT Makes cecho text automatically fade out before disappearing. Does not have any effect for non-cecho text or patches.
2097152 0x00200000 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.
4194304 0x00400000 V_OFFSET Account for the offsets in patches when drawing strings. Does not allow V_FLIP to function.
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). This flag has no effect if V_OFFSET is also applied.
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. It also has no effect in OpenGL mode.
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. It also has no effect in OpenGL mode.
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. It also has no effect in OpenGL mode.
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. It also has no effect in OpenGL mode.
268435456 0x10000000 V_WRAPX Don't clamp texture horizontally in OpenGL mode. This flag has no effect in Software mode.
536870912 0x20000000 V_WRAPY Don't clamp texture vertically in OpenGL mode. This flag has no effect in Software mode.
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 for use because the resulting appearance will vary depending on the resolution used.

This flag does not allow the effects of V_SNAPTOTOP, V_SNAPTOBOTTOM, V_SNAPTOLEFT and V_SNAPTORIGHT to function.

2147483648 0x80000000 V_SPLITSCREEN Draws text and patches half the screen further downwards than normal, for displaying Player 2's HUD in splitscreen mode.

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–7 to the color flags V_PURPLEMAPV_ORANGEMAP, or the number of bits to shift down for vice versa.

e.g. 1<<V_CHARCOLORSHIFT is V_PURPLEMAP, and V_PURPLEMAP>>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 13–15 to the alpha flags V_HUDTRANSHALFV_HUDTRANSDOUBLE, or the number of bits to shift down for vice versa.

e.g. 1<<V_ALPHASHIFT is V_10TRANS, and V_10TRANS>>V_ALPHASHIFT is 1