deobfuscate the font transparency flag

This commit is contained in:
jirik2077
2026-07-18 00:09:13 +02:00
parent 33744ecf2e
commit 47156d2e45
8 changed files with 34 additions and 33 deletions
+2 -2
View File
@@ -627,10 +627,10 @@ static void automapRenderInMapWindow(int window, int elevation, unsigned char* b
if (mapGetCurrentMap() != -1) {
char* areaName = mapGetCityName(mapGetCurrentMap());
windowDrawText(window, areaName, 240, 150, 380, textColor | 0x2000000);
windowDrawText(window, areaName, 240, 150, 380, textColor | FONT_TRANSPARENT_BACKGROUND);
char* mapName = mapGetName(mapGetCurrentMap(), elevation);
windowDrawText(window, mapName, 240, 150, 396, textColor | 0x2000000);
windowDrawText(window, mapName, 240, 150, 396, textColor | FONT_TRANSPARENT_BACKGROUND);
}
windowRefresh(window);
+19 -19
View File
@@ -1150,7 +1150,7 @@ void gameDialogRenderSupplementaryMessage(const char* msg)
&textOffset,
lineHeight,
379,
COLOR_GREEN | 0x2000000);
COLOR_GREEN | FONT_TRANSPARENT_BACKGROUND);
windowShow(_gd_replyWin);
windowRefresh(gGameDialogReplyWindow);
@@ -1670,7 +1670,7 @@ void gameDialogReviewWindowUpdate(int win, int origin)
char name[60];
snprintf(name, sizeof(name), "%s:", objectGetName(gGameDialogSpeaker));
windowDrawText(win, name, 180, 88, y, COLOR_GREEN | 0x2000000);
windowDrawText(win, name, 180, 88, y, COLOR_GREEN | FONT_TRANSPARENT_BACKGROUND);
entriesRect.top += entrySpacing;
char* replyText;
@@ -1692,7 +1692,7 @@ void gameDialogReviewWindowUpdate(int win, int origin)
nullptr,
fontGetLineHeight(),
640,
COLOR_LIGHT_GREEN_3 | 0x2000000);
COLOR_LIGHT_GREEN_3 | FONT_TRANSPARENT_BACKGROUND);
// SFALL: Cosmetic fix to the dialog review interface to prevent the
// player name from being displayed at the bottom of the window when the
@@ -1703,7 +1703,7 @@ void gameDialogReviewWindowUpdate(int win, int origin)
if (dialogReviewEntry->optionMessageListId != -3) {
snprintf(name, sizeof(name), "%s:", objectGetName(gDude));
windowDrawText(win, name, 180, 88, y, COLOR_LIGHT_GREY | 0x2000000);
windowDrawText(win, name, 180, 88, y, COLOR_LIGHT_GREY | FONT_TRANSPARENT_BACKGROUND);
entriesRect.top += entrySpacing;
char* optionText;
@@ -1725,7 +1725,7 @@ void gameDialogReviewWindowUpdate(int win, int origin)
nullptr,
fontGetLineHeight(),
640,
COLOR_GREY_2 | 0x2000000);
COLOR_GREY_2 | FONT_TRANSPARENT_BACKGROUND);
}
if (y >= 407) {
@@ -2256,17 +2256,17 @@ void gameDialogOptionOnMouseEnter(int index)
_optionRect.left = 5;
_optionRect.right = 388;
int color = COLOR_LIGHT_YELLOW | 0x2000000;
int color = COLOR_LIGHT_YELLOW | FONT_TRANSPARENT_BACKGROUND;
if (perkHasRank(gDude, PERK_EMPATHY)) {
color = COLOR_LIGHT_YELLOW | 0x2000000;
color = COLOR_LIGHT_YELLOW | FONT_TRANSPARENT_BACKGROUND;
switch (dialogOptionEntry->reaction) {
case GAME_DIALOG_REACTION_GOOD:
color = COLOR_MAGENTA | 0x2000000;
color = COLOR_MAGENTA | FONT_TRANSPARENT_BACKGROUND;
break;
case GAME_DIALOG_REACTION_NEUTRAL:
break;
case GAME_DIALOG_REACTION_BAD:
color = COLOR_LIGHT_RED | 0x2000000;
color = COLOR_LIGHT_RED | FONT_TRANSPARENT_BACKGROUND;
break;
default:
debugPrint("\nError: dialog: Empathy Perk: invalid reaction!");
@@ -2300,18 +2300,18 @@ void gameDialogOptionOnMouseExit(int index)
_optionRect.bottom = dialogOptionEntry->bottom;
_gDialogRefreshOptionsRect(gGameDialogOptionsWindow, &_optionRect);
int color = COLOR_GREEN | 0x2000000;
int color = COLOR_GREEN | FONT_TRANSPARENT_BACKGROUND;
if (perkGetRank(gDude, PERK_EMPATHY) != 0) {
color = COLOR_LIGHT_YELLOW | 0x2000000;
color = COLOR_LIGHT_YELLOW | FONT_TRANSPARENT_BACKGROUND;
switch (dialogOptionEntry->reaction) {
case GAME_DIALOG_REACTION_GOOD:
color = COLOR_BLUE | 0x2000000;
color = COLOR_BLUE | FONT_TRANSPARENT_BACKGROUND;
break;
case GAME_DIALOG_REACTION_NEUTRAL:
color = COLOR_GREEN | 0x2000000;
color = COLOR_GREEN | FONT_TRANSPARENT_BACKGROUND;
break;
case GAME_DIALOG_REACTION_BAD:
color = COLOR_RED | 0x2000000;
color = COLOR_RED | FONT_TRANSPARENT_BACKGROUND;
break;
default:
debugPrint("\nError: dialog: Empathy Perk: invalid reaction!");
@@ -2357,7 +2357,7 @@ void gameDialogRenderReply()
&gDialogReplyTextOffset,
fontGetLineHeight(),
379,
COLOR_GREEN | 0x2000000);
COLOR_GREEN | FONT_TRANSPARENT_BACKGROUND);
windowRefresh(gGameDialogReplyWindow);
}
@@ -2390,7 +2390,7 @@ void _gdProcessUpdate()
gameDialogRenderReply();
int color = COLOR_GREEN | 0x2000000;
int color = COLOR_GREEN | FONT_TRANSPARENT_BACKGROUND;
bool hasEmpathy = perkGetRank(gDude, PERK_EMPATHY) != 0;
@@ -2406,13 +2406,13 @@ void _gdProcessUpdate()
if (hasEmpathy) {
switch (dialogOptionEntry->reaction) {
case GAME_DIALOG_REACTION_GOOD:
color = COLOR_BLUE | 0x2000000;
color = COLOR_BLUE | FONT_TRANSPARENT_BACKGROUND;
break;
case GAME_DIALOG_REACTION_NEUTRAL:
color = COLOR_GREEN | 0x2000000;
color = COLOR_GREEN | FONT_TRANSPARENT_BACKGROUND;
break;
case GAME_DIALOG_REACTION_BAD:
color = COLOR_RED | 0x2000000;
color = COLOR_RED | FONT_TRANSPARENT_BACKGROUND;
break;
default:
debugPrint("\nError: dialog: Empathy Perk: invalid reaction!");
+1 -1
View File
@@ -257,7 +257,7 @@ void opSelectFileList(Program* program)
nullptr,
320 - fontGetStringWidth(title) / 2,
200,
COLOR_WHITE | 0x10000);
COLOR_WHITE | FONT_SHADOW);
if (selectedIndex != -1) {
programStackPushString(program, fileList[selectedIndex]);
+1 -1
View File
@@ -669,7 +669,7 @@ static void movieRenderSubtitles()
}
int colorIndex = (gMovieSubtitlesColorR << 10) | (gMovieSubtitlesColorG << 5) | gMovieSubtitlesColorB;
windowWrapLine(gMovieWindow, gMovieSubtitleHead->text, subtitleW, subtitleHeight, subtitleX, subtitleY, _colorTable[colorIndex] | 0x2000000, TEXT_ALIGNMENT_CENTER);
windowWrapLine(gMovieWindow, gMovieSubtitleHead->text, subtitleW, subtitleHeight, subtitleX, subtitleY, _colorTable[colorIndex] | FONT_TRANSPARENT_BACKGROUND, TEXT_ALIGNMENT_CENTER);
Rect rect;
rect.right = subtitleX + subtitleW - 1;
+1
View File
@@ -34,6 +34,7 @@ typedef struct FontManager {
#define FONT_SHADOW (0x10000)
#define FONT_UNDERLINE (0x20000)
#define FONT_MONO (0x40000)
#define FONT_TRANSPARENT_BACKGROUND (0x2000000)
extern FontManager gTextFontManager;
extern int gCurrentFont;
+4 -4
View File
@@ -240,7 +240,7 @@ void scriptWindowResetTextAttributes()
scriptWindowSetTextColor(1.0, 1.0, 1.0);
// NOTE: Uninline.
scriptWindowSetTextFlags(0x2000000 | 0x10000);
scriptWindowSetTextFlags(FONT_TRANSPARENT_BACKGROUND | FONT_SHADOW);
}
// 0x4B6160
@@ -1113,7 +1113,7 @@ void windowPrintBuf(int win, char* string, int stringLength, int width, int maxY
stringHeight = windowGetHeight(win) - y;
}
if ((flags & 0x2000000) != 0) {
if ((flags & FONT_TRANSPARENT_BACKGROUND) != 0) {
blitBufferToBufferTrans(backgroundBufferPtr, width, stringHeight, stringWidth, windowGetBuffer(win) + windowGetWidth(win) * y + x, windowGetWidth(win));
} else {
blitBufferToBuffer(backgroundBufferPtr, width, stringHeight, stringWidth, windowGetBuffer(win) + windowGetWidth(win) * y + x, windowGetWidth(win));
@@ -1250,7 +1250,7 @@ bool scriptWindowPrintRect(char* string, int wrapWidth, int textAlignment)
int height = windowGetHeight(managedWindow->window);
int x = managedWindow->cursorX;
int y = managedWindow->cursorY;
int flags = scriptWindowGetTextColor() | 0x2000000;
int flags = scriptWindowGetTextColor() | FONT_TRANSPARENT_BACKGROUND;
windowWrapLineWithSpacing(managedWindow->window, string, width, height, x, y, flags, textAlignment, 0);
return true;
@@ -1264,7 +1264,7 @@ bool scriptWindowFormatMessage(char* string, int x, int y, int width, int height
}
ManagedWindow* managedWindow = &(gManagedWindows[gCurrentManagedWindowIndex]);
int flags = scriptWindowGetTextColor() | 0x2000000;
int flags = scriptWindowGetTextColor() | FONT_TRANSPARENT_BACKGROUND;
windowWrapLineWithSpacing(managedWindow->window, string, width, height, x, y, flags, textAlignment, 0);
return true;
+5 -5
View File
@@ -205,7 +205,7 @@ int _win_list_select_at(const char* title, const char* const* items, int itemsLe
listViewWidth,
listViewX,
listViewY,
color | 0x2000000);
color | FONT_TRANSPARENT_BACKGROUND);
_lighten_buf(listViewBuffer + windowWidth * selectedItemIndex * fontGetLineHeight(),
listViewWidth,
@@ -461,7 +461,7 @@ int _win_list_select_at(const char* title, const char* const* items, int itemsLe
listViewWidth,
listViewX,
listViewY,
color | 0x2000000);
color | FONT_TRANSPARENT_BACKGROUND);
_lighten_buf(listViewBuffer + windowWidth * selectedItemIndex * fontGetLineHeight(),
listViewWidth,
@@ -841,7 +841,7 @@ int _win_debug(const char* string)
0,
(winWidth - fontGetStringWidth("Debug")) / 2,
8,
0x2000000 | 0x100 | 4);
FONT_TRANSPARENT_BACKGROUND | 0x100 | 4);
bufferDrawRectShadowed(windowBuffer,
winWidth,
@@ -918,7 +918,7 @@ int _win_debug(const char* string)
if (*pch != '\n') {
temp[0] = *pch;
windowDrawText(_wd, temp, 0, _currx, _curry, 0x2000000 | 0x100 | 4);
windowDrawText(_wd, temp, 0, _currx, _curry, FONT_TRANSPARENT_BACKGROUND | 0x100 | 4);
_currx += characterWidth + fontGetLetterSpacing();
}
@@ -1028,7 +1028,7 @@ int _win_register_menu_pulldown(int win, int x, const char* title, int keyCode,
return -1;
}
windowDrawText(win, title, 0, titleX, titleY, window->menuBar->foregroundColor | 0x2000000);
windowDrawText(win, title, 0, titleX, titleY, window->menuBar->foregroundColor | FONT_TRANSPARENT_BACKGROUND);
MenuPulldown* pulldown = &(window->menuBar->pulldowns[window->menuBar->pulldownsLength]);
pulldown->rect.left = titleX;
+1 -1
View File
@@ -6300,7 +6300,7 @@ static int wmTownMapRefresh()
width,
wmGenData.hotspotNormalFrmImage.getWidth() / 2 + entrance->x - width / 2,
wmGenData.hotspotNormalFrmImage.getHeight() + entrance->y + 4,
COLOR_GREEN | 0x2000000 | FONT_SHADOW);
COLOR_GREEN | FONT_TRANSPARENT_BACKGROUND | FONT_SHADOW);
}
}
}