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

Function GUI_FactoryWindow_DrawDetails

src/gui/gui.c:3509–3579  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3507}
3508
3509void GUI_FactoryWindow_DrawDetails(void)
3510{
3511 Screen oldScreenID;
3512 FactoryWindowItem *item = GUI_FactoryWindow_GetItem(g_factoryWindowSelected);
3513 ObjectInfo *oi = item->objectInfo;
3514 void *wsa;
3515
3516 oldScreenID = GFX_Screen_SetActive(SCREEN_1);
3517
3518 wsa = WSA_LoadFile(oi->wsa, s_factoryWindowWsaBuffer, sizeof(s_factoryWindowWsaBuffer), false);
3519 WSA_DisplayFrame(wsa, 0, 128, 48, SCREEN_1);
3520 WSA_Unload(wsa);
3521
3522 if (g_factoryWindowConstructionYard) {
3523 const StructureInfo *si;
3524 int16 x = 288;
3525 int16 y = 136;
3526 uint8 *sprite;
3527 uint16 width;
3528 uint16 i;
3529 uint16 j;
3530
3531 GUI_DrawSprite(SCREEN_1, g_sprites[64], x, y, 0, 0);
3532 x++;
3533 y++;
3534
3535 sprite = g_sprites[24];
3536 width = Sprite_GetWidth(sprite) + 1;
3537 si = &g_table_structureInfo[item->objectType];
3538
3539 for (j = 0; j < g_table_structure_layoutSize[si->layout].height; j++) {
3540 for (i = 0; i < g_table_structure_layoutSize[si->layout].width; i++) {
3541 GUI_DrawSprite(SCREEN_1, sprite, x + i * width, y + j * width, 0, 0);
3542 }
3543 }
3544 }
3545
3546 if (oi->available == -1) {
3547 GUI_Palette_RemapScreen(128, 48, 184, 112, SCREEN_1, s_factoryWindowGraymapTbl);
3548
3549 if (g_factoryWindowStarport) {
3550 GUI_DrawText_Wrapper(String_Get_ByIndex(STR_OUT_OF_STOCK), 220, 99, 6, 0, 0x132);
3551 } else {
3552 GUI_DrawText_Wrapper(String_Get_ByIndex(STR_NEED_STRUCTURE_UPGRADE), 220, 94, 6, 0, 0x132);
3553
3554 if (g_factoryWindowUpgradeCost != 0) {
3555 GUI_DrawText_Wrapper(String_Get_ByIndex(STR_UPGRADE_COST_D), 220, 104, 6, 0, 0x132, g_factoryWindowUpgradeCost);
3556 } else {
3557 GUI_DrawText_Wrapper(String_Get_ByIndex(STR_REPAIR_STRUCTURE_FIRST), 220, 104, 6, 0, 0x132);
3558 }
3559 }
3560 } else {
3561 if (g_factoryWindowStarport) {
3562 GUI_Screen_Copy(16, 99, 16, 160, 23, 9, SCREEN_1, SCREEN_1);
3563 GUI_Screen_Copy(16, 99, 16, 169, 23, 9, SCREEN_1, SCREEN_1);
3564 GUI_DrawText_Wrapper(String_Get_ByIndex(STR_OUT_OF_STOCK), 220, 169, 6, 0, 0x132);
3565 GUI_Screen_Copy(16, 99, 16, 178, 23, 9, SCREEN_1, SCREEN_1);
3566 GUI_DrawText_Wrapper(String_Get_ByIndex(STR_UNABLE_TO_CREATE_MORE), 220, 178, 6, 0, 0x132);

Callers 5

GUI_FactoryWindow_InitFunction · 0.85
GUI_Production_Up_ClickFunction · 0.85
GUI_Purchase_ShowInvoiceFunction · 0.85

Calls 15

GFX_Screen_SetActiveFunction · 0.85
WSA_LoadFileFunction · 0.85
WSA_DisplayFrameFunction · 0.85
WSA_UnloadFunction · 0.85
GUI_DrawSpriteFunction · 0.85
Sprite_GetWidthFunction · 0.85
GUI_Palette_RemapScreenFunction · 0.85
GUI_DrawText_WrapperFunction · 0.85
String_Get_ByIndexFunction · 0.85
GUI_Screen_CopyFunction · 0.85

Tested by

no test coverage detected