void GUI_Mentat_ShowHelpList_Close() { free(g_widgetMentatFirst); g_widgetMentatFirst = NULL; Load_Palette_Mercenaries(); GUI_Widget_Free_WithScrollbar(g_widgetMentatScrollbar); g_widgetMentatScrollbar = NULL; free(g_widgetMentatScrollUp); g_widgetMentatScrollUp = NULL; free(g_widgetMentatScrollDown); g_widgetMentatScrollDown = NULL; Input_Flags_ClearBits(INPUT_FLAG_KEY_REPEAT); GFX_Screen_SetActive(GUI_Mentat_ShowHelpList_oldScreenID); }
/** * Shows the Help window. * @param proceed Display a "Proceed" button if true, "Exit" otherwise. */ static void GUI_Mentat_ShowHelpList(bool proceed) { Screen oldScreenID; oldScreenID = GFX_Screen_SetActive(SCREEN_1); /* ENHANCEMENT -- After visiting Mentat (the help) window, auto-repeat of keys gets disabled. */ if (!g_dune2_enhanced) Input_Flags_SetBits(INPUT_FLAG_KEY_REPEAT); Input_History_Clear(); GUI_Mentat_Display(NULL, g_playerHouseID); g_widgetMentatFirst = GUI_Widget_Allocate(1, GUI_Widget_GetShortcut(*String_Get_ByIndex(STR_EXIT)), 200, 168, proceed ? 379 : 377, 5); g_widgetMentatFirst->shortcut2 = 'n'; GUI_Mentat_Create_HelpScreen_Widgets(); GUI_Mouse_Hide_Safe(); GUI_Screen_Copy(0, 0, 0, 0, SCREEN_WIDTH / 8, SCREEN_HEIGHT, SCREEN_1, SCREEN_0); GUI_Mouse_Show_Safe(); GUI_Mentat_LoadHelpSubjects(true); GUI_Mentat_Draw(true); GFX_Screen_SetActive(SCREEN_0); GUI_Mentat_HelpListLoop(); free(g_widgetMentatFirst); g_widgetMentatFirst = NULL; Load_Palette_Mercenaries(); GUI_Widget_Free_WithScrollbar(g_widgetMentatScrollbar); g_widgetMentatScrollbar = NULL; free(g_widgetMentatScrollUp); g_widgetMentatScrollUp = NULL; free(g_widgetMentatScrollDown); g_widgetMentatScrollDown = NULL; /* ENHANCEMENT -- After visiting Mentat (the help) window, auto-repeat of keys gets disabled. */ if (!g_dune2_enhanced) Input_Flags_ClearBits(INPUT_FLAG_KEY_REPEAT); GFX_Screen_SetActive(oldScreenID); }
/** * Shows the Help window. * @param proceed Display a "Proceed" button if true, "Exit" otherwise. */ static void GUI_Mentat_ShowHelpList(bool proceed) { uint16 oldScreenID; oldScreenID = GFX_Screen_SetActive(2); Input_Flags_SetBits(INPUT_FLAG_KEY_REPEAT); Input_History_Clear(); GUI_Mentat_Display(NULL, g_playerHouseID); g_widgetMentatFirst = GUI_Widget_Allocate(1, GUI_Widget_GetShortcut(*String_Get_ByIndex(STR_EXIT)), 200, 168, proceed ? 379 : 377, 5); g_widgetMentatFirst->shortcut2 = 'n'; GUI_Mentat_Create_HelpScreen_Widgets(); GUI_Mouse_Hide_Safe(); GUI_Screen_Copy(0, 0, 0, 0, SCREEN_WIDTH / 8, SCREEN_HEIGHT, 2, 0); GUI_Mouse_Show_Safe(); GUI_Mentat_LoadHelpSubjects(true); GUI_Mentat_Draw(true); GFX_Screen_SetActive(0); GUI_Mentat_HelpListLoop(); free(g_widgetMentatFirst); g_widgetMentatFirst = NULL; Load_Palette_Mercenaries(); GUI_Widget_Free_WithScrollbar(g_widgetMentatScrollbar); g_widgetMentatScrollbar = NULL; free(g_widgetMentatScrollUp); g_widgetMentatScrollUp = NULL; free(g_widgetMentatScrollDown); g_widgetMentatScrollDown = NULL; Input_Flags_ClearBits(INPUT_FLAG_KEY_REPEAT); GFX_Screen_SetActive(oldScreenID); }
/** Create the widgets of the mentat help screen. */ void GUI_Mentat_Create_HelpScreen_Widgets(void) { static char empty[2] = ""; uint16 ypos; Widget *w; int i; if (g_widgetMentatScrollbar != NULL) { GUI_Widget_Free_WithScrollbar(g_widgetMentatScrollbar); g_widgetMentatScrollbar = NULL; } free(g_widgetMentatScrollUp); g_widgetMentatScrollUp = NULL; free(g_widgetMentatScrollDown); g_widgetMentatScrollDown = NULL; g_widgetMentatTail = NULL; ypos = 8; w = (Widget *)GFX_Screen_Get_ByIndex(SCREEN_2); memset(w, 0, 13 * sizeof(Widget)); for (i = 0; i < 13; i++) { w->index = i + 2; memset(&w->flags, 0, sizeof(w->flags)); w->flags.buttonFilterLeft = 9; w->flags.buttonFilterRight = 1; w->clickProc = &GUI_Mentat_List_Click; w->drawParameterDown.text = empty; w->drawParameterSelected.text = empty; w->drawParameterNormal.text = empty; w->drawModeNormal = DRAW_MODE_TEXT; memset(&w->state, 0, sizeof(w->state)); w->offsetX = 24; w->offsetY = ypos; w->width = 0x88; w->height = 8; w->parentID = 8; if (g_widgetMentatTail != NULL) { g_widgetMentatTail = GUI_Widget_Link(g_widgetMentatTail, w); } else { g_widgetMentatTail = w; } ypos += 8; w++; } GUI_Widget_MakeInvisible(g_widgetMentatTail); GUI_Widget_MakeInvisible(w - 1); g_widgetMentatScrollbar = GUI_Widget_Allocate_WithScrollbar(15, 8, 168, 24, 8, 72, &GUI_Mentat_ScrollBar_Draw); g_widgetMentatTail = GUI_Widget_Link(g_widgetMentatTail, g_widgetMentatScrollbar); g_widgetMentatScrollDown = GUI_Widget_Allocate3(16, 0, 168, 96, g_sprites[385], g_sprites[386], GUI_Widget_Get_ByIndex(g_widgetMentatTail, 15), 1); g_widgetMentatScrollDown->shortcut = 0; g_widgetMentatScrollDown->shortcut2 = 0; g_widgetMentatScrollDown->parentID = 8; g_widgetMentatTail = GUI_Widget_Link(g_widgetMentatTail, g_widgetMentatScrollDown); g_widgetMentatScrollUp = GUI_Widget_Allocate3(17, 0, 168, 16, g_sprites[383], g_sprites[384], GUI_Widget_Get_ByIndex(g_widgetMentatTail, 15), 0); g_widgetMentatScrollUp->shortcut = 0; g_widgetMentatScrollUp->shortcut2 = 0; g_widgetMentatScrollUp->parentID = 8; g_widgetMentatTail = GUI_Widget_Link(g_widgetMentatTail, g_widgetMentatScrollUp); g_widgetMentatTail = GUI_Widget_Link(g_widgetMentatTail, g_widgetMentatFirst); GUI_Widget_Draw(g_widgetMentatFirst); }