2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 /** @file control_codes.h Control codes that are embedded in the translation strings. */
10 #ifndef CONTROL_CODES_H
11 #define CONTROL_CODES_H
14 * List of string control codes used for string formatting, displaying, and
15 * by strgen to generate the language files.
17 enum StringControlCode
{
18 SCC_CONTROL_START
= 0xE000,
19 SCC_CONTROL_END
= 0xE1FF,
21 SCC_SPRITE_START
= 0xE200,
22 SCC_SPRITE_END
= SCC_SPRITE_START
+ 0xFF,
24 /* This must be the first entry. It's encoded in strings that are saved. */
25 SCC_ENCODED
= SCC_CONTROL_START
,
27 /* Font selection codes, must be in same order as FontSize enum */
29 SCC_NORMALFONT
= SCC_FIRST_FONT
, ///< Switch to normal size font
30 SCC_TINYFONT
, ///< Switch to small font
31 SCC_BIGFONT
, ///< Switch to large font
32 SCC_MONOFONT
, ///< Switch to monospaced font
33 SCC_LAST_FONT
= SCC_MONOFONT
,
35 /* Formatting control codes */
72 /* Must be consecutive */
90 SCC_RAW_STRING_POINTER
,
120 * The next variables are part of a NewGRF subsystem for creating text strings.
121 * It uses a "stack" of bytes and reads from there.
124 SCC_NEWGRF_PRINT_DWORD_SIGNED
= SCC_NEWGRF_FIRST
, ///< 7B: Read 4 bytes from the stack
125 SCC_NEWGRF_PRINT_WORD_SIGNED
, ///< 7C: Read 2 bytes from the stack as signed value
126 SCC_NEWGRF_PRINT_BYTE_SIGNED
, ///< 7D: Read 1 byte from the stack as signed value
127 SCC_NEWGRF_PRINT_WORD_UNSIGNED
, ///< 7E: Read 2 bytes from the stack as unsigned value
128 SCC_NEWGRF_PRINT_DWORD_CURRENCY
, ///< 8F: Read 4 bytes from the stack as currency
129 SCC_NEWGRF_PRINT_WORD_STRING_ID
, ///< 81: Read 2 bytes from the stack as String ID
130 SCC_NEWGRF_PRINT_WORD_DATE_LONG
, ///< 82: Read 2 bytes from the stack as base 1920 date
131 SCC_NEWGRF_PRINT_WORD_DATE_SHORT
, ///< 83: Read 2 bytes from the stack as base 1920 date
132 SCC_NEWGRF_PRINT_WORD_SPEED
, ///< 84: Read 2 bytes from the stack as signed speed
133 SCC_NEWGRF_PRINT_WORD_VOLUME_LONG
, ///< 87: Read 2 bytes from the stack as long signed volume
134 SCC_NEWGRF_PRINT_WORD_WEIGHT_LONG
, ///< 9A 0D: Read 2 bytes from the stack as long unsigned weight
135 SCC_NEWGRF_PRINT_WORD_STATION_NAME
, ///< 9A 0C: Read 2 bytes from the stack as station name
136 SCC_NEWGRF_PRINT_QWORD_CURRENCY
, ///< 9A 01: Read 8 bytes from the stack as currency
137 SCC_NEWGRF_PRINT_BYTE_HEX
, ///< 9A 06: Read 1 byte from the stack and print it as hex
138 SCC_NEWGRF_PRINT_WORD_HEX
, ///< 9A 07: Read 2 bytes from the stack and print it as hex
139 SCC_NEWGRF_PRINT_DWORD_HEX
, ///< 9A 08: Read 4 bytes from the stack and print it as hex
140 SCC_NEWGRF_PRINT_QWORD_HEX
, ///< 9A 0B: Read 8 bytes from the stack and print it as hex
141 SCC_NEWGRF_PRINT_DWORD_DATE_LONG
, ///< 9A 16: Read 4 bytes from the stack as base 0 date
142 SCC_NEWGRF_PRINT_DWORD_DATE_SHORT
, ///< 9A 17: Read 4 bytes from the stack as base 0 date
143 SCC_NEWGRF_PRINT_WORD_POWER
, ///< 9A 18: Read 2 bytes from the stack as unsigned power
144 SCC_NEWGRF_PRINT_WORD_VOLUME_SHORT
, ///< 9A 19: Read 2 bytes from the stack as short signed volume
145 SCC_NEWGRF_PRINT_WORD_WEIGHT_SHORT
, ///< 9A 1A: Read 2 bytes from the stack as short unsigned weight
146 SCC_NEWGRF_PRINT_WORD_CARGO_LONG
, ///< 9A 1B: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
147 SCC_NEWGRF_PRINT_WORD_CARGO_SHORT
, ///< 9A 1C: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
148 SCC_NEWGRF_PRINT_WORD_CARGO_TINY
, ///< 9A 1D: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
149 SCC_NEWGRF_PRINT_WORD_CARGO_NAME
, ///< 9A 1E: Read 2 bytes from the stack as cargo name
150 SCC_NEWGRF_PUSH_WORD
, ///< 9A 03: Pushes 2 bytes onto the stack
151 SCC_NEWGRF_UNPRINT
, ///< 9A 04: "Unprints" the given number of bytes from the string
152 SCC_NEWGRF_DISCARD_WORD
, ///< 85: Discard the next two bytes
153 SCC_NEWGRF_ROTATE_TOP_4_WORDS
, ///< 86: Rotate the top 4 words of the stack (W4 W1 W2 W3)
154 SCC_NEWGRF_LAST
= SCC_NEWGRF_ROTATE_TOP_4_WORDS
,
156 SCC_NEWGRF_STRINL
, ///< Inline another string at the current position, StringID is encoded in the string
158 /* Special printable symbols.
159 * These are mapped to the original glyphs */
160 SCC_LESS_THAN
= SCC_SPRITE_START
+ 0x3C,
161 SCC_GREATER_THAN
= SCC_SPRITE_START
+ 0x3E,
162 SCC_UP_ARROW
= SCC_SPRITE_START
+ 0xA0,
163 SCC_DOWN_ARROW
= SCC_SPRITE_START
+ 0xAA,
164 SCC_CHECKMARK
= SCC_SPRITE_START
+ 0xAC,
165 SCC_CROSS
= SCC_SPRITE_START
+ 0xAD,
166 SCC_RIGHT_ARROW
= SCC_SPRITE_START
+ 0xAF,
167 SCC_TRAIN
= SCC_SPRITE_START
+ 0xB4,
168 SCC_LORRY
= SCC_SPRITE_START
+ 0xB5,
169 SCC_BUS
= SCC_SPRITE_START
+ 0xB6,
170 SCC_PLANE
= SCC_SPRITE_START
+ 0xB7,
171 SCC_SHIP
= SCC_SPRITE_START
+ 0xB8,
172 SCC_SUPERSCRIPT_M1
= SCC_SPRITE_START
+ 0xB9,
173 SCC_SMALL_UP_ARROW
= SCC_SPRITE_START
+ 0xBC,
174 SCC_SMALL_DOWN_ARROW
= SCC_SPRITE_START
+ 0xBD,
177 #endif /* CONTROL_CODES_H */