Avoid copying vissprite_t in R_DrawPSprites()

This commit is contained in:
Randy Heit 2016-04-23 20:42:14 -05:00
parent b8e3e1f095
commit 991f49e321
2 changed files with 13 additions and 6 deletions

View file

@ -1284,12 +1284,20 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, double sx, double
WORD flip; WORD flip;
FTexture* tex; FTexture* tex;
vissprite_t* vis; vissprite_t* vis;
static vissprite_t avis[NUMPSPRITES]; static vissprite_t avis[NUMPSPRITES + 1];
vissprite_t tempvis; static vissprite_t *avisp[countof(avis)];
bool noaccel; bool noaccel;
assert(pspnum >= 0 && pspnum < NUMPSPRITES); assert(pspnum >= 0 && pspnum < NUMPSPRITES);
if (avisp[0] == NULL)
{
for (int i = 0; i < countof(avis); ++i)
{
avisp[i] = &avis[i];
}
}
// decide which patch to use // decide which patch to use
if ( (unsigned)psp->sprite >= (unsigned)sprites.Size ()) if ( (unsigned)psp->sprite >= (unsigned)sprites.Size ())
{ {
@ -1329,7 +1337,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, double sx, double
return; return;
// store information in a vissprite // store information in a vissprite
vis = &tempvis; vis = avisp[NUMPSPRITES];
vis->renderflags = owner->renderflags; vis->renderflags = owner->renderflags;
vis->floorclip = 0; vis->floorclip = 0;
@ -1499,8 +1507,8 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, double sx, double
{ {
VisPSpritesX1[pspnum] = x1; VisPSpritesX1[pspnum] = x1;
VisPSpritesBaseColormap[pspnum] = colormap_to_use; VisPSpritesBaseColormap[pspnum] = colormap_to_use;
VisPSprites[pspnum] = &avis[pspnum]; VisPSprites[pspnum] = vis;
avis[pspnum] = *vis; swapvalues(avisp[pspnum], avisp[NUMPSPRITES]);
return; return;
} }
} }

View file

@ -88,7 +88,6 @@ struct vissprite_t
int CurrentPortalUniq; // [ZZ] to identify the portal that this thing is in. used for clipping. int CurrentPortalUniq; // [ZZ] to identify the portal that this thing is in. used for clipping.
vissprite_t() {} vissprite_t() {}
vissprite_t &operator= (const vissprite_t &o) { memcpy(this, &o, sizeof *this); return *this; }
}; };
struct particle_t; struct particle_t;