MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / GUI_FactoryWindow_UpdateSelection

Function GUI_FactoryWindow_UpdateSelection

src/gui/gui.c:3642–3699  ·  view source on GitHub ↗

* Update the selection in the factory window. * If \a selectionChanged, it draws the rectangle around the new entry. * In addition, the palette colour of the rectangle is slowly changed back and * forth between white and the house colour by palette changes, thus giving it * the appearance of glowing. * @param selectionChanged User has selected a new thing to build. */

Source from the content-addressed store, hash-verified

3640 * @param selectionChanged User has selected a new thing to build.
3641 */
3642void GUI_FactoryWindow_UpdateSelection(bool selectionChanged)
3643{
3644 static uint32 paletteChangeTimer;
3645 static int8 paletteColour;
3646 static int8 paletteChange;
3647
3648 if (selectionChanged) {
3649 uint16 y;
3650
3651 memset(g_palette1 + 255 * 3, 0x3F, 3);
3652
3653 /* calling GFX_SetPalette() now is useless as it will be done at the end of the function */
3654 /*GFX_SetPalette(g_palette1);*/
3655
3656 paletteChangeTimer = 0;
3657 paletteColour = 0;
3658 paletteChange = 8;
3659
3660 y = g_factoryWindowSelected * 32 + 24;
3661
3662 GUI_Mouse_Hide_Safe();
3663 GUI_DrawWiredRectangle(71, y - 1, 104, y + 24, 255);
3664 GUI_DrawWiredRectangle(72, y, 103, y + 23, 255);
3665 GUI_Mouse_Show_Safe();
3666 } else {
3667 if (paletteChangeTimer > g_timerGUI) return;
3668 }
3669
3670 paletteChangeTimer = g_timerGUI + 3;
3671 paletteColour += paletteChange;
3672
3673 if (paletteColour < 0 || paletteColour > 63) {
3674 paletteChange = -paletteChange;
3675 paletteColour += paletteChange;
3676 return;
3677 }
3678
3679 switch (g_playerHouseID) {
3680 case HOUSE_HARKONNEN:
3681 *(g_palette1 + 255 * 3 + 1) = paletteColour;
3682 *(g_palette1 + 255 * 3 + 2) = paletteColour;
3683 break;
3684
3685 case HOUSE_ATREIDES:
3686 *(g_palette1 + 255 * 3 + 0) = paletteColour;
3687 *(g_palette1 + 255 * 3 + 1) = paletteColour;
3688 break;
3689
3690 case HOUSE_ORDOS:
3691 *(g_palette1 + 255 * 3 + 0) = paletteColour;
3692 *(g_palette1 + 255 * 3 + 2) = paletteColour;
3693 break;
3694
3695 default: break;
3696 }
3697
3698 GFX_SetPalette(g_palette1);
3699}

Callers 7

GUI_DisplayFactoryWindowFunction · 0.85
GUI_Production_Up_ClickFunction · 0.85
GUI_Purchase_ShowInvoiceFunction · 0.85

Calls 4

GUI_Mouse_Hide_SafeFunction · 0.85
GUI_DrawWiredRectangleFunction · 0.85
GUI_Mouse_Show_SafeFunction · 0.85
GFX_SetPaletteFunction · 0.85

Tested by

no test coverage detected