MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Menu_TransitionItemByName

Function Menu_TransitionItemByName

code/ui/ui_shared.cpp:1844–1869  ·  view source on GitHub ↗

================= Menu_TransitionItemByName ================= */

Source from the content-addressed store, hash-verified

1842=================
1843*/
1844void Menu_TransitionItemByName(menuDef_t *menu, const char *p, const rectDef_t *rectFrom, const rectDef_t *rectTo, int time, float amt)
1845{
1846 itemDef_t *item;
1847 int i;
1848 int count = Menu_ItemsMatchingGroup(menu, p);
1849 for (i = 0; i < count; i++)
1850 {
1851 item = Menu_GetMatchingItemByNumber(menu, i, p);
1852 if (item != NULL)
1853 {
1854 if (!rectFrom)
1855 {
1856 rectFrom = &item->window.rect; //if there are more than one of these with the same name, they'll all use the FIRST one's FROM.
1857 }
1858 item->window.flags |= (WINDOW_INTRANSITION | WINDOW_VISIBLE);
1859 item->window.offsetTime = time;
1860 memcpy(&item->window.rectClient, rectFrom, sizeof(rectDef_t));
1861 memcpy(&item->window.rectEffects, rectTo, sizeof(rectDef_t));
1862 item->window.rectEffects2.x = abs(rectTo->x - rectFrom->x) / amt;
1863 item->window.rectEffects2.y = abs(rectTo->y - rectFrom->y) / amt;
1864 item->window.rectEffects2.w = abs(rectTo->w - rectFrom->w) / amt;
1865 item->window.rectEffects2.h = abs(rectTo->h - rectFrom->h) / amt;
1866 Item_UpdatePosition(item);
1867 }
1868 }
1869}
1870
1871/*
1872=================

Callers 2

Script_TransitionFunction · 0.70
Script_Transition2Function · 0.70

Calls 3

Menu_ItemsMatchingGroupFunction · 0.70
Item_UpdatePositionFunction · 0.70

Tested by

no test coverage detected