0x00451189
| 82 | |
| 83 | // 0x00451189 |
| 84 | static Ui::Point loopNewline(TextDrawingState& drawState, DrawingContext& ctx, const RenderTarget* rt, Ui::Point origin, const char* str) |
| 85 | { |
| 86 | Ui::Point pos = origin; |
| 87 | while (true) |
| 88 | { |
| 89 | // When off-screen in y dimension don't draw text |
| 90 | // In original this check only performed if pos.y updated instead of every loop |
| 91 | bool offscreen = true; |
| 92 | if (pos.y + 19 > rt->y) |
| 93 | { |
| 94 | if (rt->y + rt->height > pos.y) |
| 95 | { |
| 96 | offscreen = false; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | const auto chr = static_cast<uint8_t>(*str); |
| 101 | str++; |
| 102 | |
| 103 | switch (chr) |
| 104 | { |
| 105 | case 0U: |
| 106 | return pos; |
| 107 | |
| 108 | case ControlCodes::adjustPalette: |
| 109 | // This control character does not appear in the localisation files |
| 110 | assert(false); |
| 111 | str++; |
| 112 | break; |
| 113 | |
| 114 | case ControlCodes::newlineSmaller: |
| 115 | pos.x = origin.x; |
| 116 | pos.y += getSmallerLineHeight(drawState.font); |
| 117 | break; |
| 118 | |
| 119 | case ControlCodes::newline: |
| 120 | pos.x = origin.x; |
| 121 | pos.y += getLineHeight(drawState.font); |
| 122 | break; |
| 123 | |
| 124 | case ControlCodes::moveX: |
| 125 | { |
| 126 | uint8_t offset = *str; |
| 127 | str++; |
| 128 | pos.x = origin.x + offset; |
| 129 | |
| 130 | break; |
| 131 | } |
| 132 | |
| 133 | case ControlCodes::newlineXY: |
| 134 | { |
| 135 | uint8_t offset = *str; |
| 136 | str++; |
| 137 | pos.x = origin.x + offset; |
| 138 | |
| 139 | offset = *str; |
| 140 | str++; |
| 141 | pos.y = origin.y + offset; |
no test coverage detected