| 443 | } |
| 444 | |
| 445 | static void GUI_Window_Create(WindowDesc *desc) |
| 446 | { |
| 447 | uint8 i; |
| 448 | |
| 449 | if (desc == NULL) return; |
| 450 | |
| 451 | g_widgetLinkedListTail = NULL; |
| 452 | |
| 453 | GFX_Screen_SetActive(SCREEN_1); |
| 454 | |
| 455 | Widget_SetCurrentWidget(desc->index); |
| 456 | |
| 457 | GUI_Widget_DrawBorder(g_curWidgetIndex, 2, true); |
| 458 | |
| 459 | if (GUI_String_Get_ByIndex(desc->stringID) != NULL) { |
| 460 | GUI_DrawText_Wrapper(GUI_String_Get_ByIndex(desc->stringID), (g_curWidgetXBase << 3) + (g_curWidgetWidth << 2), g_curWidgetYBase + 6 + ((desc == &g_yesNoWindowDesc) ? 2 : 0), 238, 0, 0x122); |
| 461 | } |
| 462 | |
| 463 | if (GUI_String_Get_ByIndex(desc->widgets[0].stringID) == NULL) { |
| 464 | GUI_DrawText_Wrapper(String_Get_ByIndex(STR_THERE_ARE_NO_SAVED_GAMES_TO_LOAD), (g_curWidgetXBase + 2) << 3, g_curWidgetYBase + 42, 232, 0, 0x22); |
| 465 | } |
| 466 | |
| 467 | for (i = 0; i < desc->widgetCount; i++) { |
| 468 | Widget *w = &g_table_windowWidgets[i]; |
| 469 | |
| 470 | if (GUI_String_Get_ByIndex(desc->widgets[i].stringID) == NULL) continue; |
| 471 | |
| 472 | w->next = NULL; |
| 473 | w->offsetX = desc->widgets[i].offsetX; |
| 474 | w->offsetY = desc->widgets[i].offsetY; |
| 475 | w->width = desc->widgets[i].width; |
| 476 | w->height = desc->widgets[i].height; |
| 477 | w->shortcut = 0; |
| 478 | w->shortcut2 = 0; |
| 479 | |
| 480 | if (desc != &g_savegameNameWindowDesc) { |
| 481 | if (desc->widgets[i].labelStringId != STR_NULL) { |
| 482 | w->shortcut = GUI_Widget_GetShortcut(*GUI_String_Get_ByIndex(desc->widgets[i].labelStringId)); |
| 483 | } else { |
| 484 | w->shortcut = GUI_Widget_GetShortcut(*GUI_String_Get_ByIndex(desc->widgets[i].stringID)); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | w->shortcut2 = desc->widgets[i].shortcut2; |
| 489 | if (w->shortcut == 0x1B) { |
| 490 | w->shortcut2 = 0x13; |
| 491 | } |
| 492 | |
| 493 | w->stringID = desc->widgets[i].stringID; |
| 494 | w->drawModeNormal = DRAW_MODE_CUSTOM_PROC; |
| 495 | w->drawModeSelected = DRAW_MODE_CUSTOM_PROC; |
| 496 | w->drawModeDown = DRAW_MODE_CUSTOM_PROC; |
| 497 | w->drawParameterNormal.proc = &GUI_Widget_TextButton_Draw; |
| 498 | w->drawParameterSelected.proc = &GUI_Widget_TextButton_Draw; |
| 499 | w->drawParameterDown.proc = &GUI_Widget_TextButton_Draw; |
| 500 | w->parentID = desc->index; |
| 501 | memset(&w->state, 0, sizeof(w->state)); |
| 502 |
no test coverage detected