summaryrefslogtreecommitdiff
path: root/src/gfx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gfx.cpp')
-rw-r--r--src/gfx.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index c915b38f5..ecbf97048 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -495,10 +495,10 @@ int DoDrawString(const char *string, int x, int y, uint16 real_color)
DrawPixelInfo *dpi = _cur_dpi;
FontSize size = _cur_fontsize;
WChar c;
- byte color;
int xo = x, yo = y;
- color = real_color & 0xFF;
+ byte color = real_color & 0xFF;
+ byte previous_color = color;
if (color != 0xFE) {
if (x >= dpi->left + dpi->width ||
@@ -548,8 +548,12 @@ skip_cont:;
y += GetCharacterHeight(size);
goto check_bounds;
} else if (c >= SCC_BLUE && c <= SCC_BLACK) { // change color?
+ previous_color = color;
color = (byte)(c - SCC_BLUE);
goto switch_color;
+ } else if (c == SCC_PREVIOUS_COLOUR) { // revert to the previous color
+ Swap(color, previous_color);
+ goto switch_color;
} else if (c == SCC_SETX) { // {SETX}
x = xo + (byte)*string++;
} else if (c == SCC_SETXY) {// {SETXY}