mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 15:32:33 +00:00
Merge branch 'ogl-sort-crash-fix' into 'next'
Fix crash by handling precip mobjs correctly in ogl sprite sorting See merge request STJr/SRB2!1062
This commit is contained in:
commit
d40022d75f
2 changed files with 8 additions and 7 deletions
|
@ -68,7 +68,7 @@ typedef struct gr_vissprite_s
|
|||
GLPatch_t *gpatch;
|
||||
boolean flip;
|
||||
UINT8 translucency; //alpha level 0-255
|
||||
mobj_t *mobj;
|
||||
mobj_t *mobj; // NOTE: This is a precipmobj_t if precip is true !!! Watch out.
|
||||
boolean precip; // Tails 08-25-2002
|
||||
boolean vflip;
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
|
|
|
@ -4256,8 +4256,9 @@ static int CompareVisSprites(const void *p1, const void *p2)
|
|||
int transparency1;
|
||||
int transparency2;
|
||||
|
||||
int linkdraw1 = (spr1->mobj->flags2 & MF2_LINKDRAW) && spr1->mobj->tracer;
|
||||
int linkdraw2 = (spr2->mobj->flags2 & MF2_LINKDRAW) && spr2->mobj->tracer;
|
||||
// check for precip first, because then sprX->mobj is actually a precipmobj_t and does not have flags2 or tracer
|
||||
int linkdraw1 = !spr1->precip && (spr1->mobj->flags2 & MF2_LINKDRAW) && spr1->mobj->tracer;
|
||||
int linkdraw2 = !spr2->precip && (spr2->mobj->flags2 & MF2_LINKDRAW) && spr2->mobj->tracer;
|
||||
|
||||
// ^ is the XOR operation
|
||||
// if comparing a linkdraw and non-linkdraw sprite or 2 linkdraw sprites with different tracers, then use
|
||||
|
@ -4272,7 +4273,7 @@ static int CompareVisSprites(const void *p1, const void *p2)
|
|||
else
|
||||
{
|
||||
tz1 = spr1->tz;
|
||||
transparency1 = (spr1->mobj->flags2 & MF2_SHADOW) || (spr1->mobj->frame & FF_TRANSMASK);
|
||||
transparency1 = (!spr1->precip && (spr1->mobj->flags2 & MF2_SHADOW)) || (spr1->mobj->frame & FF_TRANSMASK);
|
||||
}
|
||||
if (linkdraw2)
|
||||
{
|
||||
|
@ -4282,15 +4283,15 @@ static int CompareVisSprites(const void *p1, const void *p2)
|
|||
else
|
||||
{
|
||||
tz2 = spr2->tz;
|
||||
transparency2 = (spr2->mobj->flags2 & MF2_SHADOW) || (spr2->mobj->frame & FF_TRANSMASK);
|
||||
transparency2 = (!spr2->precip && (spr2->mobj->flags2 & MF2_SHADOW)) || (spr2->mobj->frame & FF_TRANSMASK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tz1 = spr1->tz;
|
||||
transparency1 = (spr1->mobj->flags2 & MF2_SHADOW) || (spr1->mobj->frame & FF_TRANSMASK);
|
||||
transparency1 = (!spr1->precip && (spr1->mobj->flags2 & MF2_SHADOW)) || (spr1->mobj->frame & FF_TRANSMASK);
|
||||
tz2 = spr2->tz;
|
||||
transparency2 = (spr2->mobj->flags2 & MF2_SHADOW) || (spr2->mobj->frame & FF_TRANSMASK);
|
||||
transparency2 = (!spr2->precip && (spr2->mobj->flags2 & MF2_SHADOW)) || (spr2->mobj->frame & FF_TRANSMASK);
|
||||
}
|
||||
|
||||
// first compare transparency flags, then compare tz, then compare dispoffset
|
||||
|
|
Loading…
Reference in a new issue