| 188 | } |
| 189 | |
| 190 | void DrawHelp(const Surface &out) |
| 191 | { |
| 192 | DrawSTextHelp(); |
| 193 | DrawQTextBack(out); |
| 194 | |
| 195 | const int lineHeight = LineHeight(); |
| 196 | const int blankLineHeight = BlankLineHeight(); |
| 197 | |
| 198 | string_view title; |
| 199 | if (gbIsHellfire) |
| 200 | title = gbIsSpawn ? _("Shareware Hellfire Help") : _("Hellfire Help"); |
| 201 | else |
| 202 | title = gbIsSpawn ? _("Shareware Diablo Help") : _("Diablo Help"); |
| 203 | |
| 204 | const Point uiPosition = GetUIRectangle().position; |
| 205 | const int sx = uiPosition.x + PaddingLeft; |
| 206 | const int sy = uiPosition.y; |
| 207 | |
| 208 | DrawString(out, title, |
| 209 | { { sx, sy + PaddingTop + blankLineHeight }, { ContentTextWidth, lineHeight } }, |
| 210 | { UiFlags::ColorWhitegold | UiFlags::AlignCenter }); |
| 211 | |
| 212 | const int titleBottom = sy + HeaderHeight(); |
| 213 | DrawSLine(out, titleBottom); |
| 214 | |
| 215 | const int numLines = NumVisibleLines(); |
| 216 | const int contentY = titleBottom + DividerLineMarginY() + ContentPaddingY(); |
| 217 | for (int i = 0; i < numLines; i++) { |
| 218 | const string_view line = HelpTextLines[i + SkipLines]; |
| 219 | if (line.empty()) { |
| 220 | continue; |
| 221 | } |
| 222 | |
| 223 | int offset = 0; |
| 224 | UiFlags style = UiFlags::ColorWhite; |
| 225 | if (line[0] == '$') { |
| 226 | offset = 1; |
| 227 | style = UiFlags::ColorBlue; |
| 228 | } |
| 229 | |
| 230 | DrawString(out, line.substr(offset), { { sx, contentY + i * lineHeight }, { ContentTextWidth, lineHeight } }, { style, /*spacing=*/1, lineHeight }); |
| 231 | } |
| 232 | |
| 233 | DrawString(out, _("Press ESC to end or the arrow keys to scroll."), |
| 234 | { { sx, contentY + ContentsTextHeight() + ContentPaddingY() + blankLineHeight }, { ContentTextWidth, lineHeight } }, |
| 235 | { UiFlags::ColorWhitegold | UiFlags::AlignCenter }); |
| 236 | |
| 237 | DrawHelpSlider(out); |
| 238 | } |
| 239 | |
| 240 | void DisplayHelp() |
| 241 | { |
no test coverage detected