mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-25 22:01:33 +00:00
[nq] Get hud_sbar working for the most part
Setting the parent to another object in the same hierarchy still causes a segfault (worked around for now), but the mangled views were caused by View_UpdateHierarchy not being called prior to the first call to set_hud_sbar (why, though? I suspect something to do with oldlen). And ECS_SortComponentPool finally gets used to ensure the sbar panels are behind the info pics.
This commit is contained in:
parent
b91568d234
commit
d5de8bf53f
1 changed files with 16 additions and 0 deletions
|
@ -1603,6 +1603,20 @@ sbar_hud_swap_f (void *data, const cvar_t *cvar)
|
|||
View_UpdateHierarchy (hud_view);
|
||||
}
|
||||
|
||||
static int
|
||||
href_cmp (const void *_a, const void *_b, void *arg)
|
||||
{
|
||||
uint32_t enta = *(const uint32_t *)_a;
|
||||
uint32_t entb = *(const uint32_t *)_b;
|
||||
hierref_t *ref_a = Ent_GetComponent (enta, hud_href, hud_registry);
|
||||
hierref_t *ref_b = Ent_GetComponent (entb, hud_href, hud_registry);
|
||||
if (ref_a->hierarchy == ref_b->hierarchy) {
|
||||
return ref_a->index - ref_b->index;
|
||||
}
|
||||
ptrdiff_t diff = ref_a->hierarchy - ref_b->hierarchy;
|
||||
return diff > 0 ? 1 : diff < 0 ? -1 : 0;
|
||||
}
|
||||
|
||||
static void
|
||||
set_hud_sbar (void)
|
||||
{
|
||||
|
@ -1690,6 +1704,7 @@ set_hud_sbar (void)
|
|||
sbar_remcomponent (sbar_inventory, hud_pic);
|
||||
sbar_remcomponent (sbar_statusbar, hud_pic);
|
||||
}
|
||||
ECS_SortComponentPool (hud_registry, hud_pic, href_cmp, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2240,6 +2255,7 @@ Sbar_Init (void)
|
|||
load_pics ();
|
||||
init_views ();
|
||||
|
||||
View_UpdateHierarchy (sbar_main);
|
||||
set_hud_sbar ();
|
||||
View_UpdateHierarchy (sbar_main);
|
||||
|
||||
|
|
Loading…
Reference in a new issue