0x004950EF
| 1242 | |
| 1243 | // 0x004950EF |
| 1244 | static void drawStringTicker( |
| 1245 | TextDrawingState& drawState, |
| 1246 | DrawingContext& ctx, |
| 1247 | const RenderTarget& rt, |
| 1248 | Ui::Point origin, |
| 1249 | StringId stringId, |
| 1250 | Colour colour, |
| 1251 | uint8_t numLinesToDisplay, |
| 1252 | uint16_t numCharactersToDisplay, |
| 1253 | uint16_t width) |
| 1254 | { |
| 1255 | // Setup the text colours (FIXME: This should be a separate function) |
| 1256 | const auto curDrawState = drawState; |
| 1257 | char empty[1] = ""; |
| 1258 | drawString(drawState, ctx, rt, origin, colour, empty); |
| 1259 | drawState = curDrawState; |
| 1260 | |
| 1261 | char buffer[512]; |
| 1262 | StringManager::formatString(buffer, std::size(buffer), stringId); |
| 1263 | |
| 1264 | const auto numLinesToDisplayAllChars = wrapStringTicker(drawState.font, buffer, width, numCharactersToDisplay); |
| 1265 | const auto lineToDisplayFrom = numLinesToDisplayAllChars - numLinesToDisplay; |
| 1266 | |
| 1267 | // wrapString might change the font due to formatting codes |
| 1268 | uint16_t lineHeight = getLineHeight(drawState.font); // _112D404 |
| 1269 | |
| 1270 | Ui::Point point = origin; |
| 1271 | if (lineToDisplayFrom > 0) |
| 1272 | { |
| 1273 | point.y -= lineHeight * lineToDisplayFrom; |
| 1274 | } |
| 1275 | const char* ptr = buffer; |
| 1276 | |
| 1277 | auto numChars = numCharactersToDisplay; |
| 1278 | for (auto i = 0; ptr != nullptr && i < numLinesToDisplayAllChars; i++) |
| 1279 | { |
| 1280 | uint16_t lineWidth = getStringWidth(drawState.font, ptr); |
| 1281 | |
| 1282 | // special drawstring |
| 1283 | numChars = drawStringMaxChars(drawState, ctx, rt, point - Ui::Point(lineWidth / 2, 0), AdvancedColour::FE(), reinterpret_cast<uint8_t*>(const_cast<char*>(ptr)), numChars); |
| 1284 | ptr = advanceToNextLineWrapped(ptr); |
| 1285 | point.y += lineHeight; |
| 1286 | } |
| 1287 | } |
| 1288 | |
| 1289 | // 0x00495301 |
| 1290 | // Note: Returned break count is -1. TODO: Refactor out this -1. |
no test coverage detected