(svn r5631) Don't allocate memory for information about a sprite which isn't drawn

This commit is contained in:
tron 2006-07-29 13:06:00 +00:00
parent 82ebf842d1
commit fef9818d3c

View File

@ -463,6 +463,15 @@ void AddSortableSpriteToDraw(uint32 image, int x, int y, int w, int h, byte dz,
return; return;
} }
pt = RemapCoords(x, y, z);
spr = GetSprite(image & SPRITE_MASK);
if ((ps->left = (pt.x += spr->x_offs)) >= vd->dpi.left + vd->dpi.width ||
(ps->right = (pt.x + spr->width )) <= vd->dpi.left ||
(ps->top = (pt.y += spr->y_offs)) >= vd->dpi.top + vd->dpi.height ||
(ps->bottom = (pt.y + spr->height)) <= vd->dpi.top) {
return;
}
vd->spritelist_mem += sizeof(ParentSpriteToDraw); vd->spritelist_mem += sizeof(ParentSpriteToDraw);
ps->image = image; ps->image = image;
@ -475,16 +484,6 @@ void AddSortableSpriteToDraw(uint32 image, int x, int y, int w, int h, byte dz,
ps->zmin = z; ps->zmin = z;
ps->zmax = z + dz - 1; ps->zmax = z + dz - 1;
pt = RemapCoords(x, y, z);
spr = GetSprite(image & SPRITE_MASK);
if ((ps->left = (pt.x += spr->x_offs)) >= vd->dpi.left + vd->dpi.width ||
(ps->right = (pt.x + spr->width )) <= vd->dpi.left ||
(ps->top = (pt.y += spr->y_offs)) >= vd->dpi.top + vd->dpi.height ||
(ps->bottom = (pt.y + spr->height)) <= vd->dpi.top) {
return;
}
ps->unk16 = 0; ps->unk16 = 0;
ps->child = NULL; ps->child = NULL;
vd->last_child = &ps->child; vd->last_child = &ps->child;