mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-11 10:10:48 +00:00
Make R_SplitEntityOnNode easier to read.
This commit is contained in:
parent
454047ab92
commit
d0a0440056
1 changed files with 25 additions and 17 deletions
|
@ -62,7 +62,26 @@ init_efrag_list (t_efrag_list *efl)
|
||||||
|
|
||||||
for (i = 0; i < MAX_EFRAGS - 1; i++)
|
for (i = 0; i < MAX_EFRAGS - 1; i++)
|
||||||
efl->efrags[i].entnext = &efl->efrags[i + 1];
|
efl->efrags[i].entnext = &efl->efrags[i + 1];
|
||||||
efl->efrags[i].entnext = NULL;
|
efl->efrags[i].entnext = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static efrag_t *
|
||||||
|
new_efrag (void)
|
||||||
|
{
|
||||||
|
efrag_t *ef;
|
||||||
|
|
||||||
|
if (__builtin_expect (!r_free_efrags, 0)) {
|
||||||
|
t_efrag_list *efl = calloc (1, sizeof (t_efrag_list));
|
||||||
|
SYS_CHECKMEM (efl);
|
||||||
|
efl->next = efrag_list;
|
||||||
|
efrag_list = efl;
|
||||||
|
init_efrag_list (efl);
|
||||||
|
r_free_efrags = &efl->efrags[0];
|
||||||
|
}
|
||||||
|
ef = r_free_efrags;
|
||||||
|
r_free_efrags = ef->entnext;
|
||||||
|
ef->entnext = 0;
|
||||||
|
return ef;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -114,7 +133,7 @@ R_RemoveEfrags (entity_t *ent)
|
||||||
r_free_efrags = old;
|
r_free_efrags = old;
|
||||||
}
|
}
|
||||||
|
|
||||||
ent->efrag = NULL;
|
ent->efrag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NODE_STACK_SIZE 1024
|
#define NODE_STACK_SIZE 1024
|
||||||
|
@ -139,25 +158,14 @@ R_SplitEntityOnNode (mnode_t *node)
|
||||||
|
|
||||||
leaf = (mleaf_t *) node;
|
leaf = (mleaf_t *) node;
|
||||||
|
|
||||||
// grab an efrag off the free list
|
ef = new_efrag (); // ensures ef->entnext is 0
|
||||||
ef = r_free_efrags;
|
|
||||||
if (__builtin_expect (!ef, 0)) {
|
|
||||||
t_efrag_list *efl = calloc (1, sizeof (t_efrag_list));
|
|
||||||
SYS_CHECKMEM (efl);
|
|
||||||
efl->next = efrag_list;
|
|
||||||
efrag_list = efl;
|
|
||||||
ef = r_free_efrags = &efl->efrags[0];
|
|
||||||
}
|
|
||||||
r_free_efrags = r_free_efrags->entnext;
|
|
||||||
|
|
||||||
|
// add the link to the chain of links on the entity
|
||||||
ef->entity = r_addent;
|
ef->entity = r_addent;
|
||||||
|
|
||||||
// add the entity link
|
|
||||||
*lastlink = ef;
|
*lastlink = ef;
|
||||||
lastlink = &ef->entnext;
|
lastlink = &ef->entnext;
|
||||||
ef->entnext = NULL;
|
|
||||||
|
|
||||||
// set the leaf links
|
// add the link too the chain of links on the leaf
|
||||||
ef->leaf = leaf;
|
ef->leaf = leaf;
|
||||||
ef->leafnext = leaf->efrags;
|
ef->leafnext = leaf->efrags;
|
||||||
leaf->efrags = ef;
|
leaf->efrags = ef;
|
||||||
|
@ -203,7 +211,7 @@ R_AddEfrags (entity_t *ent)
|
||||||
r_addent = ent;
|
r_addent = ent;
|
||||||
|
|
||||||
lastlink = &ent->efrag;
|
lastlink = &ent->efrag;
|
||||||
r_pefragtopnode = NULL;
|
r_pefragtopnode = 0;
|
||||||
|
|
||||||
entmodel = ent->model;
|
entmodel = ent->model;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue