diff --git a/sc2/src/sc2code/confirm.c b/sc2/src/sc2code/confirm.c index 57a1061b6..777fd96fd 100644 --- a/sc2/src/sc2code/confirm.c +++ b/sc2/src/sc2code/confirm.c @@ -30,6 +30,7 @@ DrawConfirmationWindow (BOOLEAN answer) { COLOR oldfg = SetContextForeGroundColor (MENU_BACKGROUND_COLOR); FONT oldfont = SetContextFont (StarConFont); + FONTEFFECT oldFontEffect = SetContextFontEffect (0, 0, 0); RECT r; TEXT t; BatchGraphics (); @@ -85,6 +86,7 @@ DrawConfirmationWindow (BOOLEAN answer) UnbatchGraphics (); + SetContextFontEffect (oldFontEffect.type, oldFontEffect.from, oldFontEffect.to); SetContextFont (oldfont); SetContextForeGroundColor (oldfg); } diff --git a/sc2/src/sc2code/libs/gfxlib.h b/sc2/src/sc2code/libs/gfxlib.h index 375bca842..fa7c51636 100644 --- a/sc2/src/sc2code/libs/gfxlib.h +++ b/sc2/src/sc2code/libs/gfxlib.h @@ -215,6 +215,14 @@ extern INTERSECT_CODE BoxIntersect (PRECT pr1, PRECT pr2, PRECT printer); extern void BoxUnion (PRECT pr1, PRECT pr2, PRECT punion); +typedef struct +{ + BOOLEAN Use; + DWORD from; + DWORD to; + BYTE type; +} FONTEFFECT; + #endif /* _GFXLIB_H */ @@ -266,7 +274,7 @@ extern DWORD LoadCelFile (PVOID pStr); extern DWORD LoadGraphicInstance (DWORD res); extern DWORD LoadGraphic (DWORD res); extern DRAWABLE LoadDisplayPixmap (PRECT area, FRAME frame); -extern void SetContextFontEffect (BYTE type, DWORD from, DWORD to); +extern FONTEFFECT SetContextFontEffect (BYTE type, DWORD from, DWORD to); extern FONT SetContextFont (FONT Font); extern BOOLEAN DestroyFont (FONT_REF FontRef); extern FONT CaptureFont (FONT_REF FontRef); diff --git a/sc2/src/sc2code/libs/graphics/font.c b/sc2/src/sc2code/libs/graphics/font.c index 991f488ae..4c5e541aa 100644 --- a/sc2/src/sc2code/libs/graphics/font.c +++ b/sc2/src/sc2code/libs/graphics/font.c @@ -22,15 +22,14 @@ extern FRAME Build_Font_Effect (FRAME FramePtr, DWORD from, DWORD to, BYTE type); static BYTE char_delta_array[MAX_DELTAS]; -static struct { - BOOLEAN Use; - DWORD from; - DWORD to; - BYTE type; -} FontEffect = {0,0,0,0}; -void SetContextFontEffect (BYTE type, DWORD from, DWORD to) +static FONTEFFECT FontEffect = {0,0,0,0}; + +FONTEFFECT +SetContextFontEffect (BYTE type, DWORD from, DWORD to) { + FONTEFFECT oldFontEffect = FontEffect; + if (from == to) FontEffect.Use = 0; else @@ -40,6 +39,13 @@ void SetContextFontEffect (BYTE type, DWORD from, DWORD to) FontEffect.to = to; FontEffect.type = type; } + + if (!oldFontEffect.Use) + // reset fields so that when struct passed back + // the logic works correctly + oldFontEffect.to = oldFontEffect.from = 0; + + return oldFontEffect; }