changeset 7601 | 988040ee27f4 |
parent 7580 | fc9a8300f34e |
child 7617 | 804e665b79fa |
7600:f885804de706 | 7601:988040ee27f4 |
---|---|
511 */ |
511 */ |
512 void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, int dz, int z, bool transparent, int bb_offset_x, int bb_offset_y, int bb_offset_z) |
512 void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, int dz, int z, bool transparent, int bb_offset_x, int bb_offset_y, int bb_offset_z) |
513 { |
513 { |
514 ViewportDrawer *vd = _cur_vd; |
514 ViewportDrawer *vd = _cur_vd; |
515 ParentSpriteToDraw *ps; |
515 ParentSpriteToDraw *ps; |
516 const Sprite *spr; |
|
517 Point pt; |
516 Point pt; |
517 int32 right, bottom; |
|
518 |
518 |
519 assert((image & SPRITE_MASK) < MAX_SPRITES); |
519 assert((image & SPRITE_MASK) < MAX_SPRITES); |
520 |
520 |
521 /* make the sprites transparent with the right palette */ |
521 /* make the sprites transparent with the right palette */ |
522 if (transparent) { |
522 if (transparent) { |
549 } |
549 } |
550 |
550 |
551 pt = RemapCoords(x, y, z); |
551 pt = RemapCoords(x, y, z); |
552 ps->x = pt.x; |
552 ps->x = pt.x; |
553 ps->y = pt.y; |
553 ps->y = pt.y; |
554 spr = GetSprite(image & SPRITE_MASK); |
554 if (image == SPR_EMPTY_BOUNDING_BOX) { |
555 if ((ps->left = (pt.x += spr->x_offs)) >= vd->dpi.left + vd->dpi.width || |
555 ps->left = RemapCoords(x + w , y + bb_offset_y, z + bb_offset_z).x; |
556 ( (pt.x + spr->width )) <= vd->dpi.left || |
556 right = RemapCoords(x + bb_offset_x, y + h , z + bb_offset_z).x; |
557 (ps->top = (pt.y += spr->y_offs)) >= vd->dpi.top + vd->dpi.height || |
557 ps->top = RemapCoords(x + bb_offset_x, y + bb_offset_y, z + dz ).y; |
558 ( (pt.y + spr->height)) <= vd->dpi.top) { |
558 bottom = RemapCoords(x + w , y + h , z + bb_offset_z).y; |
559 } else { |
|
560 const Sprite *spr = GetSprite(image & SPRITE_MASK); |
|
561 ps->left = (pt.x += spr->x_offs); |
|
562 right = (pt.x + spr->width ); |
|
563 ps->top = (pt.y += spr->y_offs); |
|
564 bottom = (pt.y + spr->height); |
|
565 } |
|
566 if (ps->left >= vd->dpi.left + vd->dpi.width || |
|
567 right <= vd->dpi.left || |
|
568 ps->top >= vd->dpi.top + vd->dpi.height || |
|
569 bottom <= vd->dpi.top) { |
|
559 return; |
570 return; |
560 } |
571 } |
561 |
572 |
562 vd->spritelist_mem += sizeof(ParentSpriteToDraw); |
573 vd->spritelist_mem += sizeof(ParentSpriteToDraw); |
563 |
574 |
1210 { |
1221 { |
1211 for (; *psd != NULL; psd++) { |
1222 for (; *psd != NULL; psd++) { |
1212 const ParentSpriteToDraw* ps = *psd; |
1223 const ParentSpriteToDraw* ps = *psd; |
1213 const ChildScreenSpriteToDraw* cs; |
1224 const ChildScreenSpriteToDraw* cs; |
1214 |
1225 |
1215 DrawSprite(ps->image, ps->pal, ps->x, ps->y); |
1226 if (ps->image != SPR_EMPTY_BOUNDING_BOX) DrawSprite(ps->image, ps->pal, ps->x, ps->y); |
1216 |
1227 |
1217 for (cs = ps->child; cs != NULL; cs = cs->next) { |
1228 for (cs = ps->child; cs != NULL; cs = cs->next) { |
1218 DrawSprite(cs->image, cs->pal, ps->left + cs->x, ps->top + cs->y); |
1229 DrawSprite(cs->image, cs->pal, ps->left + cs->x, ps->top + cs->y); |
1219 } |
1230 } |
1220 } |
1231 } |