(svn r11094) -Documentation: Add comments on viewport structures and change an obscure variable name to something a little more meaningfull.

Heavily based of frosch's work (FS#1223)
This commit is contained in:
belugas 2007-09-13 15:51:50 +00:00
parent b21093ea8f
commit 1970e657a3

View File

@ -81,20 +81,23 @@ struct ChildScreenSpriteToDraw {
}; };
struct ParentSpriteToDraw { struct ParentSpriteToDraw {
SpriteID image; SpriteID image; ///< sprite to draw
SpriteID pal; SpriteID pal; ///< palette to use
int32 left;
int32 top; int32 left; ///< minimal screen X coordinate of sprite (= x + sprite->x_offs), reference point for child sprites
int32 top; ///< minimal screen Y coordinate of sprite (= y + sprite->y_offs), reference point for child sprites
int32 right; int32 right;
int32 bottom; int32 bottom;
int32 xmin;
int32 ymin; int32 xmin; ///< minimal world X coordinate of bounding box
int32 xmax; int32 xmax; ///< maximal world X coordinate of bounding box
int32 ymax; int32 ymin; ///< minimal world Y coordinate of bounding box
ChildScreenSpriteToDraw *child; int32 ymax; ///< maximal world Y coordinate of bounding box
byte unk16; byte zmin; ///< minimal world Z coordinate of bounding box
byte zmin; byte zmax; ///< maximal world Z coordinate of bounding box
byte zmax;
ChildScreenSpriteToDraw *child; ///< head of child list;
bool comparaison_done; ///< Used during sprite sorting: true if sprite has been compared with all other sprites
}; };
/* Quick hack to know how much memory to reserve when allocating from the spritelist /* Quick hack to know how much memory to reserve when allocating from the spritelist
@ -551,7 +554,7 @@ void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w,
ps->zmin = z; ps->zmin = z;
ps->zmax = z + dz - 1; ps->zmax = z + dz - 1;
ps->unk16 = 0; ps->comparaison_done = false;
ps->child = NULL; ps->child = NULL;
vd->last_child = &ps->child; vd->last_child = &ps->child;
@ -1130,16 +1133,16 @@ static void ViewportSortParentSprites(ParentSpriteToDraw *psd[])
while (*psd != NULL) { while (*psd != NULL) {
ParentSpriteToDraw* ps = *psd; ParentSpriteToDraw* ps = *psd;
if (!(ps->unk16 & 1)) { if (!ps->comparaison_done) {
ParentSpriteToDraw** psd2 = psd; ParentSpriteToDraw** psd2 = psd;
ps->unk16 |= 1; ps->comparaison_done = true;
while (*++psd2 != NULL) { while (*++psd2 != NULL) {
ParentSpriteToDraw* ps2 = *psd2; ParentSpriteToDraw* ps2 = *psd2;
ParentSpriteToDraw** psd3; ParentSpriteToDraw** psd3;
if (ps2->unk16 & 1) continue; if (ps2->comparaison_done) continue;
/* Decide which comparator to use, based on whether the bounding /* Decide which comparator to use, based on whether the bounding
* boxes overlap * boxes overlap