mirror of
https://github.com/libretro/libretro-tyrquake.git
synced 2025-01-21 07:28:01 +00:00
nq: handle visedicts similarly to qw
Make handling of cl_visedicts as similar as possible to qw. I am not yet 100% conviced that this has not introduced subtle bugs due to now taking a copy of the entities in this list, but merging the behaviour is probably the right way to go (and fix the bugs later). Quickly played through a couple of random maps and nothing jumped out as being obviously incorrect. Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
d8781b30d2
commit
293084be9b
@ -70,7 +70,8 @@ lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
|
||||
dlight_t cl_dlights[MAX_DLIGHTS];
|
||||
|
||||
int cl_numvisedicts;
|
||||
entity_t *cl_visedicts[MAX_VISEDICTS];
|
||||
entity_t *cl_visedicts;
|
||||
static entity_t cl_visedicts_list[MAX_VISEDICTS];
|
||||
|
||||
/*
|
||||
=====================
|
||||
@ -479,6 +480,7 @@ CL_RelinkEntities(void)
|
||||
frac = CL_LerpPoint();
|
||||
|
||||
cl_numvisedicts = 0;
|
||||
cl_visedicts = cl_visedicts_list;
|
||||
|
||||
//
|
||||
// interpolate player info
|
||||
@ -627,7 +629,7 @@ CL_RelinkEntities(void)
|
||||
continue;
|
||||
|
||||
if (cl_numvisedicts < MAX_VISEDICTS) {
|
||||
cl_visedicts[cl_numvisedicts] = ent;
|
||||
cl_visedicts[cl_numvisedicts] = *ent;
|
||||
cl_numvisedicts++;
|
||||
}
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ CL_NewTempEntity(void)
|
||||
ent = &cl_temp_entities[num_temp_entities];
|
||||
memset(ent, 0, sizeof(*ent));
|
||||
num_temp_entities++;
|
||||
cl_visedicts[cl_numvisedicts] = ent;
|
||||
cl_visedicts[cl_numvisedicts] = *ent;
|
||||
cl_numvisedicts++;
|
||||
|
||||
ent->colormap = vid.colormap;
|
||||
|
@ -303,7 +303,7 @@ void CL_NextDemo(void);
|
||||
|
||||
#define MAX_VISEDICTS 256
|
||||
extern int cl_numvisedicts;
|
||||
extern entity_t *cl_visedicts[MAX_VISEDICTS];
|
||||
extern entity_t *cl_visedicts;
|
||||
|
||||
extern int fps_count;
|
||||
|
||||
|
@ -564,7 +564,7 @@ R_DrawEntitiesOnList(void)
|
||||
return;
|
||||
|
||||
for (i = 0; i < cl_numvisedicts; i++) {
|
||||
currententity = cl_visedicts[i];
|
||||
currententity = &cl_visedicts[i];
|
||||
|
||||
if (currententity == &cl_entities[cl.viewentity])
|
||||
continue; // don't draw the player
|
||||
@ -768,7 +768,7 @@ R_DrawBEntitiesOnList(void)
|
||||
r_dlightframecount = r_framecount;
|
||||
|
||||
for (i = 0; i < cl_numvisedicts; i++) {
|
||||
currententity = cl_visedicts[i];
|
||||
currententity = &cl_visedicts[i];
|
||||
|
||||
switch (currententity->model->type) {
|
||||
case mod_brush:
|
||||
|
@ -201,28 +201,18 @@ R_StoreEfrags(efrag_t **ppefrag)
|
||||
while ((pefrag = *ppefrag) != NULL) {
|
||||
pent = pefrag->entity;
|
||||
clmodel = pent->model;
|
||||
|
||||
switch (clmodel->type) {
|
||||
case mod_alias:
|
||||
case mod_brush:
|
||||
case mod_sprite:
|
||||
pent = pefrag->entity;
|
||||
|
||||
if ((pent->visframe != r_framecount) &&
|
||||
(cl_numvisedicts < MAX_VISEDICTS)) {
|
||||
#ifdef NQ_HACK
|
||||
cl_visedicts[cl_numvisedicts++] = pent;
|
||||
#endif
|
||||
#ifdef QW_HACK
|
||||
cl_visedicts[cl_numvisedicts++] = *pent;
|
||||
#endif
|
||||
// mark that we've recorded this entity for this frame
|
||||
/* mark that we've recorded this entity for this frame */
|
||||
pent->visframe = r_framecount;
|
||||
cl_visedicts[cl_numvisedicts++] = *pent;
|
||||
}
|
||||
|
||||
ppefrag = &pefrag->leafnext;
|
||||
break;
|
||||
|
||||
default:
|
||||
Sys_Error("%s: Bad entity type %d", __func__, clmodel->type);
|
||||
}
|
||||
|
@ -674,12 +674,7 @@ R_DrawEntitiesOnList(void)
|
||||
|
||||
// draw sprites seperately, because of alpha blending
|
||||
for (i = 0; i < cl_numvisedicts; i++) {
|
||||
#ifdef NQ_HACK
|
||||
currententity = cl_visedicts[i];
|
||||
#endif
|
||||
#ifdef QW_HACK
|
||||
currententity = &cl_visedicts[i];
|
||||
#endif
|
||||
switch (currententity->model->type) {
|
||||
case mod_alias:
|
||||
R_DrawAliasModel(currententity);
|
||||
@ -693,12 +688,7 @@ R_DrawEntitiesOnList(void)
|
||||
}
|
||||
|
||||
for (i = 0; i < cl_numvisedicts; i++) {
|
||||
#ifdef NQ_HACK
|
||||
currententity = cl_visedicts[i];
|
||||
#endif
|
||||
#ifdef QW_HACK
|
||||
currententity = &cl_visedicts[i];
|
||||
#endif
|
||||
switch (currententity->model->type) {
|
||||
case mod_sprite:
|
||||
R_DrawSpriteModel(currententity);
|
||||
@ -1163,7 +1153,7 @@ R_Mirror(void)
|
||||
|
||||
ent = &cl_entities[cl.viewentity];
|
||||
if (cl_numvisedicts < MAX_VISEDICTS) {
|
||||
cl_visedicts[cl_numvisedicts] = ent;
|
||||
cl_visedicts[cl_numvisedicts] = *ent;
|
||||
cl_numvisedicts++;
|
||||
}
|
||||
|
||||
|
@ -238,33 +238,21 @@ R_StoreEfrags(efrag_t **ppefrag)
|
||||
model_t *clmodel;
|
||||
efrag_t *pefrag;
|
||||
|
||||
|
||||
while ((pefrag = *ppefrag) != NULL) {
|
||||
pent = pefrag->entity;
|
||||
clmodel = pent->model;
|
||||
|
||||
switch (clmodel->type) {
|
||||
case mod_alias:
|
||||
case mod_brush:
|
||||
case mod_sprite:
|
||||
pent = pefrag->entity;
|
||||
|
||||
if ((pent->visframe != r_framecount) &&
|
||||
(cl_numvisedicts < MAX_VISEDICTS)) {
|
||||
#ifdef NQ_HACK
|
||||
cl_visedicts[cl_numvisedicts++] = pent;
|
||||
#endif
|
||||
#ifdef QW_HACK
|
||||
cl_visedicts[cl_numvisedicts++] = *pent;
|
||||
#endif
|
||||
|
||||
// mark that we've recorded this entity for this frame
|
||||
/* mark that we've recorded this entity for this frame */
|
||||
pent->visframe = r_framecount;
|
||||
cl_visedicts[cl_numvisedicts++] = *pent;
|
||||
}
|
||||
|
||||
ppefrag = &pefrag->leafnext;
|
||||
break;
|
||||
|
||||
default:
|
||||
Sys_Error("%s: Bad entity type %d", __func__, clmodel->type);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user