Review windowShow

This commit is contained in:
Alexander Batalov 2022-12-13 10:37:52 +03:00
parent 029a84a113
commit b36ac50425
8 changed files with 35 additions and 34 deletions

View File

@ -1172,7 +1172,7 @@ static void showHelp()
if (backgroundFrmImage.lock(backgroundFid)) { if (backgroundFrmImage.lock(backgroundFid)) {
paletteSetEntries(gPaletteBlack); paletteSetEntries(gPaletteBlack);
blitBufferToBuffer(backgroundFrmImage.getData(), HELP_SCREEN_WIDTH, HELP_SCREEN_HEIGHT, HELP_SCREEN_WIDTH, windowBuffer, HELP_SCREEN_WIDTH); blitBufferToBuffer(backgroundFrmImage.getData(), HELP_SCREEN_WIDTH, HELP_SCREEN_HEIGHT, HELP_SCREEN_WIDTH, windowBuffer, HELP_SCREEN_WIDTH);
windowUnhide(win); windowShow(win);
colorPaletteLoad("art\\intrface\\helpscrn.pal"); colorPaletteLoad("art\\intrface\\helpscrn.pal");
paletteSetEntries(_cmap); paletteSetEntries(_cmap);

View File

@ -1058,7 +1058,7 @@ void gameDialogRenderSupplementaryMessage(char* msg)
379, 379,
_colorTable[992] | 0x2000000); _colorTable[992] | 0x2000000);
windowUnhide(_gd_replyWin); windowShow(_gd_replyWin);
windowRefresh(gGameDialogReplyWindow); windowRefresh(gGameDialogReplyWindow);
} }
@ -1236,11 +1236,11 @@ static int gdHide()
static int gdUnhide() static int gdUnhide()
{ {
if (_gd_replyWin != -1) { if (_gd_replyWin != -1) {
windowUnhide(_gd_replyWin); windowShow(_gd_replyWin);
} }
if (_gd_optionsWin != -1) { if (_gd_optionsWin != -1) {
windowUnhide(_gd_optionsWin); windowShow(_gd_optionsWin);
} }
return 0; return 0;

View File

@ -797,7 +797,7 @@ void _intface_show()
interfaceUpdateItems(false, INTERFACE_ITEM_ACTION_DEFAULT, INTERFACE_ITEM_ACTION_DEFAULT); interfaceUpdateItems(false, INTERFACE_ITEM_ACTION_DEFAULT, INTERFACE_ITEM_ACTION_DEFAULT);
interfaceRenderHitPoints(false); interfaceRenderHitPoints(false);
interfaceRenderArmorClass(false); interfaceRenderArmorClass(false);
windowUnhide(gInterfaceBarWindow); windowShow(gInterfaceBarWindow);
sidePanelsShow(); sidePanelsShow();
_intfaceHidden = false; _intfaceHidden = false;
} }
@ -2577,11 +2577,11 @@ static void sidePanelsHide()
static void sidePanelsShow() static void sidePanelsShow()
{ {
if (gInterfaceSidePanelsLeadingWindow != -1) { if (gInterfaceSidePanelsLeadingWindow != -1) {
windowUnhide(gInterfaceSidePanelsLeadingWindow); windowShow(gInterfaceSidePanelsLeadingWindow);
} }
if (gInterfaceSidePanelsTrailingWindow != -1) { if (gInterfaceSidePanelsTrailingWindow != -1) {
windowUnhide(gInterfaceSidePanelsTrailingWindow); windowShow(gInterfaceSidePanelsTrailingWindow);
} }
} }

View File

@ -995,7 +995,7 @@ static void mainMenuWindowUnhide(bool animate)
return; return;
} }
windowUnhide(gMainMenuWindow); windowShow(gMainMenuWindow);
if (animate) { if (animate) {
colorPaletteLoad("color.pal"); colorPaletteLoad("color.pal");

View File

@ -300,7 +300,7 @@ void _map_init()
mapNewMap(); mapNewMap();
tickersAdd(gameMouseRefresh); tickersAdd(gameMouseRefresh);
_gmouse_disable(0); _gmouse_disable(0);
windowUnhide(gIsoWindow); windowShow(gIsoWindow);
messageListRepositorySetStandardMessageList(STANDARD_MESSAGE_LIST_MAP, &gMapMessageList); messageListRepositorySetStandardMessageList(STANDARD_MESSAGE_LIST_MAP, &gMapMessageList);
} }

View File

@ -470,7 +470,7 @@ int _scriptsCheckGameEvents(int* moviePtr, int window)
gameMoviePlay(movie, movieFlags); gameMoviePlay(movie, movieFlags);
if (window != -1) { if (window != -1) {
windowUnhide(window); windowShow(window);
} }
if (adjustRep) { if (adjustRep) {

View File

@ -657,40 +657,41 @@ void windowFill(int win, int x, int y, int width, int height, int a6)
} }
// 0x4D6DAC // 0x4D6DAC
void windowUnhide(int win) void windowShow(int win)
{ {
Window* window; Window* window = windowGetWindow(win);
int v3; int index = gWindowIndexes[window->id];
int v5;
int v7;
Window* v6;
window = windowGetWindow(win);
v3 = gWindowIndexes[window->id];
if (!gWindowSystemInitialized) { if (!gWindowSystemInitialized) {
return; return;
} }
if (window->flags & WINDOW_HIDDEN) { if ((window->flags & WINDOW_HIDDEN) != 0) {
window->flags &= ~WINDOW_HIDDEN; window->flags &= ~WINDOW_HIDDEN;
if (v3 == gWindowsLength - 1) { if (index == gWindowsLength - 1) {
_GNW_win_refresh(window, &(window->rect), NULL); _GNW_win_refresh(window, &(window->rect), NULL);
} }
} }
v5 = gWindowsLength - 1; if (index < gWindowsLength - 1 && (window->flags & WINDOW_DONT_MOVE_TOP) == 0) {
if (v3 < v5 && !(window->flags & WINDOW_DONT_MOVE_TOP)) { while (index < gWindowsLength - 1) {
v7 = v3; Window* nextWindow = gWindows[index + 1];
while (v3 < v5 && ((window->flags & WINDOW_MOVE_ON_TOP) || !(gWindows[v7 + 1]->flags & WINDOW_MOVE_ON_TOP))) { if ((window->flags & WINDOW_MOVE_ON_TOP) == 0 && (nextWindow->flags & WINDOW_MOVE_ON_TOP) != 0) {
v6 = gWindows[v7 + 1]; break;
gWindows[v7] = v6;
v7++;
gWindowIndexes[v6->id] = v3++;
} }
gWindows[v3] = window; gWindows[index] = nextWindow;
gWindowIndexes[window->id] = v3; gWindowIndexes[nextWindow->id] = index;
index++;
}
gWindows[index] = window;
gWindowIndexes[window->id] = index;
_GNW_win_refresh(window, &(window->rect), NULL);
} else {
// SFALL: Fix for the window with the "DontMoveTop" flag not being
// redrawn after the show function call if it is not the topmost
// one.
_GNW_win_refresh(window, &(window->rect), NULL); _GNW_win_refresh(window, &(window->rect), NULL);
} }
} }
@ -1016,7 +1017,7 @@ void _win_drag(int win)
return; return;
} }
windowUnhide(win); windowShow(win);
Rect rect; Rect rect;
rectCopy(&rect, &(window->rect)); rectCopy(&rect, &(window->rect));
@ -1741,7 +1742,7 @@ int _GNW_check_buttons(Window* window, int* keyCodePtr)
window->clickedButton = NULL; window->clickedButton = NULL;
} }
} else { } else {
windowUnhide(window->id); windowShow(window->id);
} }
if (prevHoveredButton != NULL) { if (prevHoveredButton != NULL) {

View File

@ -158,7 +158,7 @@ void _win_text(int win, char** fileNameList, int fileNameListLength, int maxWidt
void windowDrawLine(int win, int left, int top, int right, int bottom, int color); void windowDrawLine(int win, int left, int top, int right, int bottom, int color);
void windowDrawRect(int win, int left, int top, int right, int bottom, int color); void windowDrawRect(int win, int left, int top, int right, int bottom, int color);
void windowFill(int win, int x, int y, int width, int height, int a6); void windowFill(int win, int x, int y, int width, int height, int a6);
void windowUnhide(int win); void windowShow(int win);
void windowHide(int win); void windowHide(int win);
void windowRefresh(int win); void windowRefresh(int win);
void windowRefreshRect(int win, const Rect* rect); void windowRefreshRect(int win, const Rect* rect);