Use object bounding box for y sorting
This commit is contained in:
parent
48ae6b7873
commit
5eff48b449
@ -623,14 +623,14 @@ static inline bool tile_passable(const map_t map, int x, int y)
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline double dynentity_bottom(dynentity_t *e)
|
||||
static inline double dynentity_bottom(const dynentity_t *e)
|
||||
{
|
||||
return e->pos.y + e->bbox.off.y + e->bbox.ext.y;
|
||||
}
|
||||
|
||||
static inline double objentity_bottom(objentity_t *e)
|
||||
static inline double objentity_bottom(const objentity_t *e)
|
||||
{
|
||||
return (double)e->pos.y;
|
||||
return (double)e->pos.y + e->bbox.off.y + e->bbox.ext.y;
|
||||
}
|
||||
|
||||
static inline double entity_bottom(entity_t *e)
|
||||
@ -897,7 +897,7 @@ static void render_objentity(
|
||||
SDL_Rect src = type->src;
|
||||
src.x += type->src.w * ((t / BASEANIMPERIOD) % type->animframes);
|
||||
const int x = rint(SCALE * (obj->pos.x - state->vpos.x));
|
||||
const int y = rint(SCALE * (obj->pos.y - state->vpos.y - type->src.h));
|
||||
const int y = rint(SCALE * (obj->pos.y - state->vpos.y));
|
||||
SDL_Rect dest = {
|
||||
.x = x,
|
||||
.y = y,
|
||||
|
Loading…
x
Reference in New Issue
Block a user