mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
Introducing MF2_LINKDRAW! I put it in this branch because it (ab)uses some structural changes I made for papersprites.
* Sets the sortscale of the mobj to that of its tracer. * Basically, Smiles' tails won't clip through shields thanks to this. * http://gfycat.com/GraveGlassEwe * Also has support for chains of MF2_LINKDRAW!
This commit is contained in:
parent
d17843aee1
commit
db6e7fd985
4 changed files with 39 additions and 5 deletions
|
@ -6749,6 +6749,7 @@ static const char *const MOBJFLAG2_LIST[] = {
|
||||||
"BOSSFLEE", // Boss is fleeing!
|
"BOSSFLEE", // Boss is fleeing!
|
||||||
"BOSSDEAD", // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.)
|
"BOSSDEAD", // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.)
|
||||||
"AMBUSH", // Alternate behaviour typically set by MTF_AMBUSH
|
"AMBUSH", // Alternate behaviour typically set by MTF_AMBUSH
|
||||||
|
"LINKDRAW",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -192,6 +192,7 @@ typedef enum
|
||||||
MF2_BOSSFLEE = 1<<25, // Boss is fleeing!
|
MF2_BOSSFLEE = 1<<25, // Boss is fleeing!
|
||||||
MF2_BOSSDEAD = 1<<26, // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.)
|
MF2_BOSSDEAD = 1<<26, // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.)
|
||||||
MF2_AMBUSH = 1<<27, // Alternate behaviour typically set by MTF_AMBUSH
|
MF2_AMBUSH = 1<<27, // Alternate behaviour typically set by MTF_AMBUSH
|
||||||
|
MF2_LINKDRAW = 1<<28, // Draw vissprite of mobj immediately before/after tracer's vissprite (dependent on dispoffset and position)
|
||||||
// free: to and including 1<<31
|
// free: to and including 1<<31
|
||||||
} mobjflag2_t;
|
} mobjflag2_t;
|
||||||
|
|
||||||
|
|
|
@ -1119,12 +1119,14 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
|
|
||||||
vissprite_t *vis;
|
vissprite_t *vis;
|
||||||
|
|
||||||
angle_t ang = 0;
|
angle_t ang = 0; // compiler complaints
|
||||||
fixed_t iscale;
|
fixed_t iscale;
|
||||||
fixed_t scalestep; // toast '16
|
fixed_t scalestep;
|
||||||
fixed_t offset, offset2;
|
fixed_t offset, offset2;
|
||||||
boolean papersprite = (thing->frame & FF_PAPERSPRITE);
|
boolean papersprite = (thing->frame & FF_PAPERSPRITE);
|
||||||
|
|
||||||
|
INT32 dispoffset = thing->info->dispoffset;
|
||||||
|
|
||||||
//SoM: 3/17/2000
|
//SoM: 3/17/2000
|
||||||
fixed_t gz, gzt;
|
fixed_t gz, gzt;
|
||||||
INT32 heightsec, phs;
|
INT32 heightsec, phs;
|
||||||
|
@ -1312,6 +1314,36 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
|
|
||||||
xscale = FixedMul(xscale, ang_scale);
|
xscale = FixedMul(xscale, ang_scale);
|
||||||
|
|
||||||
|
if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer) // toast 16/09/16 (SYMMETRY)
|
||||||
|
{
|
||||||
|
mobj_t *link, *link2;
|
||||||
|
fixed_t linkscale;
|
||||||
|
|
||||||
|
for (link = thing->tracer; (link->tracer && (link->flags2 & MF2_LINKDRAW)); link = link->tracer)
|
||||||
|
link->flags2 &= ~MF2_LINKDRAW; // to prevent infinite loops, otherwise would just be a ;
|
||||||
|
|
||||||
|
for (link2 = thing->tracer; (link2->tracer && (link2 != link)); link2 = link2->tracer)
|
||||||
|
link->flags2 |= MF2_LINKDRAW; // only needed for correction of the above
|
||||||
|
|
||||||
|
if (link->flags2 & MF2_LINKDRAW)
|
||||||
|
link->flags2 &= ~MF2_LINKDRAW; // let's try and make sure this doesn't happen again...
|
||||||
|
|
||||||
|
tr_x = link->x - viewx;
|
||||||
|
tr_y = link->y - viewy;
|
||||||
|
gxt = FixedMul(tr_x, viewcos);
|
||||||
|
gyt = -FixedMul(tr_y, viewsin);
|
||||||
|
tz = gxt-gyt;
|
||||||
|
linkscale = FixedDiv(projectiony, tz);
|
||||||
|
|
||||||
|
if (tz < FixedMul(MINZ, this_scale))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (sortscale < linkscale)
|
||||||
|
dispoffset *= -1; // if it's physically behind, make sure it's ordered behind (if dispoffset > 0)
|
||||||
|
|
||||||
|
sortscale = linkscale; // now make sure it's linked
|
||||||
|
}
|
||||||
|
|
||||||
// PORTAL SPRITE CLIPPING
|
// PORTAL SPRITE CLIPPING
|
||||||
if (portalrender)
|
if (portalrender)
|
||||||
{
|
{
|
||||||
|
@ -1394,7 +1426,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
vis->mobjflags = thing->flags;
|
vis->mobjflags = thing->flags;
|
||||||
vis->scale = yscale; //<<detailshift;
|
vis->scale = yscale; //<<detailshift;
|
||||||
vis->sortscale = sortscale;
|
vis->sortscale = sortscale;
|
||||||
vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15
|
vis->dispoffset = dispoffset; // Monster Iestyn: 23/11/15
|
||||||
vis->gx = thing->x;
|
vis->gx = thing->x;
|
||||||
vis->gy = thing->y;
|
vis->gy = thing->y;
|
||||||
vis->gz = gz;
|
vis->gz = gz;
|
||||||
|
|
|
@ -135,8 +135,8 @@ typedef struct vissprite_s
|
||||||
fixed_t pz, pzt; // physical bottom/top for sorting with 3D floors
|
fixed_t pz, pzt; // physical bottom/top for sorting with 3D floors
|
||||||
|
|
||||||
fixed_t startfrac; // horizontal position of x1
|
fixed_t startfrac; // horizontal position of x1
|
||||||
fixed_t scale, sortscale; // sortscale only differs from scale for flat sprites
|
fixed_t scale, sortscale; // sortscale only differs from scale for paper sprites and MF2_LINKDRAW
|
||||||
fixed_t scalestep; // only for flat sprites, 0 otherwise
|
fixed_t scalestep; // only for paper sprites, 0 otherwise
|
||||||
fixed_t xiscale; // negative if flipped
|
fixed_t xiscale; // negative if flipped
|
||||||
|
|
||||||
fixed_t texturemid;
|
fixed_t texturemid;
|
||||||
|
|
Loading…
Reference in a new issue